09.01.2013, 11:00
This is just a horrible way of doing it, and not to mention that you still gotta add dozens of lines to add more colors.
Here's a quick and simple way of doing it(and can change 127 random colors):
Here's a quick and simple way of doing it(and can change 127 random colors):
pawn Код:
new
bool: gRainbow[MAX_PLAYERS] = {false, ...};
CMD:rainbow(playerid, params[])
{
if(gRainbow[playerid])
{
SendClientMessage(playerid, -1, "You've disabled rainbow colors for your vehicle!");
gRainbow[playerid] = false;
}
else
{
SendClientMessage(playerid, -1, "You've enabled rainbow colors for your vehicle!");
gRainbow[playerid] = true;
}
return 1;
}
// Mode init
SetTimer("UpdateRainbow", 1000, true);
forward UpdateRainbow();
public UpdateRainbow()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i) || !IsPlayerInAnyVehicle(i) || gRainbow[i] == false)
continue;
ChangeVehicleColor(GetPlayerVehicleID(i), random(127), random(127));
}
return 1;
}