King12 Posted October 11, 2014 Share Posted October 11, 2014 Hello there, I just want to know if there is any possibility to get the player's mute time. Link to comment
Castillo Posted October 11, 2014 Share Posted October 11, 2014 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. Link to comment
King12 Posted October 11, 2014 Author Share Posted October 11, 2014 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
King12 Posted October 12, 2014 Author Share Posted October 12, 2014 Yes, that's correct. Thanks alot, it's working now! Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now