Jump to content

itHyperoX

Recommended Posts

Hello guys. I made a script, which is mute player for x minutes. The script is working, but not unmute the player after the timer.

 

Here is the script:

 

addCommandHandler("muteplayer",
function(player, cmd, name, minutes, ...)
if (tonumber(getElementData(player, "account:admin")) >= 2) then
            local message = table.concat({ ... }, " ")
            if name and minutes then
                if tonumber(minutes) then
                    if tonumber(minutes) > 0 then
                        local target = exports.serverExport:findPlayer(name, player)
                        if target then
                                if message and #message > 0 then
                                outputChatBox("#DC143C[Mute]:#7CC576 "..getPlayerName(target).." #ffffff has been muted by #7CC576"..getPlayerName(player).."#ffffff. #7CC576("..minutes.." Minutes)", cRoot, 255, 0, 0, true)
                                outputChatBox("#DC143C[Mute]:#7CC576 Reason:#ffffff "..tostring(message), cRoot, 255, 0, 0, true)
                                setPlayerMuted(target, true)
                                setPlayerMuted(target, true, false, true, player, message, minutes * 60)
                                else
                                outputChatBox("#DC143C[Mute]:#6CB8FD "..getPlayerName(target).."#ffffff has been muted by #6CB8FD"..getPlayerName(player).."#ffffff. #7CC576("..minutes.." Minutes)", cRoot, 255, 0, 0, true)
                                setPlayerMuted(target, true)
                                setPlayerMuted(target, true, false, true, player, nil, minutes * 60)  -- if no reason
                                end
                        else
                            outputChatBox("Player not found.", player, 255, 0, 0, true)
                        end
                    else
                    end
                else
                    outputChatBox("Only numbers", player, 255, 0, 0, true)
                end
            else
                outputChatBox("/" ..cmd .. " [Player] [Minutes] [Reason]", player, 220, 220, 0, true)
            end
            else
            outputChatBox("You dont have permission.", player, 255, 255, 255,true)
        end
    end
)

Whats  the problem? Thanks any help!

Edited by TheMOG
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...