29.09.2012, 12:47
pawn Код:
#include <a_samp>
new Timer1;
new Timer2;
new Timer3;
new Timer4;
new Timer5;
new Timer6;
new IsRainbow[MAX_PLAYERS];
forward Color1(playerid);
forward Color2(playerid);
forward Color3(playerid);
forward Color4(playerid);
forward Color5(playerid);
forward Color6(playerid);
forward Color7(playerid);
if(strcmp(cmdtext, "/rainbow", true)
{
if(!IsPlayerInAnyVehicle(playerid))
{
KillTimer(Timer2);
KillTimer(Timer3);
KillTimer(Timer4);
KillTimer(Timer5);
KillTimer(Timer6);
Timer1 = SetTimerEx("Color1",500,0,"d",playerid);
SendClientMessage(playerid,-1,"Rainbow car started! Use /rainbowoff to stop!");
IsRainbow[playerid] = 1;
return 1;
}
if(strcmp(cmdtext, "/rainbowoff", true)
{
KillTimer(Timer1);
KillTimer(Timer2);
KillTimer(Timer3);
KillTimer(Timer4);
KillTimer(Timer5);
KillTimer(Timer6);
SendClientMessage(playerid,-1,"You stopped the rainbow car!");
return 1;
}
public Color1(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
KillTimer(Timer1);
ChangeVehicleColor(vehicleid,0,0);
Timer2 = SetTimerEx("Color2",500,0,"d",playerid);
}
public Color2(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
KillTimer(Timer2);
ChangeVehicleColor(vehicleid,1,1);
Timer3 = SetTimerEx("Color3",500,0,"d",playerid);
}
public Color3(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
KillTimer(Timer3);
ChangeVehicleColor(vehicleid,2,2);
Timer4 = SetTimerEx("Color4",500,0,"d",playerid);
}
public Color4(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
KillTimer(Timer4);
ChangeVehicleColor(vehicleid,3,3);
Timer5 = SetTimerEx("Color5",500,0,"d",playerid);
}
public Color5(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
KillTimer(Timer5);
ChangeVehicleColor(vehicleid,4,4);
Timer6 = SetTimerEx("Color6",500,0,"d",playerid);
}
public Color6(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
KillTimer(Timer6);
ChangeVehicleColor(vehicleid,5,5);
SetTimerEx("Color1",500,0,"d",playerid);
}