SA-MP Forums Archive
OnPlayerText - 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: OnPlayerText (/showthread.php?tid=477141)



OnPlayerText - Blackazur - 22.11.2013

Hello, i wanna that it look like this: Playername (5): text
But this dont work here it writes it like this: Playername: (5) text
Who can help?

Код:
format(stringbig,sizeof(stringbig),"(%d) %s", playerid, text);
                SendPlayerMessageToAll(playerid,stringbig);



Re: OnPlayerText - RajatPawar - 22.11.2013

pawn Код:
public OnPlayerText( playerid, text[] )
{
     new string[ 128 ], player_name[MAX_PLAYER_NAME];
     GetPlayerName(playerid, player_name, MAX_PLAYER_NAME);
     format(string, sizeof string, "%s (%d): %s", player_name, playerid, text);
     return SendClientMessageToAll( GetPlayerColor( playerid ), string );
}
This should work. You can change the "%s (%d): %s" to whatever you feel like! Also, change GetPlayerColor( playerid ) to -1 if you want the message to always be sent in white. Cheers!


Re: OnPlayerText - Konstantinos - 22.11.2013

Player Message (not client) starts with: "PlayerNameHere: " and it gets the color of the player. The rest are white.

So use client message instead.

pawn Код:
new
    sz_Name[ MAX_PLAYER_NAME ]
;
GetPlayerName( playerid, sz_Name, MAX_PLAYER_NAME );
format( stringbig, sizeof( stringbig ), "%s {FFFFFF}(%d): %s", sz_Name, playerid, text);
SendClientMessageToAll( GetPlayerColor( playerid ), stringbig );