Disabling fire when the ammo == 1 -
TudvariHUN - 11.07.2012
Hi!
I need a script,which disables firing if the ammo of the weapon is == 1.
Thanks
Re: Disabling fire when the ammo == 1 -
MP2 - 11.07.2012
Not really possible. Weapon firing is handled client-side.
Re: Disabling fire when the ammo == 1 -
Cypress - 11.07.2012
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & KEY_FIRE)
{
if(GetPlayerAmmo(playerid) == 1) SetPlayerArmedWeapon(playerid, 0);
}
return 1;
}
Re: Disabling fire when the ammo == 1 -
TudvariHUN - 11.07.2012
Will this work?If there is only 1 bullet in the weapon,the player is going to switch to hand?
Re: Disabling fire when the ammo == 1 -
MP2 - 11.07.2012
Not really, if they're lagging (even by like 5 MS) they will shoot the bullet before the server has a chance to detect it.
Re: Disabling fire when the ammo == 1 -
Cypress - 11.07.2012
Well I tested it with desert eagle. I had one bullet and it switched to hand. It's not really accurate, like if I'll do c-bug I can shot that ammo out.
However I think you can put that under a timer. So it will switch automatically if you'll hold a weapon with 1 bullet.
Re: Disabling fire when the ammo == 1 -
TudvariHUN - 11.07.2012
No.On my server the players can hold the weapon with 1 bullet,because it's equal to a weapon without bullets(in the real life).So players can scare others players,even if there is no bullet in the weapon.(Roleplay Server)
If this isn't possible,how can I do that player can hold weapon with no ammo?
Re: Disabling fire when the ammo == 1 -
clarencecuzz - 11.07.2012
Another thing that is yet impossible. Once a weapon reaches 0 ammo, it is automatically removed. There are some objects that you can attach using SetPlayerAttachedObject, like weapons, just search for them on the internet, and you can attach weapons once the weapon runs out of ammo.
Re: Disabling fire when the ammo == 1 -
TudvariHUN - 11.07.2012
That's why I would like to do it with the 1 bullet system.But yes,if the player is lagging it isn't working
Re: Disabling fire when the ammo == 1 -
Vince - 11.07.2012
What about
GetPlayerWeaponState? WEAPONSTATE_LAST_BULLET
That might be pretty accurate if used with OnPlayerUpdate.