|
Veteran Member
Join Date: Jul 2006
Location: France (95)
|

12-24-2011
, 06:00
Re: [REQ] Fix add ammo
|
#1
|
Quote:
Originally Posted by Devil259
Code:
stock addBpAmmo( index , weapon , num )
{
cs_set_user_bpammo( index , weapon , cs_get_user_bpammo( id , weapon ) + num )
}
|
Simplified.
Following one could be usefull :
PHP Code:
enum
{
ammo_none,
ammo_338magnum = 1,
ammo_762nato,
ammo_556natobox,
ammo_556nato,
ammo_buckshot,
ammo_45acp,
ammo_57mm,
ammo_50ae,
ammo_357sig,
ammo_9mm
}
new const g_szAmmoNames[][] = {
"",
"338magnum",
"762nato",
"556natobox",
"556nato",
"buckshot",
"45acp",
"57mm",
"50ae",
"357sig",
"9mm"
}
new const g_iMaxAmmo[] = {-1, 30, 90, 200, 90, 32, 100, 100, 35, 52, 120}
new const g_iDefaultAmmo[] = {-1, 10, 30, 30, 30, 8, 12, 50, 7, 13, 30}
addBpAmmo(id, iId, amount = -1, max = -1)
{
new iAmmoType
switch(iId)
{
case CSW_AWP: iAmmoType = ammo_338magnum
case CSW_SCOUT, CSW_AK47, CSW_G3SG1: iAmmoType = ammo_762nato
case CSW_M249: iAmmoType = ammo_556natobox
case CSW_FAMAS, CSW_M4A1, CSW_AUG, CSW_SG550, CSW_GALI, CSW_SG552: iAmmoType = ammo_556nato
case CSW_M3, CSW_XM1014: iAmmoType = ammo_buckshot
case CSW_USP, CSW_UMP45, CSW_MAC10: iAmmoType = ammo_45acp
case CSW_FIVESEVEN, CSW_P90: iAmmoType = ammo_57mm
case CSW_DEAGLE: iAmmoType = ammo_50ae
case CSW_P228: iAmmoType = ammo_357sig
case CSW_GLOCK18, CSW_MP5NAVY, CSW_TMP, CSW_ELITE: iAmmoType = ammo_9mm
default:return 0
}
switch( max )
{
case -1:max = g_iMaxAmmo[iAmmoType]
case 0:max = 999999999
}
if( amount == -1 ) // give default
{
amount = g_iDefaultAmmo[iAmmoType]
}
ExecuteHamB(Ham_GiveAmmo, id, amount, g_szAmmoNames[iAmmoType], max)
}
__________________
Last edited by ConnorMcLeod; 12-24-2011 at 06:13.
|
|