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=438076)
Onplayertext -
Tanush123 - 18.05.2013
I'm trying to make it shows the playerid in front of their name
pawn Код:
public OnPlayerText(playerid, text[])
{
GetPlayerName(playerid,Nam,sizeof(Nam));
if(PlayerData[playerid][Member] == -255)
{
format(query,sizeof(query),"%s[%d]: %s",Nam,playerid,text);
SendClientMessageToAll(-1,query);
}
if(PlayerData[playerid][Member] > 0)
{
format(query,sizeof(query),"%s[%d]:{FFFFFF} %s",Nam,playerid,text);
SendClientMessageToAll(HexToInt(OrgInfo[PlayerData[playerid][Member]][Color]),query);
}
it sends the message 2 times
"%s[%d]: %s"
"%s: %s"
Re: Onplayertext -
NL-Sultan - 18.05.2013
You should use 'else' if I'm right, and not twice 'if' on the way how you've done it.
Re: Onplayertext -
Tanush123 - 18.05.2013
but at the same time there cant be someone with -255 and over 0
Re: Onplayertext -
Chenko - 18.05.2013
Return 0 at the end of OnPlayerText
Re: Onplayertext -
Revo - 18.05.2013
return 0 at the end so it never sends the original message. Or return 0 whenever your if has sent what it needs to send.
Re: Onplayertext -
George_Fratelli - 18.05.2013
pawn Код:
public OnPlayerText(playerid, text[])
{
new string[128];
GetPlayerName(playerid, pName, sizeof(pName));
if(PlayerData[playerid][Member] == -255)
{
format(string, sizeof(string), "[%d]%s:%s",playerid, pName, text);
SCMTA(COLOR_WHITE, string);
return 0;
}
else if(PlayerData[playerid][Member] > 0)
{
format(query,sizeof(query),"%s[%d]:{FFFFFF} %s",Nam,playerid,text);
SCMTA(HexToInt(OrgInfo[PlayerData[playerid][Member]][Color]),query);
return 0;
}
return 0;
}
Might work, Not sure though.
Re: Onplayertext -
Tanush123 - 18.05.2013
thanks