Posts: 1,648
Threads: 482
Joined: Jun 2010
pawn Код:
new ammo = GetPlayerAmmo(playerid);
if(ammo == 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.");
}
It doesn't 'CLINK' when the AMMO is 0, could someone tell me why?
Posts: 111
Threads: 24
Joined: Aug 2014
Reputation:
0
try to put in onplayerupdate
Posts: 515
Threads: 5
Joined: Jun 2007
Reputation:
0
Do you by chance have Lag-compensation turned off?
Posts: 3,133
Threads: 71
Joined: Dec 2013
Reputation:
0
If the ammo is 0, then the weapon gets "trashed". The player looses the weapon when they run out of ammo, so therefore it wouldn't be called.
The exception would be weapons such as MP5, where you can fire multiple shots, and it'd be shooting a few extra(due to lag?) after the initial shot(s) were actually fired.
Note, you should return 0 if you don't want bullets to go through and sync to the server(and give damage, etc.).
A work-around for this would to be monitoring players with low weapon ammo, and freezing the weapon usage upon having 1 ammo round left.
Posts: 2,203
Threads: 154
Joined: Oct 2009
Reputation:
0
Im pretty sure that the bullets are decreased on server only after these (and maybe few more) callback(s).
Try if(ammo-1 == 0) (I dont think that it will work but still there is a change and it doesnt cost you to test...)
Posts: 1,648
Threads: 482
Joined: Jun 2010
Sorry for the delay.
Thank you for all your responses. I have lag compensation on. I thought it was something to do with the fact that the weapon gets trashed.
I save weapons with unique ID's. So they don't really get 'trashed' I'll come up with an alternative. Thank you all very kindly.