Gang name beside Player 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: Gang name beside Player name :/ (
/showthread.php?tid=623282)
Gang name beside Player name :/ -
Stop - 30.11.2016
Gang name beside playername
As the title says, I want to know how i can put the Gang names that i've chosen beside a players name and to not confuse you, here's an example.
When you look at the player you will see:
[Mafia*] Stop(1)
and when he types in the chat you will see:
[Mafia*] Stop(1): Hello !
Re: Gang name beside Player name :/ -
Abagail - 30.11.2016
If you mean changing the players actual name, and not changing their name internally in your script/in chats, you can use the strins function along with SetPlayerName.
Example of usage:
pawn Код:
new playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
strins(playerName, "[Mafia] ", 0);
SetPlayerName(playerid, playerName);
Similarly, the Mafia tag can then be removed with the strdel function. Example:
pawn Код:
new playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
strdel(playerName, 0, 7);
SetPlayerName(playerid, playerName);
Re: Gang name beside Player name :/ -
GoldenLion - 30.11.2016
You shouldn't do that as the max length of a name is 24 characters so if a player's name is kinda long then it won't just fit.
Re: Gang name beside Player name :/ -
jlalt - 30.11.2016
you can just put the tag on payer name when he chats like below.
PHP код:
public OnPlayerText(playerid, text[])
{
new
pgangtag[] = "Mafia", // ex this var is player tag..
string[128 /* maximum message in chat size */ + 2*8 /* embedded colors size*/],
playernamew[MAX_PLAYER_NAME]
;
GetPlayerName(playerid, playernamew, sizeof playernamew);
format(string, sizeof string,"[%s*] {%06x}%s{FFFFFF}(%d): %s",pgangtag, GetPlayerColor(playerid), playernamew, playerid, text);
SendClientMessageToAll(0xFF0000AA, string);
return 0;
}