SA-MP Forums Archive
Show Race Rank List [+REP] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Show Race Rank List [+REP] (/showthread.php?tid=661802)



Show Race Rank List [+REP] - PoniStar - 15.12.2018

Hi guys so i created a race system but i have a problem , i want to show the players ranking [i mean 1st,2st and 3rd] during the race [not after race] with a textdraw , show which player is 1st ! can you give an exp? i want to the textdraw update after a plyer entered the race checkpoint


Re: Show Race Rank List [+REP] - Kraeror - 15.12.2018

I think I have an idea for doing that. You have to create a variable for every checkpoint like:
PHP код:
new places[THE NUMBER OF YOUR CHECKPOINTS]; 
And when the player enters checkpont (OnPlayerEnterCheckpoint) the variable for the checkpoint increases by one!
After that check if the variable equals 0 (noone entered it) than the player is on first place etc.


Re: Show Race Rank List [+REP] - PoniStar - 15.12.2018

yeah i tried something like that , can you help me with changing the places? i mean when another plyr beat the old 1st plyr it will replace with him and his name will be on 1st but how can i put old 1st on 2st? its a little hard for me as a amateur


Re: Show Race Rank List [+REP] - MrHamid - 15.12.2018

new names[30],strings[128],bestid=-1,best=racep[0];
if(bestid == -1) PlayerTextDrawSetString(i, RaceTD, "~w~First:~r~Nobody");
foreach(new x : Player)
{
if(InRace[x] == 1)
{
if(RacePos[x] < best)
{
best = RacePos[x];
bestid = x;
}
}
}
if(bestid != -1)
{
GetPlayerName(bestid, names, sizeof(names));
format(strings, sizeof(strings), "First: ~r~%s", names);
PlayerTextDrawSetString(i, RaceTD, strings);
}