changecolor timer
#3

PHP код:
new hasplayerrainbow[MAX_PLAYERS] = false;
CMD:rainbow(playeridparams[])
{
    if(
hasplayerrainbow[playerid]) return SendClientMessage(playerid, -1"You already have rainbow");
    if(
GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
    {
        
SendClientMessage(playerid, -1"[ERROR]: You need to be a driver in a vehicle to use that command.");
    }
    else
    {
        new 
vehicleid GetPlayerVehicleID(playerid);
        
ChangeVehicleColor(vehicleid,-1,-1);
        
SetTimerEx("RainBow"2000true"i"playerid);
    }
    return 
1;
}
forward RainBow(playerid);
public 
RainBow(playerid)
{
    if(!
hasplayerrainbow[playerid]) 
    {
        
KillTimer(RainBow(playerid));
    }
    if(
GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        
hasplayerrainbow[playerid] = true;
        new 
vehicleid GetPlayerVehicleID(playerid);
        
ChangeVehicleColor(vehicleid,-1,-1);
        
SetTimerEx("RainBow"2000true"i"playerid);
    }
    return 
1;
}
CMD:killrainbow(playeridparams[])
{
    if (
hasplayerrainbow[playerid])
    {
        
hasplayerrainbow[playerid] = false;
        
KillTimer(RainBow(playerid));
        
SendClientMessage(playerid, -1"rainbow deactivated");
    }
    else
    {
        
SendClientMessage(playerid, -1"you don't have rainbow activated");
    }

Reply


Messages In This Thread
changecolor timer - by rakinz - 23.02.2018, 08:16
Re: changecolor timer - by RogueDrifter - 23.02.2018, 08:18
Re: changecolor timer - by rfr - 23.02.2018, 08:22
Re: changecolor timer - by rakinz - 23.02.2018, 08:28
Re: changecolor timer - by rfr - 23.02.2018, 08:30
Re: changecolor timer - by PepsiCola23 - 23.02.2018, 08:33
Re: changecolor timer - by rakinz - 23.02.2018, 08:39
Re: changecolor timer - by RogueDrifter - 23.02.2018, 08:44
Re: changecolor timer - by rfr - 23.02.2018, 08:48
Re: changecolor timer - by RogueDrifter - 23.02.2018, 08:49

Forum Jump:


Users browsing this thread: 1 Guest(s)