#include <sourcemod>
#include <sdkhooks>
#include <sdktools>
#include <codmod>
new String:nazwy_broni[][] =
{
"weapon_none", // 0
"weapon_negev", // 1
"weapon_m249", // 2
"weapon_awp", // 3
"weapon_scar20", // 4
"weapon_g3sg1", // 5
"weapon_aug", // 6
"weapon_sg556", // 7
"weapon_m4a1_silencer", // 8
"weapon_m4a1", // 9
"weapon_ak47", // 10
"weapon_ssg08", // 11
"weapon_famas", // 12
"weapon_galilar", // 13
"weapon_bizon", // 14
"weapon_p90", // 15
"weapon_ump45", // 16
"weapon_mp9", // 17
"weapon_mp7", // 18
"weapon_mac10", // 19
"weapon_sawedoff", // 20
"weapon_mag7", // 21
"weapon_xm1014", // 22
"weapon_nova", // 23
"weapon_fiveseven", // 24
"weapon_elite", // 25
"weapon_revolver", // 26
"weapon_deagle", // 27
"weapon_cz75a", // 28
"weapon_tec9", // 29
"weapon_p250", // 30
"weapon_hkp2000", // 31
"weapon_usp_silencer", // 32
"weapon_glock", // 33
"weapon_knife", // 34
"weapon_taser", // 35
"weapon_decoy", // 36
"weapon_hegrenade", // 37
"weapon_incgrenade", // 38
"weapon_molotov", // 39
"weapon_flashbang", // 40
"weapon_smokegrenade", // 41
"weapon_c4" // 42
};
new naboje_broni[][] =
{
{0, 0}, // 0
{150, 200}, // 1
{100, 200}, // 2
{10, 30}, // 3
{20, 90}, // 4
{20, 90}, // 5
{30, 90}, // 6
{30, 90}, // 7
{20, 40}, // 8
{30, 90}, // 9
{30, 90}, // 10
{10, 90}, // 11
{25, 90}, // 12
{35, 90}, // 13
{64, 120}, // 14
{50, 100}, // 15
{25, 100}, // 16
{30, 120}, // 17
{30, 120}, // 18
{30, 100}, // 19
{7, 32}, // 20
{5, 32}, // 21
{7, 32}, // 22
{8, 32}, // 23
{20, 100}, // 24
{30, 120}, // 25
{8, 8}, // 26
{7, 35}, // 27
{12, 12}, // 28
{32, 120}, // 29
{13, 26}, // 30
{13, 52}, // 31
{12, 24}, // 32
{20, 120}, // 33
{0, 0}, // 34
{-1, 1}, // 35
{-1, 1}, // 36
{-1, 1}, // 37
{-1, 1}, // 38
{-1, 1}, // 39
{-1, 2}, // 40
{-1, 1}, // 41
{-1, 1} // 42
};
new const String:frakcja[] = "Normalne";
new const String:nazwa[] = "Zwinne Palce";
new const String:opis[] = "Posiadasz natychmiastowe przeladowanie broni";
new bool:ma_item[65];
public Plugin:myinfo =
{
name = nazwa,
author = "Linux`",
description = "Cod Item",
version = "1.0",
url = "http://steamcommunity.com/id/linux2006"
};
public OnPluginStart()
{
cod_register_item(frakcja, nazwa, opis, 0, 0);
}
public cod_item_enabled(client)
{
ma_item[client] = true;
}
public cod_item_disabled(client)
{
ma_item[client] = false;
}
public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapons)
{
if(!IsValidClient(client) || !ma_item[client])
return Plugin_Continue;
if(!IsPlayerAlive(client))
return Plugin_Continue;
new active_weapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
if(active_weapon != -1)
{
new naboje = GetEntData(active_weapon, FindSendPropInfo("CWeaponCSBase", "m_iClip1"));
if((!naboje || buttons & IN_RELOAD) && !(buttons & IN_ATTACK))
{
new String:weapon[32];
GetClientWeapon(client, weapon, sizeof(weapon));
new weaponid = GetUserWeaponId(weapon);
if(weaponid && naboje < naboje_broni[weaponid][0] && naboje_broni[weaponid][1])
{
new amunicja = GetEntProp(active_weapon, Prop_Send, "m_iPrimaryReserveAmmoCount");
if(amunicja)
{
SetEntData(active_weapon, FindSendPropInfo("CWeaponCSBase", "m_iClip1"), (naboje+amunicja < naboje_broni[weaponid][0])? naboje+amunicja: naboje_broni[weaponid][0]);
SetEntProp(active_weapon, Prop_Send, "m_iPrimaryReserveAmmoCount", (amunicja-(naboje_broni[weaponid][0]-naboje) < 1)? 0: amunicja-(naboje_broni[weaponid][0]-naboje));
}
}
}
}
return Plugin_Continue;
}
public GetUserWeaponId(String:weapon[])
{
for(new i = 1; i < sizeof(nazwy_broni); i ++)
{
if(StrEqual(weapon, nazwy_broni[i]))
return i;
}
return -1;
}