daily pastebin goal
9%
SHARE
TWEET

Rainbow car

L0K3D_Hokage Jan 22nd, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. new
  2.     playerRainbowCar[MAX_PLAYERS],
  3.     playerRainBowTimer[MAX_PLAYERS]
  4. ;
  5.  
  6. public OnPlayerConnect(playerid) {
  7.     playerRainbowCar[playerid] = -1;
  8. }
  9.  
  10. forward rainbowCar(playerid); // timer
  11. public rainbowCar(playerid) {
  12.     ChangeVehicleColor(playerRainbowCar[MAX_PLAYERS], random(100), random(100));
  13. }
  14.  
  15. public OnPlayerStateChange(playerid, newstate, oldstate) {
  16.     if(newstate == PLAYER_STATE_DRIVER) {
  17.         if(playerRainbowCar[playerid] == GetPlayerVehicleID(playerid)) {
  18.             playerRainBowTimer[playerid] = SetTimerEx("rainbowCar", 1000, 1, "i", playerid);
  19.         }
  20.     }
  21.  
  22.     if(oldstate == PLAYER_STATE_DRIVER) {
  23.         if(playerRainbowCar[playerid] == GetPlayerVehicleID(playerid)) {
  24.             KillTimer(playerRainBowTimer[playerid]);
  25.         }
  26.     }
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top