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



Code stopping - Marricio - 06.04.2012

The code stops at GetPlayerWeapon, i did debug, thats how i figured out that.

pawn Код:
if( newkeys & KEY_FIRE )
    {
        print("1" );
        if( GetPlayerWeapon( playerid ) == 40 )
        {
         print("2" );
It never gets to 2.

EDIT:Nevermind, i figured out why, the weapon gets removed before this callback is called.


Re: Code stopping - ViniBorn - 06.04.2012

So, bug fixed?


Re: Code stopping - Marricio - 06.04.2012

No, i have another question, how to check when a player uses a weapon (FIRE) without using OnPlayerKeyStateChange?. Since when i press FIRE_KEY detonator is removed before OnPlayerKeyStateChange is called.


Re: Code stopping - ViniBorn - 06.04.2012

Look GetPlayerKeys


Re: Code stopping - Marricio - 06.04.2012

Guess it works only for updown rightleft?


Re: Code stopping - ViniBorn - 06.04.2012

No. Example :

pawn Код:
public OnPlayerUpdate(playerid)
{
    new Keys,ud,lr;
    GetPlayerKeys(playerid,Keys,ud,lr);

    if(Keys == KEY_SPRINT)
        SendClientMessage(playerid, 0xFFFFFFFF, "KEY_SPRINT");
    else if(Keys == KEY_JUMP)
        SendClientMessage(playerid, 0xFFFFFFFF, "KEY_JUMP");

    return 1;
}