SA-MP Forums Archive
Code don't work - 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 don't work (/showthread.php?tid=307426)



Code don't work - Face9000 - 30.12.2011

I've this code to check if player has joypad:

pawn Код:
new JoyPadders[MAX_PLAYERS];

OnPlayerUpdate(playerid) {
    if(JoyPadders[playerid] == 0) {
        new keys, ud, lr;
        GetPlayerKeys(playerid, keys, ud, lr);
        if((ud != 128 && ud != 0 && ud != -128) || (lr != 128 && lr != 0 && lr != -128))
        JoyPadders[playerid] = 1;
        SendClientMessage(playerid, COLOR_GREEN, "Joypad detected,freezed.");
        TogglePlayerControllable(playerid,0);
        else
       //nothing.
    }
}
I tried to use joypad but the script doesn't freeze me and doesn't show that message,what's wrong?


Re: Code don't work - wildcookie007 - 30.12.2011

obviously the script doesn't detect the joypad thats why it doesn't work.


Re: Code don't work - [ABK]Antonio - 30.12.2011

Quote:
Originally Posted by wildcookie007
Посмотреть сообщение
obviously the script doesn't detect the joypad thats why it doesn't work.
Don't reply in things you don't know about....This DOES detect joypad...I've even tested it myself with whitetiger...It's even in Deadly Combinations A/D -_- The reason it works is because the spectrum of joypads is much larger than the spectrum of WASD

https://sampforum.blast.hk/showthread.php?tid=254295

pawn Код:
new JoyPadders[MAX_PLAYERS];

public OnPlayerUpdate(playerid)
{
    if(JoyPadders[playerid] == 0) {
        new keys, ud, lr;
        GetPlayerKeys(playerid, keys, ud, lr);
        if((ud != 128 && ud != 0 && ud != -128) || (lr != 128 && lr != 0 && lr != -128))
        JoyPadders[playerid] = 1;
        SendClientMessage(playerid, COLOR_GREEN, "Joypad detected,freezed.");
        TogglePlayerControllable(playerid,0);
    }
}
Try that...(this is if you actually did forget the public in front of onplayerupdate)