Replacing /q with /quit -
vvhy - 17.04.2013
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?
Re: Replacing /q with /quit -
Luis- - 17.04.2013
You can use /quit anyway..
Re: Replacing /q with /quit - Emmet_ - 17.04.2013
There is no way to replace client commands since they're built into the client and can't be manipulated via Pawn.
Re: Replacing /q with /quit -
vvhy - 17.04.2013
@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!
|
Re: Replacing /q with /quit -
CrystalMethod - 17.04.2013
It
can not be done. Default commands can not be removed/modified.
Re: Replacing /q with /quit -
Scenario - 17.04.2013
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;
}
Re: Replacing /q with /quit -
cessil - 17.04.2013
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
Re: Replacing /q with /quit -
CrystalMethod - 17.04.2013
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:
Re: Replacing /q with /quit -
vvhy - 17.04.2013
@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
Re: Replacing /q with /quit -
Scenario - 18.04.2013
Ah, yeah. Just got with Cessil's idea because I cba. to fix that.