Chaoz

Fixed Code

Oct 9th, 2012
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.42 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define PRESSED(%0) \
  4.         (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
  5.  
  6. new countpos[MAX_PLAYERS];
  7. new Flame[MAX_PLAYERS][2];
  8.  
  9. forward Counter();
  10.  
  11. public OnFilterScriptInit()
  12. {
  13.     print("\n--------------------------------------");
  14.     print(" Comandos Para Servers By Ronald");
  15.     print("--------------------------------------\n");
  16.     SetTimer("Counter",1000,1);
  17.     return 1;
  18. }
  19.  
  20. public OnFilterScriptExit()
  21. {
  22.     return 1;
  23. }
  24.  
  25. public OnPlayerCommandText(playerid, cmdtext[])
  26. {
  27.     if(!strcmp("/pinchar",cmdtext,true)) {
  28.         if(!IsPlayerInAnyVehicle(playerid)) {
  29.             SendClientMessage(playerid,-1,"Debes estar en un vehiculo para poder usar este comando");
  30.             return 1;
  31.         }
  32.         new panels,doors,lights,tires,vehicleid = GetPlayerVehicleID(playerid);
  33.         GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
  34.         UpdateVehicleDamageStatus(vehicleid, panels, doors, lights,  0x5);
  35.         return 1;
  36.     }
  37.     return 0;
  38. }
  39. //////////////
  40.  
  41. public OnPlayerConnect(playerid)
  42. {
  43.     countpos[playerid] = 0;
  44.     return 1;
  45. }
  46.  
  47. public Counter()
  48. {
  49.     for(new i; i < GetMaxPlayers(); i++)
  50.     {
  51.         if(IsPlayerConnected(i) && countpos[i] != 0)
  52.         {
  53.             countpos[i]++;
  54.             if(countpos[i] == 4)
  55.             {
  56.                 countpos[i] = 0;
  57.                 DestroyObject(Flame[i][0]);
  58.                 DestroyObject(Flame[i][1]);
  59.             }
  60.         }
  61.     }
  62.     return 1;
  63. }
  64.  
  65. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  66. {
  67.     if (PRESSED(KEY_FIRE))
  68.     {
  69.         new vehid = GetPlayerVehicleID(playerid);
  70.         if(GetVehicleModel(vehid) == 522)
  71.         {
  72.             new Float:Velocity[3];
  73.             GetVehicleVelocity(vehid, Velocity[0], Velocity[1], Velocity[2]);
  74.             if(Velocity[0] <1.3  && Velocity[1] < 1.3 && Velocity[0] > -1.3 && Velocity[1] > -1.3)
  75.             {
  76.                 SetVehicleVelocity(vehid, Velocity[0]*2, Velocity[1]*2, 0.0);
  77.                 if(countpos[playerid] == 0)
  78.                 {
  79.                     Flame[playerid][0] = CreateObject(18693, 0.0, 0.0, 0.0, 0.0, 0, 0, 0);
  80.                     Flame[playerid][1] = CreateObject(18693, 0.0, 0.0, 0.0, 0.0, 0, 0, 0);
  81.                     AttachObjectToVehicle(Flame[playerid][0], vehid, 0.194999, 0.439999, 0.044999, 86.429962, 0.000000, 0.000000);
  82.                     AttachObjectToVehicle(Flame[playerid][1], vehid, -0.204999, 0.439999, 0.044999, 86.429962, 0.000000, 0.000000);
  83.                     countpos[playerid] = 1;
  84.                 }
  85.             }
  86.         }
  87.     }
  88. }
  89.  
  90. public OnPlayerDisconnect(playerid, reason)
  91. {
  92.     if(countpos[playerid] != 0)
  93.     {
  94.         countpos[playerid] = 0;
  95.         DestroyObject(Flame[playerid][0]);
  96.         DestroyObject(Flame[playerid][1]);
  97.     }
  98.     return 1;
  99. }
Advertisement
Add Comment
Please, Sign In to add comment