xRGamingx Posted May 25, 2018 Share Posted May 25, 2018 Hello my friends I need help with a mute system And I made a dxDrawText so that the time the player takes mute leaves --Client --local function() local screenW, screenH = guiGetScreenSize() dxDrawText("Muted time min: 12", 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 ----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) 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) 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) outputChatBox ("[Console] Muted to "..getPlayerName(source).." "..ismute.." Min by: (Evade the Last Mute).", root, 255, 0, 0) end end end) Img: Link to comment
aka Blue Posted May 25, 2018 Share Posted May 25, 2018 @xRGamingx Try this: --Client local muteTime = 0 local mute = false function drawMuteTime( ) local screenW, screenH = guiGetScreenSize() if muteTime > 0 and mute = true then 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 ) muteTime = time mute = true setTimer( function( ) muteTime = 0 mute = false end, time, 1) 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
xRGamingx Posted May 25, 2018 Author Share Posted May 25, 2018 ----Broth local muteTime = 0 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 ) muteTime = time mute = true setTimer( function( ) muteTime = 0 mute = false end, time, 1) end ) addEvent( "mute:unMutePlayer" ) addEventHandler( "mute:unMutePlayer", getRootElement( ), function( ) muteTime = 0 mute = false end ) Link to comment
aka Blue Posted May 25, 2018 Share Posted May 25, 2018 @xRGamingx ----Broth 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 ) Link to comment
xRGamingx Posted May 25, 2018 Author Share Posted May 25, 2018 5 minutes ago, aka Blue said: @xRGamingx ----Brothlocal muteTime = 0local timerMute = nillocal mute = falsefunction 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) endendaddEventHandler( "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) Link to comment
aka Blue Posted May 26, 2018 Share Posted May 26, 2018 Change addEvent( "mute:mutePlayer" ) addEvent( "mute:unMutePlayer" ) by addEvent( "mute:mutePlayer", true ) addEvent( "mute:unMutePlayer", true ) My fault. Link to comment
xRGamingx Posted May 30, 2018 Author Share Posted May 30, 2018 On 26/5/2018 at 12:34, aka Blue said: Change addEvent( "mute:mutePlayer" )addEvent( "mute:unMutePlayer" ) by addEvent( "mute:mutePlayer", true )addEvent( "mute:unMutePlayer", true ) My fault. Broth time does not fade... I mute 1 minute and the message goes out and says mute 60000 and after the minute passes the text and time disappears.. 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