[FilterScript] [Simple]Detect Joypad
#1

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.
Reply
#2

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

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

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.
Reply
#5

GooD This code for detected when joypad connected to PC.
Reply
#6

It is too many errors, please edit
Reply
#7

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)