I forgot something - 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: I forgot something (
/showthread.php?tid=250963)
I forgot something -
Cjgogo - 25.04.2011
I know that on a dialog or on game text,if you want to enter a number u use strval but if I want to enter a text what do I use and I suposse this is worng:
pawn Код:
public OnPlayerText ()
{
if(strcmp(text) == fuck admin)
{
Ban(playerid);
}
return 1;
}
Re: I forgot something -
Calgon - 25.04.2011
You've missed quite a lot here.
1) You've not included the appropriate variables for the OnPlayerText callback:
playerid and
text
2) strcmp requires the 2 parameters be enclosed in the function in the if statement, and you need to use quotation marks to contain the message
3) strcmp isn't a wise choice for this, I suggest usage of
strfind instead.
Here's the working code:
pawn Код:
public OnPlayerText(playerid, text[]) {
if(strfind(text, "fuck admin", true) != -1) {
Ban(playerid);
}
return 1;
}