SA-MP Forums Archive
Help +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: Help +rep (/showthread.php?tid=538420)



Help +rep - MasonSFW - 21.09.2014

Hello i finding long time for some script :-/ , But i can't found anyone can help me?

I need when player say some players ID to be name. Example

Hello id4 = Hello PlayerName
Hello id29 = Hello Vin
Like that...

If you help me thank alot +1 rep


Re: Help +rep - Stinged - 21.09.2014

Check if the player entered "id"
And then check if what's next to id is a number.
pawn Код:
if (0 < [..] < MAX_PLAYERS))
And then replace them with the player's name.

(I've seen this feature on some server)


Re: Help +rep - IceCube! - 21.09.2014

I'll make this much simpler for you in the future... Although you could have looked on Wiki.

pawn Код:
stock GetName(playerid)
{
    new Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
    return Name;
}
This means you can now directly format a name into a string using GetName(playerid);

Example:

pawn Код:
new string[6 + MAX_PLAYER_NAME];
format(string, sizeof(string), "Hello %s", GetName(playerid));
SendClientMessageToAll(-1, string);