SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 17/04/2013, 11:13 PM   #1
vvhy
Big Clucker
 
Join Date: Mar 2012
Posts: 145
Reputation: 11
Post Replacing /q with /quit

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 Code:
set(text,strreplace("/q","/quit",text));
And it doesn't work, any idea why?
__________________
My work:
__________________________________________________ ______
MAPS

House Interior
Bank Interior
vvhy is offline   Reply With Quote
Old 17/04/2013, 11:13 PM   #2
Luis-
High-roller
 
Luis-'s Avatar
 
Join Date: Jan 2010
Location: England
Posts: 3,934
Reputation: 420
Default Re: Replacing /q with /quit

You can use /quit anyway..
__________________
Luis- is online now   Reply With Quote
Old 17/04/2013, 11:14 PM   #3
Emmet_
Guest
 
Posts: n/a
Default Re: Replacing /q with /quit

There is no way to replace client commands since they're built into the client and can't be manipulated via Pawn.
  Reply With Quote
Old 17/04/2013, 11:19 PM   #4
vvhy
Big Clucker
 
Join Date: Mar 2012
Posts: 145
Reputation: 11
Default Re: Replacing /q with /quit

@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!
__________________
My work:
__________________________________________________ ______
MAPS

House Interior
Bank Interior
vvhy is offline   Reply With Quote
Old 17/04/2013, 11:23 PM   #5
CrystalMethod
Big Clucker
 
CrystalMethod's Avatar
 
Join Date: Dec 2011
Location: Michigan
Posts: 119
Reputation: 26
Default Re: Replacing /q with /quit

It can not be done. Default commands can not be removed/modified.
__________________

WEBSITE | FORUMS | YOUTUBE | DISCORD
Address: play.thepilotslife.com:7777
Version: 0.3.7-R2

CrystalMethod is offline   Reply With Quote
Old 17/04/2013, 11:25 PM   #6
Scenario
Godfather
 
Scenario's Avatar
 
Join Date: Feb 2010
Location: Heaven
Posts: 7,801
Reputation: 701
Default Re: Replacing /q with /quit

This SHOULD work, but it's untested.

pawn Code:
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;
}
Scenario is offline   Reply With Quote
Old 17/04/2013, 11:32 PM   #7
cessil
High-roller
 
cessil's Avatar
 
Join Date: Apr 2009
Posts: 1,356
Reputation: 310
Default Re: Replacing /q with /quit

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
cessil is offline   Reply With Quote
Old 17/04/2013, 11:38 PM   #8
CrystalMethod
Big Clucker
 
CrystalMethod's Avatar
 
Join Date: Dec 2011
Location: Michigan
Posts: 119
Reputation: 26
Default Re: Replacing /q with /quit

Quote:
Originally Posted by cessil View Post
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:
__________________

WEBSITE | FORUMS | YOUTUBE | DISCORD
Address: play.thepilotslife.com:7777
Version: 0.3.7-R2

CrystalMethod is offline   Reply With Quote
Old 17/04/2013, 11:39 PM   #9
vvhy
Big Clucker
 
Join Date: Mar 2012
Posts: 145
Reputation: 11
Default Re: Replacing /q with /quit

@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 Code:
strins(text, "uit", pos+2);
@cessil Yeah, thats probably a better idea
__________________
My work:
__________________________________________________ ______
MAPS

House Interior
Bank Interior
vvhy is offline   Reply With Quote
Old 18/04/2013, 12:23 AM   #10
Scenario
Godfather
 
Scenario's Avatar
 
Join Date: Feb 2010
Location: Heaven
Posts: 7,801
Reputation: 701
Default Re: Replacing /q with /quit

Ah, yeah. Just got with Cessil's idea because I cba. to fix that.
Scenario is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help me with replacing old strings Geeboi_Mehdi Scripting Help 5 05/04/2013 03:53 AM
Replacing with ae Doktor Scripting Help 2 22/12/2011 06:42 PM
Replacing substrings MP2 Scripting Help 12 25/08/2011 03:09 AM
Need Help with symbol replacing Haji Help Archive 1 08/02/2011 06:25 PM
Replacing file - Need help Holnista Help Archive 1 21/07/2010 07:22 PM


All times are GMT. The time now is 12:59 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.