02.09.2015, 14:04
Hi guys, how i can do to detect infinite ammo of weapons ?
new bool:p_infinity[MAX_PLAYERS];
#define MAX_INFINITY_AMMO (9999)
public OnPlayerSpawn(playerid) {
p_infinity[playerid] = true;
return 1;
}
public OnPlayerUpdate(playerid) {
static
p_ammo[MAX_PLAYERS]
;
new weaponid = GetPlayerWeapon(playerid);
if (p_infinity[playerid] && weaponid && p_ammo[playerid] > GetPlayerAmmo(playerid) || p_ammo[playerid] < MAX_INFINITY_AMMO) {
GivePlayerWeapon(playerid, weaponid, MAX_INFINITY_AMMO);
SetPlayerAmmo(playerid, weaponid, MAX_INFINITY_AMMO);
p_ammo[playerid] = MAX_INFINITY_AMMO;
}
return 1;
}