10.11.2011, 06:41
Quote:
Hungarian notation. The variables are prefixed with their "type".
szTest[] = string, zero-terminated (all strings in PAWN are what's called zero-terminated, i.e. the text ends at the first 0 in that array). fTest = float iTest = integer |
pawn Код:
stock IsWeaponInAnySlot(playerid, weaponid)
{
static
szWeapon, szAmmo
;
GetPlayerWeaponData(playerid, GetWeaponSlot(weaponid), szWeapon, szAmmo);
if(szWeapon == weaponid) return true;
#pragma unused szAmmo
return false;
}
stock GetPlayerWeaponInSlot(playerid, slot)
{
static
szWeapon, szAmmo
;
GetPlayerWeaponData(playerid, slot, szWeapon, szAmmo);
#pragma unused szAmmo
return szWeapon;
}
stock GetWeaponSlot(weaponid)
{
switch(weaponid)
{
case WEAPON_BRASSKNUCKLE:
return 0;
case WEAPON_GOLFCLUB .. WEAPON_CHAINSAW:
return 1;
case WEAPON_COLT45 .. WEAPON_DEAGLE:
return 2;
case WEAPON_SHOTGUN .. WEAPON_SHOTGSPA:
return 3;
case WEAPON_UZI, WEAPON_MP5, WEAPON_TEC9:
return 4;
case WEAPON_AK47, WEAPON_M4:
return 5;
case WEAPON_RIFLE, WEAPON_SNIPER:
return 6;
case WEAPON_ROCKETLAUNCHER .. WEAPON_MINIGUN:
return 7;
case WEAPON_GRENADE .. WEAPON_MOLTOV, WEAPON_SATCHEL:
return 8;
case WEAPON_SPRAYCAN .. WEAPON_CAMERA:
return 9;
case WEAPON_DILDO .. WEAPON_FLOWER:
return 10;
case 44, 45, WEAPON_PARACHUTE:
return 11;
case WEAPON_BOMB:
return 12;
}
return -1;
}