Copy4u.pl ;)

Created Diff never expires
41 removals
296 lines
79 additions
333 lines
// Ignored xs__ variables
// Ignored xs__ variables
#pragma semicolon 1
#pragma semicolon 1
#pragma ctrlchar '\'
#pragma ctrlchar '\'


new MaxClients;
new MaxClients;
new MapName[64];
new NULL_STRING[1];
new NULL_STRING[1];
new Float:NULL_VECTOR[3];
new Float:NULL_VECTOR[3];
new TeamName[4][] =
new TeamColor[4][] =
{
{
"",
"",
"TERRORIST",
"TERRORIST",
"CT",
"CT",
"SPECTATOR"
"SPECTATOR"
};
};
new g_szSciezkiCzapek[2][46] =
new name[11] =
{
90, 69, 58, 32, 67, 122, 97, 112, 107, 105, 0
}
new version[4] =
{
49, 46, 48, 0
}
new author[7] =
{
{
"models/czapki_d0naciak/czapki_d0naciak_v1.mdl",
100, 114, 101, 100, 101, 107, 0
"models/czapki_d0naciak/czapki_d0naciak_v2.mdl"
}
new url_author[19] =
{
104, 116, 116, 112, 115, 58, 47, 47, 97, 109, 120, 120, 52, 117, 46, 112, 108, 47, 0
}
new g_szSciezkiCzapek[3][45] =
{
"models/czapki_amxx4u/v1/czapki_amxx4u_v1.mdl",
"models/czapki_amxx4u/v1/czapki_amxx4u_v2.mdl",
"models/czapki_amxx4u/v1/czapki_amxx4u_v3.mdl"
};
};
new g_szListaCzapek[44][4][0];
new g_szListaCzapek[76][4][0];
new g_iCzapkaGracza[33];
new g_iCzapkaGracza[33];


fm_find_ent_by_owner(index, String:classname[], owner, jghgtype)
fm_find_ent_by_owner(index, String:classname[], owner, jghgtype)
{
{
new strtype[11];
new strtype[11];
strtype[0] = 276;
strtype[0] = 20;
new ent = index;
new ent = index;
switch (jghgtype)
switch (jghgtype)
{
{
case 1:
case 1:
{
{
strtype[0] = 316;
strtype[0] = 60;
}
}
case 2:
case 2:
{
{
strtype[0] = 344;
strtype[0] = 88;
}
}
default:
default:
{
{
}
}
}
}


/ * ERROR! Nie można rzutować obiektu typu 'Lysis.DSentinel' na typ 'Lysis.DReturn'. * /
/ * ERROR! Nie można rzutować obiektu typu 'Lysis.DSentinel' na typ 'Lysis.DReturn'. * /
function "fm_find_ent_by_owner"
function "fm_find_ent_by_owner"
fm_find_ent_by_owner(index, String:classname[], owner, jghgtype)
fm_find_ent_by_owner(index, String:classname[], owner, jghgtype)


ColorChat(id, Color:type, String:msg[])
ColorChat(id, Color:type, String:msg[])
{
{
!!! Removed Phi
!!! Removed Phi
new message[256];
new message[256];
switch (type)
switch (type)
{
{
case 1:
case 1:
{
{
message[0] = 1;
message[0] = 1;
}
}
case 2:
case 2:
{
{
message[0] = 4;
message[0] = 4;
}
}
default:
default:
{
{
message[0] = 3;
message[0] = 3;
}
}
}
}
vformat(message[1], 251, msg, 4);
vformat(message[1], 251, msg, 4);
message[191] = 0;
message[192] = 0;
new team = 0;
new team = 0;
new ColorChange = 0;
new ColorChange = 0;
new index = 0;
new index = 0;
new MSG_Type = 0;
new MSG_Type = 0;
if (id)
if (id)
{
{
MSG_Type = 1;
MSG_Type = 1;
index = id;
index = id;
}
}
else
else
{
{
index = FindPlayer();
index = FindPlayer();
MSG_Type = 2;
MSG_Type = 2;
}
}
new var1 = Heap_4;
new var1 = Heap_4;
var1[0] = 500;
var1[0] = 244;
team = get_user_team(index, var1, 0);
team = get_user_team(index, var1, 0);
ColorChange = ColorSelection(index, MSG_Type, type);
ColorChange = ColorSelection(index, MSG_Type, type);
ShowColorMessage(index, MSG_Type, message);
ShowColorMessage(index, MSG_Type, message);
if (ColorChange)
if (ColorChange)
{
{
Team_Info(index, MSG_Type, TeamName[team][0][0]);
Team_Info(index, MSG_Type, TeamColor[team][0][0]);
}
}
return 0;
return 0;
}
}


ShowColorMessage(id, type, String:message[])
ShowColorMessage(id, type, String:message[])
{
{
!!! Removed Phi
static bool:saytext_used;
static get_user_msgid_saytext;
static get_user_msgid_saytext;
if (!get_user_msgid_saytext)
if (!saytext_used)
{
{
get_user_msgid_saytext = get_user_msgid("SayText");
get_user_msgid_saytext = get_user_msgid("SayText");
saytext_used = 1;
}
}
message_begin(type, get_user_msgid_saytext, 540, id);
message_begin(type, get_user_msgid_saytext, 288, id);
write_byte(id);
write_byte(id);
write_string(message);
write_string(message);
message_end();
message_end();
return 0;
return 0;
}
}


Team_Info(id, type, String:team[])
Team_Info(id, type, String:team[])
{
{
!!! Removed Phi
!!! Removed Phi
static bool:teaminfo_used;
static bool:teaminfo_used;
static get_user_msgid_teaminfo;
static get_user_msgid_teaminfo;
if (!teaminfo_used)
if (!teaminfo_used)
{
{
get_user_msgid_teaminfo = get_user_msgid("TeamInfo");
get_user_msgid_teaminfo = get_user_msgid("TeamInfo");
teaminfo_used = 1;
teaminfo_used = 1;
}
}
message_begin(type, get_user_msgid_teaminfo, 540, id);
message_begin(type, get_user_msgid_teaminfo, 288, id);
write_byte(id);
write_byte(id);
write_string(team);
write_string(team);
message_end();
message_end();
return 1;
return 1;
}
}


ColorSelection(index, type, Color:Type)
ColorSelection(index, type, Color:Type)
{
{
switch (Type)
switch (Type)
{
{
case 4:
case 4:
{
{
new var1 = TeamName;
new var1 = TeamColor;
return Team_Info(index, type, var1[0][0][var1]);
return Team_Info(index, type, var1[0][0][var1]);
}
}
case 5:
case 5:
{
{
return Team_Info(index, type, TeamName[1][0]);
return Team_Info(index, type, TeamColor[1][0]);
}
}
case 6:
case 6:
{
{
return Team_Info(index, type, TeamName[2][0]);
return Team_Info(index, type, TeamColor[2][0]);
}
}
default:
default:
{
{
return 0;
return 0;
}
}
}
}
}
}


FindPlayer()
FindPlayer()
{
{
new i = -1;
new i = -1;
static iMaxPlayers;
while (get_maxplayers() >= i)
if (!iMaxPlayers)
{
iMaxPlayers = get_maxplayers();
while (i <= iMaxPlayers)
{
i++;
if (is_user_connected(i))
{
return i;
}
}
return -1;
}
while (i <= iMaxPlayers)
{
{
i++;
i++;
if (is_user_connected(i))
if (is_user_connected(i))
{
{
return i;
return i;
}
}
}
}
return -1;
return -1;
}
}


public plugin_init()
public plugin_init()
{
{
register_plugin("Czapki", "0.1", "SgtBane, K!113r & d0naciak", "", "");
register_plugin("ZE: Czapki", "1.0", "dredek", url_author);
register_clcmd("say /czapki", "cmd_Czapki", -1, "", -1, MaxClients);
register_clcmd("say /models", "cmd_Czapki", -1, "", -1, MaxClients);
register_clcmd("say /hats", "cmd_Czapki", -1, "", -1, MaxClients);
return 0;
return 0;
}
}


public plugin_natives()
public plugin_natives()
{
{
register_native("hats_menu", "cmd_Czapki", 1);
register_native("hats_menu", "cmd_Czapki", 1);
register_native("set_user_hat", "nat_UstawCzapke", 1);
return 0;
}

public nat_UstawCzapke(id, iModel, iSubModel)
{
!!! Removed Phi
new iEnt = fm_find_ent_by_owner(0, "hat_jb", id, 0);
new bool:bMial = 1;
if (0 >= iEnt)
{
iEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
bMial = 0;
}
if (0 < iEnt)
{
if (!bMial)
{
set_pev(iEnt, pev_classname, "hat_jb");
set_pev(iEnt, pev_movetype, 12);
set_pev(iEnt, pev_solid, 0);
set_pev(iEnt, pev_aiment, id);
set_pev(iEnt, pev_owner, id);
set_pev(iEnt, pev_rendermode, 0);
}
engfunc(EngFunc_SetModel, iEnt, g_szSciezkiCzapek[iModel][0][0]);
set_pev(iEnt, pev_body, iSubModel);
}
return 0;
return 0;
}
}


public plugin_precache()
public plugin_precache()
{
{
new i = 0;
new i = 0;
while (i < 2)
while (i < 3)
{
{
precache_model(g_szSciezkiCzapek[i][0][0]);
precache_model(g_szSciezkiCzapek[i][0][0]);
i++;
i++;
}
}
return 0;
return 0;
}
}


public client_disconnect(id)
public client_disconnected(id)
{
{
Set_Hat(id, 0, false);
Set_Hat(id, 0, false);
return 0;
return 0;
}
}


public cmd_Czapki(id)
public cmd_Czapki(id)
{
{
new szItem[128];
new szItem[128];
new iMenu = 0;
new iMenu = 0;
new var2 = g_iCzapkaGracza;
new var2 = g_iCzapkaGracza;
new var1;
new var1;
if (!var2[id][0][0])
if (!var2[id][0][0])
{
{
copy(szItem, 127, "\yTwoja czapka:\d Brak\n\nWybierz czapke:");
copy(szItem, 127, "\yTwoja czapka:\d Brak\n\nWybierz czapke:");
var1 = var2;
var1 = var2;
}
}
else
else
{
{
new var3 = g_szListaCzapek[g_iCzapkaGracza[id][0][0]][0][0];
new var3 = g_szListaCzapek[g_iCzapkaGracza[id][0][0]][0][0];
formatex(szItem, 127, "\yTwoja czapka:\r %s\n\n\yWybierz czapke:", var3[0][var3]);
formatex(szItem, 127, "\yTwoja czapka:\r %s\n\n\yWybierz czapke:", var3[0][var3]);
var1 = var3;
var1 = var3;
}
}
iMenu = menu_create(szItem, "Czapki_Handler", 0);
iMenu = menu_create(szItem, "Czapki_Handler", 0);
menu_additem(iMenu, "\yZdejmij czapke", "", 0, -1);
menu_additem(iMenu, "\yZdejmij czapke", "", 0, -1);
new i = 0;
new i = 0;
while (i < 44)
while (i < 76)
{
{
new var4 = g_szListaCzapek[i][0][0];
new var4 = g_szListaCzapek[i][0][0];
menu_additem(iMenu, var4[0][var4], "", 0, -1);
menu_additem(iMenu, var4[0][var4], "", 0, -1);
i++;
i++;
}
}
menu_setprop(iMenu, 3, "Dalej");
menu_setprop(iMenu, 3, "Dalej");
menu_setprop(iMenu, 2, "Powrot");
menu_setprop(iMenu, 2, "Powrot");
menu_setprop(iMenu, 4, "Wyjscie");
menu_setprop(iMenu, 4, "Wyjscie");
menu_display(id, iMenu, 0, -1);
menu_display(id, iMenu, 0, -1);
return 1;
return 1;
}
}




/ * ERROR! control flow graph is not reducible * /
/ * ERROR! control flow graph is not reducible * /
function "Czapki_Handler"
function "Czapki_Handler"
public Czapki_Handler(id, iMenu, iItem)
public Czapki_Handler(id, iMenu, iItem)


Set_Hat(id, iCzapka, bool:bCzyPolaczony)
Set_Hat(id, iCzapka, bool:bCzyPolaczony)
{
{
!!! Removed Phi
!!! Removed Phi
if (iCzapka)
if (iCzapka)
{
{
if (g_szListaCzapek[iCzapka][0][0][2] && !read_flags(g_szListaCzapek[iCzapka][0][0][2]) & get_user_flags(id, 0))
if (g_szListaCzapek[iCzapka][0][0][2] && !read_flags(g_szListaCzapek[iCzapka][0][0][2]) & get_user_flags(id, 0))
{
{
return 0;
return 0;
}
}
new iEnt = fm_find_ent_by_owner(0, "hat_jb", id, 0);
new iEnt = fm_find_ent_by_owner(0, "hat_jb", id, 0);
new bool:bMial = 1;
new bool:bMial = 1;
if (0 >= iEnt)
if (0 >= iEnt)
{
{
iEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
iEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
bMial = 0;
bMial = 0;
}
}
if (0 < iEnt)
if (0 < iEnt)
{
{
if (!bMial)
if (!bMial)
{
{
set_pev(iEnt, pev_classname, "hat_jb");
set_pev(iEnt, pev_classname, "hat_jb");
set_pev(iEnt, pev_movetype, 12);
set_pev(iEnt, pev_movetype, 12);
set_pev(iEnt, pev_solid, 0);
set_pev(iEnt, pev_solid, 0);
set_pev(iEnt, pev_aiment, id);
set_pev(iEnt, pev_aiment, id);
set_pev(iEnt, pev_owner, id);
set_pev(iEnt, pev_owner, id);
set_pev(iEnt, pev_rendermode, 0);
set_pev(iEnt, pev_rendermode, 0);
}
}
engfunc(EngFunc_SetModel, iEnt, g_szSciezkiCzapek[g_szListaCzapek[iCzapka][0][0][3]][0][0]);
engfunc(EngFunc_SetModel, iEnt, g_szSciezkiCzapek[g_szListaCzapek[iCzapka][0][0][3]][0][0]);
set_pev(iEnt, pev_body, g_szListaCzapek[iCzapka][0][0][1]);
set_pev(iEnt, pev_body, g_szListaCzapek[iCzapka][0][0][1]);
}
}
new szNazwaCzapki[32];
new var2 = g_szListaCzapek[iCzapka][0][0];
new var2 = g_szListaCzapek[iCzapka][0][0];
ColorChat(id, Color:2, "[Czapki]\1 Zalozyles czapke:\3 %s", var2[0][var2]);
copy(szNazwaCzapki, 31, var2[0][var2]);
replace(szNazwaCzapki, 31, "\r", "");
replace(szNazwaCzapki, 31, "\y", "");
new var3 = g_szListaCzapek[iCzapka][0][0];
ColorChat(id, Color:2, "[Czapki]\1 Zalozyles czapke:\3 %s", var3[0][var3]);
}
}
else
else
{
{
new iEnt = fm_find_ent_by_owner(0, "hat_jb", id, 0);
new iEnt = fm_find_ent_by_owner(0, "hat_jb", id, 0);
if (0 < iEnt)
if (0 < iEnt)
{
{
engfunc(EngFunc_RemoveEntity, iEnt);
engfunc(EngFunc_RemoveEntity, iEnt);
}
}
if (bCzyPolaczony)
if (bCzyPolaczony)
{
{
ColorChat(id, Color:2, "[Czapki]\1 Zdjales czapke.");
ColorChat(id, Color:2, "[Czapki]\1 Zdjales czapke.");
}
}
}
}
g_iCzapkaGracza[id] = iCzapka;
g_iCzapkaGracza[id] = iCzapka;
return 1;
return 1;
}
}