HELP 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: HELP OnPlayerText (
/showthread.php?tid=278974)
HELP OnPlayerText -
[M.A]Angel[M.A] - 24.08.2011
Hello ,
I got problem that i can't make the player id before his name I just make it like that:
Code:
public OnPlayerText(playerid,text[])
{
new str[128];
format(str, sizeof(str), "[ID:%i]: %s", playerid, text);
SendPlayerMessageToAll(playerid, str);
return 0;
}
So its like that:
Example: [ID: 0]: Test
I want to make it
[ID:0] Example: Test
But i failed any idea?
__________________
MY SERVER:
Re: HELP OnPlayerText -
Kingunit - 24.08.2011
It failed? You are getting errors? What is the problem?
Re: HELP OnPlayerText -
Fj0rtizFredde - 24.08.2011
You need to get the player name too.
pawn Code:
public OnPlayerText(playerid,text[])
{
new str[128], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(str, sizeof(str), "[ID:%i] %s: %s", playerid, pName, text);
SendPlayerMessageToAll(playerid,str);
return 0;
}
Re: HELP OnPlayerText -
iGetty - 24.08.2011
nvm.
Re: HELP OnPlayerText -
[M.A]Angel[M.A] - 24.08.2011
Quote:
Originally Posted by Fj0rtizFredde
You need to get the player name too.
pawn Code:
public OnPlayerText(playerid,text[]) { new str[128], pName[MAX_PLAYER_NAME]; GetPlayerName(playerid, pName, sizeof(pName)); format(str, sizeof(str), "[ID:%i] %s: %s", playerid, pName, text); SendPlayerMessageToAll(playerid,str); return 0; }
|
Also fail Look what it says when i type:
Example:
[ID:0] Example:
Text
Re: HELP OnPlayerText -
Fj0rtizFredde - 24.08.2011
Try to change:
SendPlayerMessageToAll(playerid,str);
To:
pawn Code:
SendClientMessageToAll(str);
Re: HELP OnPlayerText -
[M.A]Angel[M.A] - 24.08.2011
Quote:
Originally Posted by Fj0rtizFredde
Try to change:
SendPlayerMessageToAll(playerid,str);
To:
pawn Code:
SendClientMessageToAll(str);
|
Code:
error 035: argument type mismatch (argument 1)
Re: HELP OnPlayerText -
[M.A]Angel[M.A] - 24.08.2011
I think they are more that 1 OnPlayerText?
_________________
Re: HELP OnPlayerText -
Fj0rtizFredde - 24.08.2011
Oh Im stupid.. I forgot the color parameter. It should look like:
pawn Code:
SendClientMessageToAll(-1,str); //-1 = White you could change it if you want to.
Re: HELP OnPlayerText -
[M.A]Angel[M.A] - 24.08.2011
Awesome its
[ID:0] Example: Text
But they are problem :S its only color white and was before more than color so when player join its give them more than color now its just give white ?
Re: HELP OnPlayerText -
Kingunit - 24.08.2011
You can add color for example define:
pawn Code:
#define COL_GREEN "{6EF83C}"
#define COL_WHITE "{FFFFFF}"
Then you can use them like this:
pawn Code:
"#COL_GREEN" Green "#COL_WHITE" White
Re: HELP OnPlayerText -
[M.A]Angel[M.A] - 24.08.2011
I know but i want auto colors so not all players have the same color.