Jump to content

how to get mute time?


King12

Recommended Posts

No, since mutes have no expiration by default, you have to use timers to achieve this.

Then you can get the time left by using getTimerDetails.

What about using the admin rights to get the mute's time?

  
addEvent ( "onPlayerMute", false ) 
function aSetPlayerMuted ( player, state, length ) 
    if ( setPlayerMuted ( player, state ) ) then 
        if not state then 
            aRemoveUnmuteTimer( player ) 
        elseif state and length and length > 0 then 
            aAddUnmuteTimer( player, length ) 
        end 
        triggerEvent ( "onPlayerMute", player, state ) 
        return true 
    end 
    return false 
end 
  
local serial = getPlayerSerial( player ) 
    aUnmuteTimerList[serial] = setTimer( 
                                function() 
                                    aUnmuteTimerList[serial] = nil 
                                    for _,player in ipairs(getElementsByType('player')) do 
                                        if getPlayerSerial(player) == serial then 
                                            if isPlayerMuted(player) then 
                                                triggerEvent ( "aPlayer", getElementByIndex("console", 0), player, "mute" ) 
                                            end 
                                        end 
                                    end 
                                end, 
                                length*1000, 1 ) 
end 
  

So that means aUnmuteTimerList[serial] is the timer that sets the duration?

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