How to make an Rainbow System? -
[WSM]Deadly_Evil - 13.02.2010
I want an system like if we write /rainbow the car will flash like rainbow Means it will change colour again and again after 3 seconds This will make a cooller look to the car...
Anybody know how to make this system?
Re: How to make an Rainbow System? -
[HiC]TheKiller - 13.02.2010
https://sampwiki.blast.hk/wiki/Function:ChangeVehicleColor
https://sampwiki.blast.hk/wiki/SetTimerEx
Re: How to make an Rainbow System? -
Miguel - 13.02.2010
pawn Код:
new On[MAX_VEHICLES]; // this is for checking if the vehicle is flashing
pawn Код:
public OnGameModeInit()
{
SetTimer("Rainbow", 3000, true);
return 1;
}
pawn Код:
forward Rainbow();
public Rainbow()
{
for(new i = 0; i < MAX_VEHICLES; i ++)
{
if(On[i] == 1) ChangeVehicleColor(i, random(127), random(127));
}
return 1;
}
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/rainbow", true) == 0)
{
new
vehid = GetPlayerVehicleID(playerid);
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR, "You must be in a vehicle to use this command!");
else if(On[vehid] == 1)
{
SendClientMessage(playerid, COLOR, "Rainbow mod disabled!");
On[vehid] = 0;
}
else
{
SendClientMessage(playerid, COLOR, "Rainbow mod enabled!");
On[vehid] = 1;
}
return 1;
}
return 0;
}
This is one of the many ways you could do this...
Re: How to make an Rainbow System? -
mansonh - 13.02.2010
Yep, that should work.
I was about to write one but you beat me too it.
However, why are you limiting the colours to only 127.
random(127)
There are a lot of other bright colours beyond 127, maybe stop it at 186.
[img width=341 height=768]http://i544.photobucket.com/albums/hh326/mansonh/carcolours.png[/img]
Re: How to make an Rainbow System? -
Miguel - 13.02.2010
I don't know, I just got them quickly from
here, and I read that if you use an invalid color ID it will change after leaving an interior or something... he could change that anyway.
Re: How to make an Rainbow System? -
mansonh - 13.02.2010
Yah I have heard of that before, never seen it though, but if you look on that page below it identifies other colours.
I tested the range and it seems that colour goes from 0-255 then wraps around, so 256=0(binary wrap) ...
and if the colours always changing anyways
/shrug
Re: How to make an Rainbow System? -
[WSM]Deadly_Evil - 13.02.2010
Thanks guys...
Re: How to make an Rainbow System? -
[WSM]Deadly_Evil - 13.02.2010
And how do i make this when an player leaves his vehicle the rainbow mod stop
Re: How to make an Rainbow System? -
mansonh - 13.02.2010
Код:
public OnPlayerDisconnect(playerid)
{
On[GetPlayerVehicleID(playerid)]=0;
}
Re: How to make an Rainbow System? -
[WSM]Deadly_Evil - 13.02.2010
I am learning pawno