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=659979)
OnPlayerText -
KinderClans - 21.10.2018
I wanna prevent non logged/who's logging players to use the chat, so i did in this way:
pawn Код:
public OnPlayerText(playerid, text[])
{
if(Player[playerid][IsLoggedIn] == false) return ShowPlayerFooter(playerid, "You need to be ~r~logged ~w~to use the chat.", 5000);
if(Player[playerid][IsLoggingIn] == true) return ShowPlayerFooter(playerid, "You need to be ~r~logged ~w~to use the chat.", 5000);
if(IsDead[playerid] == 1) return ShowPlayerFooter(playerid, "You are too tired to talk...", 5000);
if(GetOnlySpacesText(text)) return 0;
SendNearbyMessage(playerid, 20.0, -1, "{%06x}%s: "WHITE"%s", GetPlayerColor(playerid) >>> 8, ReturnName(playerid, 0), text);
return 0;
}
Result is, i get the message "you need to be logged bla bla" but still sends the message in chat.
Re: OnPlayerText -
UFF - 21.10.2018
Use only
Код:
if(Player[playerid][IsLoggedIn] == false) return ShowPlayerFooter(playerid, "You need to be ~r~logged ~w~to use the chat.", 5000);
Re: OnPlayerText -
Calisthenics - 21.10.2018
https://sampwiki.blast.hk/wiki/OnPlayerText
Read about
Return Values.
Re: OnPlayerText -
RogueDrifter - 21.10.2018
That function isn't going to return 0, what you need to do is return whatever it is you wanna do then separate it with a ,0; right after. Like so:
pawn Код:
public OnPlayerText(playerid, text[])
{
if(Player[playerid][IsLoggedIn] == false) return ShowPlayerFooter(playerid, "You need to be ~r~logged ~w~to use the chat.", 5000), 0;
if(Player[playerid][IsLoggingIn] == true) return ShowPlayerFooter(playerid, "You need to be ~r~logged ~w~to use the chat.", 5000), 0;
if(IsDead[playerid] == 1) return ShowPlayerFooter(playerid, "You are too tired to talk...", 5000), 0;
if(GetOnlySpacesText(text)) return 0;
SendNearbyMessage(playerid, 20.0, -1, "{%06x}%s: "WHITE"%s", GetPlayerColor(playerid) >>> 8, ReturnName(playerid, 0), text);
return 0;
}
Re: OnPlayerText -
Jefff - 21.10.2018
or
pawn Код:
return !ShowPlayerFooter(...);
Re: OnPlayerText -
KinderClans - 22.10.2018
Quote:
Originally Posted by Jefff
or
pawn Код:
return !ShowPlayerFooter(...);
|
What's that "!" for?
@RogueDrifter thank you, i'll let you know.