SA-MP Forums Archive
Out of ammo - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Out of ammo (/showthread.php?tid=378057)



Out of ammo - TudvariHUN - 16.09.2012

Could someone write me a code,that detects when the player shoots his last ammo?
Please make it to work with lagging players.(laggings players couldn't avoid it)
Thanks


AW: Out of ammo - BiosMarcel - 16.09.2012

Put it in OnPlayerUpdate

PHP код:
if(GetPlayerAmmo(playerid) == 0)
{
new 
waffe[MAX_PLAYERS];
waffe[playerid] = GetPlayerWeapon(playerid);
new 
string[180];
new 
name[MAX_PLAYER_NAME];
format(string,sizeof(string),"%s's Weapon: %s has no Ammo",GetPlayerName(playerid,name,sizeof(name)),waffe);
for(new 
i=0i<MAX_PLAYERSi++)
{
if(
IsPlayerAdmin(i))
{
SendClientMessage(i,-1,string);
}
}

This send the Weapon and the Player to RCOn Admins


Re: Out of ammo - TudvariHUN - 16.09.2012

Will this work if the player is lagging?


AW: Out of ammo - BiosMarcel - 16.09.2012

Yes i think (-: