13.06.2010, 00:08
pawn Код:
//Wherever you want to start the race
SetPlayerRaceCheckpoint(i, 0, 0.0, 0.0, 0.0, 5.0, 5.0, 5.0, 20.0);
SetPVarInt(playerid, "Race", 1);
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
switch(GetPVarInt(playerid, "Race"))
{
case 1:
{
DisablePlayerRaceCheckpoint(playerid);
switch(GetPVarInt(playerid, "Status"))
{ //Sure you could do that with an array as well but I dont like to waste memory
case 0: SetPlayerRaceCheckpoint(playerid, 0, 5.0, 5.0, 5.0, 10.0, 10.0, 10.0, 20.0);
case 1: SetPlayerRaceCheckpoint(playerid, 0, 10.0, 10.0, 10.0, -3.0, -3.0, -3.0, 20.0);
case 2: SetPlayerRaceCheckpoint(playerid, 0, -3.0, -3.0, -3.0, 2.0, 2.0, 2.0, 20.0);
case 3: SetPlayerRaceCheckpoint(playerid, 1, 2.0, 2.0, 2.0, 0.0, 0.0, 0.0, 20.0);
case 4:
{
new string[64];
static Ranks;
GetPlayerName(playerid, string, MAX_PLAYER_NAME);
switch(++Rank)
{
case 1: format(string, sizeof string, "~r~%s ~b~won the race (race1)", string);
case 2: format(string, sizeof string, "~r~%s ~b~is second (race1)", string);
case 3: format(string, sizeof string, "~r~%s ~b~is third (race1)", string);
}
DeletePVar(playerid, "Race");
DeletePVar(playerid, "Status");
SendClientMessageToAll(0xFF0000AA, string);
return GivePlayerMoney(playerid, Rank * 5000);
}
}
return SetPVarInt(playerid, "Status", GetPVarInt(playerid, "Status") + 1);
}
}
}