Chris53340

ChangeCarColor

Oct 31st, 2014
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  
  3. Fait par Christopher
  4. Change Car Color
  5. Mis à jour le 22/02/2015
  6.  
  7. */
  8.  
  9. #include <a_samp>
  10.  
  11. forward RainBowColor(playerid);
  12.  
  13. new TimerColor, bool:RainBow[MAX_PLAYERS];
  14.  
  15. public OnPlayerCommandText(playerid, cmdtext[]) {
  16.     if(strcmp(cmdtext, "/RainBow", true) == 0) {
  17.         switch(RainBow[playerid]) {
  18.             case false: {
  19.                 SendClientMessage(playerid, -1, "RainBow activé");
  20.                 RainBow[playerid] = true;
  21.                 if(IsPlayerInAnyVehicle(playerid)) RainBowColor(playerid);
  22.             }
  23.             case true: {
  24.                 SendClientMessage(playerid, -1, "Rainbow désactivé");
  25.                 KillTimer(TimerColor);
  26.                 RainBow[playerid] = false;
  27.             }
  28.         }
  29.         return 1;
  30.     }
  31.     return 0;
  32. }
  33. public OnPlayerExitVehicle(playerid, vehicleid) {
  34.     switch(RainBow[playerid]) {
  35.         case true: { KillTimer(TimerColor); RainBow[playerid] = false; }
  36.     }
  37.     return 1;
  38. }
  39. public OnPlayerEnterVehicle(playerid, vehicleid) {
  40.     switch(RainBow[playerid]) {
  41.         case false: { RainBowColor(playerid); RainBow[playerid] = true; }
  42.     }
  43.     return 1;
  44. }
  45. public RainBowColor(playerid) {
  46.     new Couleur = random(255) + 1, vehicleid = GetPlayerVehicleID(playerid);
  47.  
  48.     ChangeVehicleColor(vehicleid, Couleur, Couleur);
  49.     TimerColor = SetTimerEx("RainBowColor", 500, 0, "d" ,playerid);
  50. }
  51. #error Un merci ne fait pas de mal. 1 point de réputation non plus.
Advertisement
Add Comment
Please, Sign In to add comment