Advertisement
AirKite

SA-MP [FS] UnDrive-By 1.01

Jan 13th, 2013
917
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.13 KB | None | 0 0
  1. /*  SA-MP [FS] UnDrive-By
  2.  *
  3.  *      Version: 1.01
  4.  *
  5.  *  (c) Copyright 2013, AirKite
  6.  *
  7.  *  URL: http://forum.sa-mp.com/showthread.php?p=2324746
  8.  */
  9. #include <a_samp>
  10.  
  11. #define DOUBLE_CLICK_TIME 1500 // ms (tick)
  12. #define REARMED_WEAPON_UPDATES 4 // count
  13.  
  14. new
  15.     g_TickPushed[MAX_PLAYERS],
  16.     g_Count[MAX_PLAYERS char],
  17.     g_Weapon[MAX_PLAYERS char];
  18.  
  19. public OnFilterScriptInit() print("[FS] UnDrive-By Loaded!");
  20. public OnFilterScriptExit() print("[FS] UnDrive-By Unloaded!");
  21.  
  22. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {
  23.     if(newkeys & KEY_CROUCH && GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) {
  24.         new tick = GetTickCount();
  25.         if(tick - g_TickPushed[playerid] < DOUBLE_CLICK_TIME) {
  26.             g_Weapon[playerid] = GetPlayerWeapon(playerid);
  27.             g_Count[playerid] = REARMED_WEAPON_UPDATES;
  28.             ApplyAnimation(playerid,"PED","facanger",4.1,0,1,1,1,1);
  29.             SetPlayerArmedWeapon(playerid, 0);
  30.         }
  31.         g_TickPushed[playerid] = tick;
  32.     }
  33.     return 1;
  34. }
  35.  
  36. public OnPlayerUpdate(playerid) {
  37.     if(g_Count[playerid]) {
  38.         if(--g_Count[playerid] == 0) {
  39.             SetPlayerArmedWeapon(playerid, g_Weapon[playerid]);
  40.         }
  41.     }
  42.     return 1;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement