Guest User

OnPlayerKeyStateChange lock system

a guest
Aug 2nd, 2014
569
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.81 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define PRESSED(%0) \
  4.     (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
  5.    
  6. #define RELEASED(%0) \
  7.     (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
  8.    
  9. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  10. {
  11.     if (PRESSED(KEY_WALK))//LALT KEY
  12.     {
  13.         if (IsPlayerInAnyVehicle(playerid))
  14.         {
  15.             for(new i = 0; i < MAX_PLAYERS; i++)
  16.             SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i,false,true);
  17.             GameTextForPlayer(playerid, "Locked", 5000, 3);
  18.         }
  19.         if (PRESSED(KEY_ACTION))//TAB KEY
  20.     {
  21.         if (IsPlayerInAnyVehicle(playerid))
  22.         {
  23.             for(new i = 0; i < MAX_PLAYERS; i++)
  24.             SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i,false,false);
  25.             GameTextForPlayer(playerid, "Unlocked", 5000, 3);
  26.         }
  27.     }
  28.     }
  29.     return 1;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment