I forgot something
#1

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;
}
Reply
#2

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)