14.04.2009, 20:44
i have a race script and i dont know how i can script a highscore.
any ideas?
My race win code:
any ideas?
My race win code:
pawn Code:
public OnPlayerEnterRaceCheckpoint(playerid)
{
...
case finish:
{
new RTime = GetTickCount()-StartTickcount;
new Min, Sec, Mil;
ConvertTime(RTime, Min, Sec, Mil);
if(position == 1)
{
GivePlayerMoney(playerid,10000);
GetPlayerName(playerid, rank_1,sizeof(rank_1));
format(string, sizeof(string), "Winner in %01d:%02d:%02d are %s",Min, Sec, Mil, rank_1);
SendClientMessageToAll(blue, string);
format(string, sizeof(string), "%s, you win: $10000",rank_1);
SendClientMessage(playerid,blue, string);
}
if(position == 2)
{
GivePlayerMoney(playerid,6000);
GetPlayerName(playerid, rank_2,sizeof(rank_2));
format(string, sizeof(string), "2. in %01d:%02d:%02d are: %s ",Min, Sec, Mil, rank_2);
SendClientMessageToAll(blue, string);
format(string, sizeof(string), "%s, you win: $6000",rank_2);
SendClientMessage(playerid,blue, string);
}
if(position == 3)
{
GivePlayerMoney(playerid,2000);
GetPlayerName(playerid, rank_3,sizeof(rank_3));
format(string, sizeof(string), "3. in %01d:%02d:%02d are: %s ",Min, Sec, Mil, rank_3);
SendClientMessageToAll(blue, string);
format(string, sizeof(string), "%s, you win: $2000",rank_3);
SendClientMessage(playerid,blue, string);
}
DisablePlayerRaceCheckpoint(playerid);
race[playerid] = 0;
position++;
racesticket[playerid] = 0;
racecheck[playerid]=0;
SetTimer("RestTime", 30000, 0);
}
}