Jump to content

executeCommandHandler won't work properly on /mute [args..]


Recommended Posts

On our servers, we have a customized admin resource which has a mute system by entering the following arguments:

/mute [playerName] [ Period "1d" "30m" "500"] [Reason]

I searched everywhere in admin resource, but there were no straight forward function so i couldn't figure out how to export it.

After many attempts, i created this function:

function MuteSelectedSerial(serial, seconds, reason) 
    local name = getPlayerName(getPlayerFromSerial(serial)):gsub('#%x%x%x%x%x%x', '') 
    executeCommandHandler("mute",source , name, seconds, reason) 
end 
addEvent("onSerialMute", true) 
addEventHandler("onSerialMute", root, MuteSelectedSerial) 
  

but it will only mute the player for no specific amount or reason "its working as i'm doing /mute [playerName] only"

However, i made sure that 'seconds' and 'reason' are correctly sent through the executeCommandHandler, tried tostring(seconds) tonumber(seconds) still won't work.

Any ideas?

Link to comment

After a lot of hours! i just found out :D !!!

it receives only one string and divides its spaces!

function MuteSelectedSerial(serial, seconds, reason) 
    local name = getPlayerName(getPlayerFromSerial(serial)):gsub('#%x%x%x%x%x%x', '') 
    executeCommandHandler("mute",source [b], name.." "..seconds.." "reason[/b]) 
end 
addEvent("onSerialMute", true) 
addEventHandler("onSerialMute", root, MuteSelectedSerial) 
  

MTA forum is an inspiration <3

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...