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=468954)
OnPlayerText -
Lajko1 - 11.10.2013
Hey guys I'm finishing with my /mask command but I have one problem, I want when masked player will speak it will write like this:
Stranger: text..
I've tried this
pawn Код:
public OnPlayerText(playerid, text[])
{
if(Masked[playerid] == 1)
{
new str[128];
format(str, sizeof(str), "Stranger says: %s", text);
SendClientMessage(playerid, COLOR_YELLOW,str);
}
return 1;
}
It's true it says Stranger: text.. but above this msg it shows my real IG name and message, I don't want to use GetPlayerName and SetPlayerName so people will just simply press TAB and see who's name changed... how can I do so it will write only "Stranger: text"?
Re: OnPlayerText -
Konstantinos - 11.10.2013
pawn Код:
public OnPlayerText(playerid, text[])
{
if(Masked[playerid] == 1)
{
new str[128];
format(str, sizeof(str), "Stranger says: %s", text);
SendClientMessage(playerid, COLOR_YELLOW,str);
}
/*
else
{
// code for normal chat (name etc) if you want
}
*/
return 0; // <-- returning 0 to prevent the default chat to be shown.
}
Re: OnPlayerText -
jessejanssen - 11.10.2013
pawn Код:
public OnPlayerText(playerid, text[])
{
if(Masked[playerid] == 1)
{
new str[128];
format(str, sizeof(str), "Stranger says: %s", text);
SendClientMessage(playerid, COLOR_YELLOW,str);
return 0;
}
return 1;
}
That will do what you want, the "return 1" in OnPlayerText sends the message, using "return 0" will just stop the code without sending the message. I hope you understand how it works now.
Best regards,
Jesse
Re: OnPlayerText -
Lajko1 - 11.10.2013
Thanks to both of you guys

It's working perfect and you just helped me to finish my /mask command