Advertisement
Gireada

CCS(Change Color per Second)

Apr 21st, 2014
354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.46 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3.  
  4. new cc[MAX_PLAYERS], colorchange[MAX_VEHICLES];
  5.  
  6. forward ChangeColorSec(vehicleid);
  7.  
  8. public OnFilterScriptInit( )
  9. {
  10.     print( "\n[FS] **********************************" );
  11.     print( "[FS] * Vehicle Color Changer by Gireada *" );
  12.     print( "[FS] * Loaded ...            *" );
  13.     print( "[FS] ************************************\n" );
  14. }
  15.  
  16. public OnFilterScriptExit( )
  17. {
  18.     print( "\n[FS] **********************************" );
  19.     print( "[FS] * Vehicle Color Changer by Gireada *" );
  20.     print( "[FS] * Unloaded ...          *" );
  21.     print( "[FS] ************************************\n" );
  22. }
  23.  
  24. public OnPlayerConnect(playerid)
  25. {
  26.     cc[playerid] = 0;
  27.     return 1;
  28. }
  29.    
  30. CMD:ccs(playerid, params[])
  31. {  
  32.     new vehicleid = GetPlayerVehicleID(playerid);
  33.     if(!(IsPlayerInAnyVehicle(playerid))) return SendClientMessage(playerid, -1, "Trebuie sa fii intr-un vehicul pentru a folosi comanda");
  34.     switch(cc[playerid])
  35.     {
  36.         case 0:
  37.         {
  38.             cc[playerid] = 1;
  39.             SendClientMessage(playerid, -1, "Ai activat culoarea la secunda");
  40.             colorchange[vehicleid] = SetTimerEx("ChangeColorSec", 1000, 1, "d", vehicleid);
  41.         }  
  42.         case 1:
  43.         {
  44.             cc[playerid] = 0;
  45.             SendClientMessage(playerid, -1, "Ai dezactivat culoarea la secunda");
  46.             KillTimer(colorchange[vehicleid]);
  47.         }  
  48.     }
  49.     return 1;
  50. }
  51.  
  52. public ChangeColorSec(vehicleid)
  53. {
  54.     new culoare1 = random(255);
  55.     new culoare2 = random(255);
  56.     ChangeVehicleColor(vehicleid, culoare1, culoare2);
  57.     return 1;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement