Lets start with your SetCarDiscOn definition. It starts a timer but only passes one argument to it but on PCarDisco you add a second parameter. It also doesn't store the timer ID anywhere which means you can never stop it and it is a repeating timer!
Why do you want to use a define? A function would make a lot more sense for it:
pawn Код:
new DiscoTimer[ MAX_VEHICLES ], bool:Disco[ MAX_VEHICLES ]; // a global variable.
TurnCarDiscOn(playerid, vehicleid, message[])
{
SendClientMessage(playerid, green, message);
Disco[ vehicleid ] = true;
DiscoTimer[ vehicleid ] = SetTimerEx("PCarDisco", 200, 1, "i", vehicleid);
}
TurnCarDiscOff(playerid, vehicleid, message[])
{
SendClientMessage(playerid, green, message);
Disco[ vehicleid ] = false;
KillTimer(DiscoTimer[ vehicleid ]);
}
forward PCarDisco(vehicleid);
public PCarDisco(vehicleid)
{
if(Disco[ vehicleid ] == true)
{
// change the colour.
}
}
I also changed the Disco array. I used vehicleid for its index... Its still not quite right. The TurnCarDiscOn/Off shouldn't even need a playerid argument...