Advertisement
L0K3D_Hokage

Rainbow car

Jan 22nd, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.72 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement