AWP FAMAS SCOUT SG552 G3SG1 GLOCK.
Dodajemy nową zmienną:
Szukamy:
new bool:g_wasducking[MAX+1]
Pod tym dodajemy:
new Weapons[33][2]
Szukamy
pubic CurWeapon
Pod new clip,ammo Dodajemy
new Gun = read_data(2)
new Ammo = read_data(3)
Pod: if (is_user_connected(id)) (w public CurWeapon) Dodajemy:
{
if(Gun==CSW_AWP || Gun==CSW_FAMAS || Gun==CSW_SCOUT || Gun==CSW_SG552 || Gun==CSW_G3SG1 || Gun==CSW_GLOCK18)
return PLUGIN_CONTINUE
if(Weapons[id][0] == Gun && Weapons[id][1] <= Ammo)
{
Weapons[id][1] = Ammo
return PLUGIN_CONTINUE
}
Weapons[id][0] = Gun
Weapons[id][1] = Ammo
new Float:N_Speed
N_Speed = 2.0;
if(player_class[id]==Nazwa_Klasy)
{
new weapon[32]
get_weaponname(Gun,weapon,31)
new Ent = fm_find_ent_by_owner2(-1,weapon,id)
if(Ent)
{
new Float:Delay = get_pdata_float( Ent, 46, 4) * N_Speed
if (Delay > 0.0)
set_pdata_float( Ent, 46, Delay, 4)
}
}
return PLUGIN_CONTINUE
}
Pod public CurWeapon dodajemy:
stock fm_find_ent_by_owner2(index, const classname[], owner, jghgtype = 0)
{
new strtype[11] = "classname", ent = index
switch (jghgtype)
{
case 1: strtype = "target"
case 2: strtype = "targetname"
}
while ((ent = engfunc(EngFunc_FindEntityByString, ent, strtype, classname)) && pev(ent, pev_owner) != owner) {}
return ent
}
Jeśli ktoś chce zamiast klasy item to:
Zamieniamy:
{
if(Gun==CSW_AWP || Gun==CSW_FAMAS || Gun==CSW_SCOUT || Gun==CSW_SG552 || Gun==CSW_G3SG1 || Gun==CSW_GLOCK18)
return PLUGIN_CONTINUE
if(Weapons[id][0] == Gun && Weapons[id][1] <= Ammo)
{
Weapons[id][1] = Ammo
return PLUGIN_CONTINUE
}
Weapons[id][0] = Gun
Weapons[id][1] = Ammo
new Float:N_Speed
N_Speed = 2.0;
if(player_class[id]==Nazwa_Klasy)
{
new weapon[32]
get_weaponname(Gun,weapon,31)
new Ent = fm_find_ent_by_owner2(-1,weapon,id)
if(Ent)
{
new Float:Delay = get_pdata_float( Ent, 46, 4) * N_Speed
if (Delay > 0.0)
set_pdata_float( Ent, 46, Delay, 4)
}
}
return PLUGIN_CONTINUE
}
Na:
{
if(Gun==CSW_AWP || Gun==CSW_FAMAS || Gun==CSW_SCOUT || Gun==CSW_SG552 || Gun==CSW_G3SG1 || Gun==CSW_GLOCK18)
return PLUGIN_CONTINUE
if(Weapons[id][0] == Gun && Weapons[id][1] <= Ammo)
{
Weapons[id][1] = Ammo
return PLUGIN_CONTINUE
}
Weapons[id][0] = Gun
Weapons[id][1] = Ammo
new Float:N_Speed
N_Speed = 2.0;
if(player_item_id[id]==Numer_Itemu)
{
new weapon[32]
get_weaponname(Gun,weapon,31)
new Ent = fm_find_ent_by_owner2(-1,weapon,id)
if(Ent)
{
new Float:Delay = get_pdata_float( Ent, 46, 4) * N_Speed
if (Delay > 0.0)
set_pdata_float( Ent, 46, Delay, 4)
}
}
return PLUGIN_CONTINUE
}