SA-MP Forums Archive
Facing Problem with OnPlayerKeyStateChange - 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: Facing Problem with OnPlayerKeyStateChange (/showthread.php?tid=533674)



Facing Problem with OnPlayerKeyStateChange - Meow22 - 25.08.2014

pawn Код:
if(newkeys == KEY_HANDBRAKE)
        {
                if (IsPlayerInAnyVehicle(playerid) && GetVehicleModel(GetPlayerVehicleID(playerid)) != 476)
        {
            return SendClientMessage(playerid, 0xFF0000AA, "You entered in a Bomber plane press SPACE to drop bomb.");
        }
    else
        {
            new Float:VBPos[3];
            GetVehiclePos(GetPlayerVehicleID(playerid),VBPos[0],VBPos[1],VBPos[2]);
            MapAndreas_FindZ_For2DCoord(VBPos[0], VBPos[1], VBPos[2]);
            CreateExplosion(VBPos[0], VBPos[1], VBPos[2], 7, 20.0);
        }
                return 1;
        }
It's not giving error or warning......When i tested at Test Server was working fine but when i added in Host >.> it was not working Can anybody help me please?


Re: Facing Problem with OnPlayerKeyStateChange - jakejohnsonusa - 25.08.2014

What host are you using?

Are you sure it's working in your home test server?


Re: Facing Problem with OnPlayerKeyStateChange - Pottus - 25.08.2014

You are checking for keypresses improperly.

pawn Код:
if(newkeys == KEY_HANDBRAKE)
That would only work if you only pressed that key an no others which can be useful in some cases you want to use this.

pawn Код:
if(newkeys & KEY_HANDBRAKE)