Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- forward color(playerid);
- new CarColorChanger[MAX_PLAYERS];
- new ctimer[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- print("Random Car Colors made by Phyzic Loaded");
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/carcolor", cmdtext, true, 10) == 0)
- {
- if(IsPlayerInAnyVehicle(playerid))
- {
- ctimer[playerid] = SetTimer("color", 1000, true);
- CarColorChanger[playerid]=1;
- }
- else SendClientMessage(playerid, -1, "Error! You need to be in a vehicle to use this command");
- return 1;
- }
- if (strcmp("/carcoloroff", cmdtext, true, 10) == 0)
- {
- if(CarColorChanger[playerid] == 1)
- {
- KillTimer( ctimer[playerid] );
- CarColorChanger[playerid]=0;
- }
- else SendClientMessage(playerid, -1, "Error! Car Color is already off..");
- return 1;
- }
- return 0;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(CarColorChanger[playerid] == 1)
- {
- KillTimer(ctimer[playerid]);
- CarColorChanger[playerid] = 0;
- }
- return 1;
- }
- public color(playerid)
- {
- new vehicle;
- vehicle = GetPlayerVehicleID(playerid);
- if(!IsPlayerInAnyVehicle(playerid))return KillTimer(ctimer[playerid]);
- new r = random(71);
- ChangeVehicleColor(vehicle, r, r);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement