SA-MP Forums Archive
[FilterScript] [Simple]Detect Joypad - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] [Simple]Detect Joypad (/showthread.php?tid=306616)



[Simple]Detect Joypad - Kyle - 27.12.2011

Hi guys, some of you want to know how to be able to detect a joypad with a simple code. It may be a little inaccurate within the first 30 seconds of your very first spawn but once it's found if it's joypad or not it's fine.

http://pastie.org/private/uvbn3ydj8jkcxtcwdmjy1q

http://pastebin.com/RGtPuDGS

I've included an example in the pastie but here it is anyhow:

pawn Код:
public OnPlayerSpawn(playerid)
{
        if(!JoypadDetect(playerid)) { printf("id %d is NOT using a joypad."); }
        else { printf("id %d IS using a joypad."); }
}
Enjoy.


Re: [Simple]Detect Joypad - FireCat - 27.12.2011

Ok this is useless...
Aren't you going to explain how would you use it?! <.<
EDIT:
Nvm.


AW: [Simple]Detect Joypad - BigETI - 27.12.2011

What's about virtual gamepad drivers which emulates the gamepads?


Re: AW: [Simple]Detect Joypad - Mauzen - 27.12.2011

Quote:
Originally Posted by BigETI
Посмотреть сообщение
What's about virtual gamepad drivers which emulates the gamepads?
Will also be detected, as this simply checks if the movement keys value is not a "key-extremum" (-128,0,12. Using a joypad, no matter if its a real one or just simulated, will also cause other values here.


Re: [Simple]Detect Joypad - Geryy - 28.12.2011

GooD This code for detected when joypad connected to PC.


Re: [Simple]Detect Joypad - Sriubauskas - 28.12.2011

It is too many errors, please edit


Re: [Simple]Detect Joypad - Kyle - 28.12.2011

Quote:
Originally Posted by Sriubauskas
Посмотреть сообщение
It is too many errors, please edit
There is no problem in the code, the only thing could make an error is MAX_SERVER_SLOTS, replace that with:

MAX_PLAYERS.