Replacing /q with /quit
#1

I have had a problem in my server with players trolling other players, telling them to do /q and it will give them (insert good thing) I have tried to keep it under control but I thought a better solution would be to replace "/q" with "/quit" so people would not be tricked. So I tried this OnPlayerText:
pawn Код:
set(text,strreplace("/q","/quit",text));
And it doesn't work, any idea why?
Reply
#2

You can use /quit anyway..
Reply
#3

There is no way to replace client commands since they're built into the client and can't be manipulated via Pawn.
Reply
#4

@Luis- Yes, if you do /quit ingame it will make you quit the game.
@Emmet_ I think you misunderstood, I mean just replace it if they say it in the chat, not if they type "/q" without a space or something else before it.

Example:
Quote:

Troll: Hey everyone! type /q for $1,000,000!

To:
Quote:

Troll: Hey everyone! type /quit for $1,000,000!

Reply
#5

It can not be done. Default commands can not be removed/modified.
Reply
#6

This SHOULD work, but it's untested.

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(strfind(text, "/quit") == -1) // if /quit wasn't found...
    {
        if(strfind(text, "/q") != -1) // if /q WAS found...
        {
            new
                pos = strfind(text, "/q"); // get the position of where /q is in the string
               
            strins(text, "uit", pos+2); // add "uit" after /q in the string
        }
    }
    return 1;
}
Reply
#7

a better idea would be to cancel their message sending to other players but still make it visible to them self, if they don't know it does that then they won't try going around it
I did it for getting rid of advertisers
Reply
#8

Quote:
Originally Posted by cessil
Посмотреть сообщение
a better idea would be to cancel their message sending to other players but still make it visible to them self, if they don't know it does that then they won't try going around it
I did it for getting rid of advertisers
That's actually pretty cleaver. ._.
Why have I not thought about this? D:
Reply
#9

@re It doesn't seem to work ingame, also when compiling it I get the warning:
Quote:

warning 224: indeterminate array size in "sizeof" expression (symbol "maxlength")

And that line is

pawn Код:
strins(text, "uit", pos+2);
@cessil Yeah, thats probably a better idea
Reply
#10

Ah, yeah. Just got with Cessil's idea because I cba. to fix that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)