SA-MP Forums Archive
Problem with 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with OnPlayerText (/showthread.php?tid=128922)



Problem with OnPlayerText - leapfish - 20.02.2010

Code I use
pawn Код:
public OnPlayerText(playerid, text[])
{
    new name[256],string[256];
    GetPlayerName(playerid,name,255);
    format(string,255,"%s(%d):%s",name,playerid,text);
    SendClientMessageToAll(GetPlayerColor(playerid),string);
    return 0;
}
Well I want to make it so whenever player writes something, it makes PlayerName(id): text, and this code works... It gives whole messsage with player team color...
But I want it to make PlayerName with team color, and text with white color...

I tried using SendPlayerMessageToAll, and deleting name from the format string, it actually works.. except it gives outcome PlayerNameid): text (is there way I can remove

Anyone can help please?


Re: Problem with OnPlayerText - ¤Adas¤ - 20.02.2010

pawn Код:
SendPlayerMessageToAll(playerid, string);



Re: Problem with OnPlayerText - leapfish - 20.02.2010

I said I tried that, but it gives outcome with PlayerNameid): text , is there way of removing : after Playername and before (id)


Re: Problem with OnPlayerText - RyDeR` - 20.02.2010

Код:
public OnPlayerText(playerid, text[])
{
	new string[128];
	format(string, sizeof(string), "[%d]: %s", playerid, text[0]);
	SendPlayerMessageToAll(playerid, string);
	return 0;
}



Re: Problem with OnPlayerText - leapfish - 20.02.2010

Now it will give PlayerName:[id]: text....
There is still :