Jump to content

fade time mute


Recommended Posts

Hello friends,

Because the mute time does not fade ? ? 

If I give 1 minute mute, the time stays at 60000..

1 minute = 60000 Milliseconds

--Client---
local muteTime = 0
local timerMute = nil
local mute = false
function drawMuteTime( )
    local screenW, screenH = guiGetScreenSize()
    if muteTime > 0 and mute == true then -----------162 LINE--------
        dxDrawText("Muted time: "..muteTime, screenW * 0.0078, screenH * 0.6094, screenW * 0.2727, screenH * 0.6484, tocolor(255, 0, 0, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
    end
end
addEventHandler( "onClientRender", root, drawMuteTime )
addEvent( "mute:mutePlayer" )
addEventHandler( "mute:mutePlayer", getRootElement( ),
    function( time )
        mute = true
		if timerMute then timerMute = nil end
        timerMute = setTimer( function( )
            muteTime = 0
            mute = false
        end, time, 1)
        muteTime = math.floor(getTimerDetails( timerMute ))
    end
)
addEvent( "mute:unMutePlayer" )
addEventHandler( "mute:unMutePlayer", getRootElement( ),
    function( )
        muteTime = 0
        mute = false
    end
)
---------------
----Server 
function mute (player, time, rz)
local times = getRealTime ()
local day = times.monthday
local mes = times.month 
local yea = times.year
local sec = times.second
local min = times.minute
local hou = times.hour
local el = getPlayerFromName (player)
local ad = getPlayerName (source)
if el and rz then
if time and tonumber(time) ~= nil then
if getElementData(el, "Lv") <= getElementData(source, "Lv") then
if not isPlayerMuted (el) then
setPlayerMuted (el, true)
local respeto = getPedStat (el, 64)
setPedStat (el, 64, respeto-15)
if not isGuestAccount (getPlayerAccount(el)) then
executeSQLQuery("INSERT INTO Punish (Date, Element, Admin, Time, Reason) VALUES ('["..hou..":"..min..":"..sec.."("..day.."/"..(mes+1).."/"..yea..")]', '"..getAccountName(getPlayerAccount(el)).."', '"..ad.."', '"..time.." Min', '[Mute]"..rz.."')")
end
outputChatBox (ad.." Muted to "..player.." "..tonumber(time).." Min by: ("..rz..").", root, 255, 0, 0)
setElementData (el, "NGtimeMute", time)
setElementData(el,"NGGangMute",true)
outputDebugString (ad.." Muted to "..player.." "..tonumber(time).." Min by: ("..rz..").")  
setTimer (desmutar, time*60*1000, 1, el)
triggerClientEvent( el, "mute:mutePlayer", el, time*60*1000 )
else
setPlayerMuted (el, false)
setElementData(el,"NGGangMute",false)
outputChatBox (ad.." Break to "..player, root, 255, 0, 0)
outputDebugString (ad.." Break to "..player)  
setElementData (source, "NGTimeMute", 0)
end
else
--outputChatBox (".", source, 255, 0, 0)
end
end
else".", source, 255, 0,0)
end
end
addEvent ("mute", true)
addEventHandler ("mute", root, mute)
function desmutar (player)
if player and isElement(player) then
if isPlayerMuted(player) then
setPlayerMuted (player, false)
setElementData (player, "NGTiempoMute", 0)
triggerClientEvent( player, "mute:unMutePlayer", player )
outputChatBox (getPlayerName(player).."(FinISH del Mute)", root, 0, 255, 0)
outputDebugString (getPlayerName(player).."  It was desmutado (Finish Mute)")   
end 
end
end
-------------------------------------------------------------------------------- Mute Evade Fix
addEventHandler ("onPlayerQuit", root,
function ()
if not isGuestAccount(getPlayerAccount(source)) then
if isPlayerMuted (source) then	
setAccountData (getPlayerAccount(source), "NGMuteEvade", getElementData(source, "NGtimeMute"))
else
setAccountData (getPlayerAccount(source), "NGMuteEvade", 0)
end
end
end)
addEventHandler ("onPlayerLogin", root,
function ()
local ismute = getAccountData (getPlayerAccount(source), "NGMuteEvade")
if ismute then
if tonumber(ismute) >= 1 then
setPlayerMuted(source, true)
setElementData (source, "NGtimeMute", ismute)
setTimer (desmutar, ismute*60*1000, 1, source)
triggerClientEvent( el, "mute:mutePlayer", el, ismute*60*1000 )
outputChatBox ("[Console] Muted to "..getPlayerName(source).." "..ismute.." Min by: (Evade the Last Mute).", root, 255, 0, 0)
end
end
end)	

 

Link to comment
8 minutes ago, xRGamingx said:

And how would it be then in this case?

 

local screenW, screenH = guiGetScreenSize()
function drawMuteTime( )
	if not timerMute then return end
	
	local getMuteTimerDetails = math.floor(getTimerDetails( timerMute )) -- here
	if getMuteTimerDetails > 0 and mute == true then -----------162 LINE--------
		dxDrawText("Muted time: "..tostring(getMuteTimerDetails), screenW * 0.0078, screenH * 0.6094, screenW * 0.2727, screenH * 0.6484, tocolor(255, 0, 0, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
	end
end
addEventHandler( "onClientRender", root, drawMuteTime )

 

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