04.08.2012, 09:01
(
Последний раз редактировалось GTXcube; 08.01.2014 в 19:36.
)
....
new FP,FPName[MAX_PLAYER_NAME],FPTime;
new SP,SPName[MAX_PLAYER_NAME],SPTime;
new TP,TPName[MAX_PLAYER_NAME],TPTime;
new RaceStart;
CMD:StartRace(playerid,params[])
{
if(RaceStart < 0)
{
RaceStart = GetTickCount();
SendClientMessageToAll(COLOR_RED, "The race has started!");
}
else
{
RaceStart = -1;
FP = 0;
SP = 0;
TP = 0;
FPTime = 0;
SPTime = 0;
TPTime = 0;
}
return RaceStart;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
if(FP == 0)
{
new string[126];
FP = 1;
FPTime = GetTickCount() - RaceStart;
GetPlayerName(playerid, FPName, sizeof(FPName));
format(string, sizeof(string), "%s has come in first place, with the time of %i", FPName,FPTime);
SendClientMessageToAll(COLOR_GREEN, string);
}
else if(SP == 0)
{
new string[126];
SP = 1;
SPTime = GetTickCount() - RaceStart;
GetPlayerName(playerid, SPName, sizeof(SPName));
format(string, sizeof(string), "%s has come in second place, with the time of %i", SPName,SPTime);
SendClientMessageToAll(COLOR_GREEN, string);
}
else if(TP == 0)
{
new string[126];
TP = 1;
TPTime = GetTickCount() - RaceStart;
GetPlayerName(playerid, TPName, sizeof(TPName));
format(string, sizeof(string), "%s has come in third place, with the time of %i", TPName,TPTime);
SendClientMessageToAll(COLOR_GREEN, string);
}
else if(FP > 0 && SP > 0 && TP > 0)
{
new string[126], Name[MAX_PLAYER_NAME], Time;
GetPlayerName(playerid, Name, sizeof(Name));
Time = GetTickCount() - RaceStart;
format(string, sizeof(string), "%s has finished the race with the time of %i", Name, Time);
SendClientMessageToAll(COLOR_GREEN, string);
}
return 1;
}
SetPlayerRaceCheckpoint(playerid, type, Float:x, Float:y, Float:z, Float:nextx, Float:nexty, Float:nextz, Float:size)
SetPlayerRaceCheckpoint(playerid, 1, ...);
SetPlayerRaceCheckpoint(playerid, 3, etc...)