SA-MP Forums Archive
Getting players name - 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: Getting players name (/showthread.php?tid=310759)



Getting players name - Luis- - 13.01.2012

How can I get a players name with the least damage on his vehicle?

pawn Код:
forward DerbyGo();
public DerbyGo()
{
    new string[100];
    format(string, sizeof(string), "DERBY: The destruction derby has started with %d players.", DerbyPlayers);
    SendClientMessageToAll(COLOR_WHITE, string);
    foreach(Player, i)
    {
        format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~n~~n~~r~Leader: ~w~%s", Name(i));
        GameTextForPlayer(i, string, 20534053546534, 3);
    }
    return 1;
}



Re: Getting players name - CmZxC - 13.01.2012

I think that you should use foreach for each player, and check who has the most HP on their car, then get their name and use it in that string.
Btw i think you must make the gametextforplayer like 5 seconds long, beacuse i doubt that they update, they just stay the same i believe.


Re: Getting players name - MP2 - 13.01.2012

Use a loop and two variables. One variable containing the highest health, and one containing the 'winner'. How will you handle two players having the same health though?


Re: Getting players name - Luis- - 13.01.2012

I am guessing i'll have to let them both win.