Trying this under OnPlayerWeaponShot - Doesn't seem to work.
#1

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?
Reply
#2

try to put in onplayerupdate
Reply
#3

Do you by chance have Lag-compensation turned off?
Reply
#4

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.
Reply
#5

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...)
Reply
#6

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.
Reply
#7

Try GetPlayerWeaponState with WEAPONSTATE_LAST_BULLET.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)