27.11.2014, 20:34
I don't know why that would cause lag, how-ever it may spam messages if they shoot over, and over with no lag. Maybe add something like this?
Using this, the message is only sent once per ammo outage. Just make sure the variable is also reset on disconnect /connect.
pawn Код:
new g_ShotMessage[MAX_PLAYERS];
if(GetPlayerAmmo(playerid) == 0 && g_ShotMessage[playerid] == 0)
{
ProxDetector(30.0, playerid, "* CLINK *", COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE);
SendClientMessage(playerid, COLOUR_GREY, "You are out of ammo for this weapon. You need to load more into it, before you can use it again.");
g_ShotMessage[playerid] = 1;
}
else if(GetPlayerAmmo(playerid) != 0 && g_ShotMessage[playerid] == 1)
{
g_ShotMessage[playerid] = 0;
}
return 1;