Advertisement
Guest User

bla bla

a guest
Aug 1st, 2014
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.35 KB | None | 0 0
  1. #include <a_samp>
  2. forward color(playerid);
  3.  
  4. new CarColorChanger[MAX_PLAYERS];
  5. new ctimer[MAX_PLAYERS];
  6.  
  7.  
  8.  
  9. public OnFilterScriptInit()
  10. {
  11.     print("Random Car Colors made by Phyzic Loaded");
  12.     return 1;
  13. }
  14.  
  15. public OnPlayerCommandText(playerid, cmdtext[])
  16. {
  17.     if (strcmp("/carcolor", cmdtext, true, 10) == 0)
  18.     {
  19.       if(IsPlayerInAnyVehicle(playerid))
  20.       {
  21.         ctimer[playerid] = SetTimer("color", 1000, true);
  22.         CarColorChanger[playerid]=1;
  23.       }
  24.       else SendClientMessage(playerid, -1, "Error! You need to be in a vehicle to use this command");
  25.       return 1;
  26.     }
  27.     if (strcmp("/carcoloroff", cmdtext, true, 10) == 0)
  28.     {
  29.       if(CarColorChanger[playerid] == 1)
  30.       {
  31.         KillTimer( ctimer[playerid] );
  32.         CarColorChanger[playerid]=0;
  33.       }
  34.       else SendClientMessage(playerid, -1, "Error! Car Color is already off..");
  35.       return 1;
  36.     }
  37.     return 0;
  38. }
  39.  
  40. public OnPlayerDisconnect(playerid, reason)
  41. {
  42.  
  43. if(CarColorChanger[playerid] == 1)
  44. {
  45. KillTimer(ctimer[playerid]);
  46. CarColorChanger[playerid] = 0;
  47. }
  48.  
  49. return 1;
  50. }
  51.  
  52.  
  53.  
  54.  
  55.  
  56. public color(playerid)
  57. {
  58.     new vehicle;
  59.     vehicle = GetPlayerVehicleID(playerid);
  60.     if(!IsPlayerInAnyVehicle(playerid))return KillTimer(ctimer[playerid]);
  61.  
  62.         new r = random(71);
  63.         ChangeVehicleColor(vehicle, r, r);
  64. return 1;
  65.  
  66.  
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement