Advertisement
Guest User

Untitled

a guest
Dec 27th, 2011
541
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.74 KB | None | 0 0
  1. new UsingJoypad[MAX_SERVER_SLOTS];
  2.  
  3. public OnPlayerConnect(playerid)
  4. {
  5.     UsingJoypad[playerid] = 0;
  6.     return 1;
  7. }
  8.  
  9. public OnPlayerUpdate(playerid)
  10. {
  11.     if(UsingJoypad[playerid] == 0) {
  12.         new keys, updown, leftright;
  13.         GetPlayerKeys (playerid, keys, updown, leftright);
  14.         if((updown != 128 && updown != 0 && updown != -128) || (leftright != 128 && leftright != 0 && leftright != -128)) {
  15.             UsingJoypad[playerid] = 1;
  16.         }
  17.     }
  18.     return 1;
  19. }
  20.  
  21. public OnPlayerSpawn(playerid)
  22. {
  23.     if(!JoypadDetect(playerid)) { printf("id %d is NOT using a joypad."); }
  24.     else { printf("id %d IS using a joypad."); }
  25. }
  26.  
  27. stock JoypadDetect(playerid)
  28. {
  29.     if(UsingJoypad[playerid] == 0) return 0;
  30.     return 1;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement