SA-MP Forums Archive
OnPlayerShoot... - 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: OnPlayerShoot... (/showthread.php?tid=389915)



OnPlayerShoot... - ZeQualX - 04.11.2012

Hi everyone i would like to make when a player tries to shoot deny it, so he wont shoot, any idea how i could make this work out? thanks.


Re: OnPlayerShoot... - s4kuL - 04.11.2012

you want the players do not use guns?


Re: OnPlayerShoot... - ZeQualX - 04.11.2012

i want the player to have the gun but not to shoot, when he attempts to shoot cancel it.


Re: OnPlayerShoot... - s4kuL - 04.11.2012

Ah sorry, i don't know what's this function.


Re: OnPlayerShoot... - cessil - 04.11.2012

you can't, you can deny the damage they do by setting everyone to the same team and then processing the damage being dealt by every player using OnPlayerTakeDamage or OnPlayerGiveDamage


Re: OnPlayerShoot... - Niko_boy - 04.11.2012

you can try it in OnPlayerUpdate and key states which may be inaccurate but yes u can give a try like:
OnplayerUpdate -> GetKeys -> if key = aim & fire -> apply anim / slap him etc..


Re: OnPlayerShoot... - JhnzRep - 04.11.2012

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (newkeys & KEY_FIRE)
    {
        if(GetPlayerWeapon(playerid) != 0)
        {
            SetPlayerArmedWeapon(playerid,0);
        }
    }
}
Not tested, but could work.


Re: OnPlayerShoot... - cessil - 04.11.2012

if OnPlayerKeyStateChange is called then that means they've already pressed the keys


Re: OnPlayerShoot... - JaKe Elite - 04.11.2012

Or maybe, Get the player's health,
When player is damaged by the other player, Set it back to current health.


Re: OnPlayerShoot... - ZeQualX - 04.11.2012

no, i need to cancel the shoot before he shoots i mean like when he's about to shoot cancel it, maybe an animation?