Jump to content

[Help] Removing MTA command like /me


VParker

Recommended Posts

So,i want to remove the command /me from my server,but the scripts i've seen on the internet,and the one i done myself didn't work,so i'm asking for your help.

This is the script that is not working: 

addEventHandler ( "onPlayerChat", root,
function(cmd)
    if cmd = "me" then 
        cancelEvent () 
    end 
end)

What did i do wrong? There is a pink /me command in the vanilla MTA server,that's what i am looking forward to disable for roleplay. (I want to make my own /me command)

Edited by VParker
Link to comment

Not really helpful if i dont even know what lines should i delete. Instead of wasting my and your time,just maybe,tell which lines to delete? or where to add text to my script. I am not an experienced scripter,sorry.

Edited by VParker
why not.
Link to comment

Well this is the best way to learn unless you want to keep asking others for help when you can help yourself.

Its all about thinking logically about how you want the script to run and a bit of trial and error which will help you understand way more.

Your code above is a good start but onPlayerChat has 2 Parameters:

string message, int messageType

you would need to change cmd because it is in the position of the message parameter and add the message type after it

function( message, messageType )

You can now use the messageType to determine if the message was a:

  • 0: normal message
  • 1: action message (/me)
  • 2: team message

Since you want to disable "1" which is /me aka action message you will need to check for it

if messageType == 1 then

now that it's an action message you want to cancel it using cancelEvent

cancelEvent()

 

and that's basically it, pretty simple right?

Edited by loki2143
Link to comment

Well,you are right about the learning part,but its easier to learn from someone then learn from yourself. ^^"

But,it's still not working,maybe i misunderstood you. welp. I'll provide the edited script,because maybe im just stupid. :|

addEventHandler ( "onPlayerChat", root,
function( message,messageType )
    if messageType == 1 then 
        cancelEvent() 
    end 
end)

Edited by VParker
Link to comment

Well. I have freaking tried everything. I have added the script of SARSRPG after removing the restriction in ACL. No luck,didnt work. But if i disabled it in ACL i couldn't use my own /me command. So we are kinda back at the beginning. And yes,i cant use anything else for /me,because that not how everybody's used to it. Maybe i should try reinstalling my server? Because now im all out of ideas.

23 minutes ago, loki2143 said:

Yes you would, but only if you set the restricted argument to false.

 

24 minutes ago, SARSRPG said:

function disableCommand(command)
if command == "me" then
cancelEvent()
end
end
addEventHandler("onPlayerCommand", root, disableCommand)


This should definitely work.

 

Edited by VParker
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...