abod99119911 Posted August 8, 2014 Share Posted August 8, 2014 hi guyz i want script that let other player see the muted player with tag on his head that write [Muted] for example if there is ready recourse please give me i search on google but i didn't fine any thing Link to comment
xXMADEXx Posted August 8, 2014 Share Posted August 8, 2014 (edited) Use the following functions: -- Event: onPlayerMute, onPlayetUnmute -- to check if the player is muted on the client side: setElementData getElementData -- for drawing: getElementPosition getWorldFromScreenPosition dxDrawText -- event: onClientPreRender Edited August 8, 2014 by Guest Link to comment
xTravax Posted August 8, 2014 Share Posted August 8, 2014 -- CLIENT SIDE function testing() local px, py, pz, tx, ty, tz, dist px, py, pz = getCameraMatrix( ) for _, v in ipairs( getElementsByType 'player' ) do tx, ty, tz = getElementPosition( v ) dist = math.sqrt( ( px - tx ) ^ 2 + ( py - ty ) ^ 2 + ( pz - tz ) ^ 2 ) if dist < 32.0 then if isLineOfSightClear( px, py, pz, tx, ty, tz, true, false, false, true, false, false, false,localPlayer ) then local sx, sy, sz = getPedBonePosition( v, 5 ) local x,y = getScreenFromWorldPosition( sx, sy, sz + 0.30 ) local x1,y1 = getScreenFromWorldPosition( sx, sy, sz + 0.35 ) local r,g,b = getPlayerNametagColor(localPlayer) scale = 0.65 if x then if getElementData(localPlayer,"playermuted") == 1 then dxDrawText( "Muted", x, y, x, y, tocolor(rr, gg, bb), scale + ( 15 - dist ) * 0.02, "bankgothic" ) end end end end end end addEventHandler("onClientRender",root,testing) -- SERVER SIDE function isMuted() if isPlayerMuted(source) then setElementData(source,"playermuted",1) else setElementData(source,"playermuted",0) end end setTimer(isMuted,500,0,source) addEventHandler("onPlayerJoin",root,isMuted) -- META this should work Link to comment
abod99119911 Posted August 9, 2014 Author Share Posted August 9, 2014 -- CLIENT SIDE function testing() local px, py, pz, tx, ty, tz, dist px, py, pz = getCameraMatrix( ) for _, v in ipairs( getElementsByType 'player' ) do tx, ty, tz = getElementPosition( v ) dist = math.sqrt( ( px - tx ) ^ 2 + ( py - ty ) ^ 2 + ( pz - tz ) ^ 2 ) if dist < 32.0 then if isLineOfSightClear( px, py, pz, tx, ty, tz, true, false, false, true, false, false, false,localPlayer ) then local sx, sy, sz = getPedBonePosition( v, 5 ) local x,y = getScreenFromWorldPosition( sx, sy, sz + 0.30 ) local x1,y1 = getScreenFromWorldPosition( sx, sy, sz + 0.35 ) local r,g,b = getPlayerNametagColor(localPlayer) scale = 0.65 if x then if getElementData(localPlayer,"playermuted") == 1 then dxDrawText( "Muted", x, y, x, y, tocolor(rr, gg, bb), scale + ( 15 - dist ) * 0.02, "bankgothic" ) end end end end end end addEventHandler("onClientRender",root,testing) -- SERVER SIDE function isMuted() if isPlayerMuted(source) then setElementData(source,"playermuted",1) else setElementData(source,"playermuted",0) end end setTimer(isMuted,500,0,source) addEventHandler("onPlayerJoin",root,isMuted) -- META this should work great gop but when i test it not working ? Link to comment
abod99119911 Posted August 9, 2014 Author Share Posted August 9, 2014 function testing() local px, py, pz, tx, ty, tz, dist px, py, pz = getCameraMatrix( ) for _, v in ipairs( getElementsByType 'player' ) do tx, ty, tz = getElementPosition( v ) dist = math.sqrt( ( px - tx ) ^ 2 + ( py - ty ) ^ 2 + ( pz - tz ) ^ 2 ) if dist < 32.0 then if isLineOfSightClear( px, py, pz, tx, ty, tz, true, false, false, true, false, false, false,localPlayer ) then local sx, sy, sz = getPedBonePosition( v, 5 ) local x,y = getScreenFromWorldPosition( sx, sy, sz + 0.30 ) local x1,y1 = getScreenFromWorldPosition( sx, sy, sz + 0.35 ) local r,g,b = getPlayerNametagColor(localPlayer) scale = 0.65 if x then if getElementData(localPlayer,"playermuted") == 1 then dxDrawText( "Muted", x, y, x, y, tocolor(rr, gg, bb), scale + ( 15 - dist ) * 0.02, "bankgothic" ) end end end end end end addEventHandler("onClientRender",root,testing) on line 15. can i change the color? and if there any problem please tell me Link to comment
xTravax Posted August 9, 2014 Share Posted August 9, 2014 server function isMuted() setElementData(source,"playermuted",1) end addEventHandler("onPlayerMute",root,isMuted) function isNotMuted() setElementData(source,"playermuted",0) end addEventHandler("onPlayerUnmute",root,isNotMuted) client function testing() local px, py, pz, tx, ty, tz, dist px, py, pz = getCameraMatrix( ) for _, v in ipairs( getElementsByType 'player' ) do tx, ty, tz = getElementPosition( v ) dist = math.sqrt( ( px - tx ) ^ 2 + ( py - ty ) ^ 2 + ( pz - tz ) ^ 2 ) if dist < 32.0 then if isLineOfSightClear( px, py, pz, tx, ty, tz, true, false, false, true, false, false, false,localPlayer ) then local sx, sy, sz = getPedBonePosition( v, 5 ) local x,y = getScreenFromWorldPosition( sx, sy, sz + 0.30 ) local x1,y1 = getScreenFromWorldPosition( sx, sy, sz + 0.35 ) local r,g,b = getPlayerNametagColor(localPlayer) scale = 0.65 if x then if getElementData(localPlayer,"playermuted") == 1 then dxDrawText( "Muted", x, y, x, y, tocolor(r, g, b), scale + ( 15 - dist ) * 0.02, "bankgothic" ) end end end end end end addEventHandler("onClientRender",root,testing) Link to comment
abod99119911 Posted August 9, 2014 Author Share Posted August 9, 2014 server function isMuted() setElementData(source,"playermuted",1) end addEventHandler("onPlayerMute",root,isMuted) function isNotMuted() setElementData(source,"playermuted",0) end addEventHandler("onPlayerUnmute",root,isNotMuted) client function testing() local px, py, pz, tx, ty, tz, dist px, py, pz = getCameraMatrix( ) for _, v in ipairs( getElementsByType 'player' ) do tx, ty, tz = getElementPosition( v ) dist = math.sqrt( ( px - tx ) ^ 2 + ( py - ty ) ^ 2 + ( pz - tz ) ^ 2 ) if dist < 32.0 then if isLineOfSightClear( px, py, pz, tx, ty, tz, true, false, false, true, false, false, false,localPlayer ) then local sx, sy, sz = getPedBonePosition( v, 5 ) local x,y = getScreenFromWorldPosition( sx, sy, sz + 0.30 ) local x1,y1 = getScreenFromWorldPosition( sx, sy, sz + 0.35 ) local r,g,b = getPlayerNametagColor(localPlayer) scale = 0.65 if x then if getElementData(localPlayer,"playermuted") == 1 then dxDrawText( "Muted", x, y, x, y, tocolor(r, g, b), scale + ( 15 - dist ) * 0.02, "bankgothic" ) end end end end end end addEventHandler("onClientRender",root,testing) testing Link to comment
abod99119911 Posted August 9, 2014 Author Share Posted August 9, 2014 server function isMuted() setElementData(source,"playermuted",1) end addEventHandler("onPlayerMute",root,isMuted) function isNotMuted() setElementData(source,"playermuted",0) end addEventHandler("onPlayerUnmute",root,isNotMuted) client function testing() local px, py, pz, tx, ty, tz, dist px, py, pz = getCameraMatrix( ) for _, v in ipairs( getElementsByType 'player' ) do tx, ty, tz = getElementPosition( v ) dist = math.sqrt( ( px - tx ) ^ 2 + ( py - ty ) ^ 2 + ( pz - tz ) ^ 2 ) if dist < 32.0 then if isLineOfSightClear( px, py, pz, tx, ty, tz, true, false, false, true, false, false, false,localPlayer ) then local sx, sy, sz = getPedBonePosition( v, 5 ) local x,y = getScreenFromWorldPosition( sx, sy, sz + 0.30 ) local x1,y1 = getScreenFromWorldPosition( sx, sy, sz + 0.35 ) local r,g,b = getPlayerNametagColor(localPlayer) scale = 0.65 if x then if getElementData(localPlayer,"playermuted") == 1 then dxDrawText( "Muted", x, y, x, y, tocolor(r, g, b), scale + ( 15 - dist ) * 0.02, "bankgothic" ) end end end end end end addEventHandler("onClientRender",root,testing) sorry but still not working Link to comment
xeon17 Posted August 9, 2014 Share Posted August 9, 2014 The problem is in meta i think but i can't fix it now because i'm on phone Link to comment
Et-win Posted August 9, 2014 Share Posted August 9, 2014 <script src="server.lua" type="server" /> You forgot type. Link to comment
abod99119911 Posted August 9, 2014 Author Share Posted August 9, 2014 <script src="server.lua" type="server" /> You forgot type. do u check the script any thing wrong on it ? Link to comment
Et-win Posted August 9, 2014 Share Posted August 9, 2014 -.- Why don't you try it by yourself? Use command in-game: /debugscript 3 and give us the errors as soon as you start the resource if any. Link to comment
abod99119911 Posted August 9, 2014 Author Share Posted August 9, 2014 -.- Why don't you try it by yourself? Use command in-game:/debugscript 3 and give us the errors as soon as you start the resource if any. when i give 1 player mute. they all the player in server get that [muted] on them heads Link to comment
Et-win Posted August 9, 2014 Share Posted August 9, 2014 Change this: if getElementData(localPlayer,"playermuted") == 1 then to: if getElementData(v,"playermuted") == 1 then Link to comment
abod99119911 Posted August 9, 2014 Author Share Posted August 9, 2014 Change this: if getElementData(localPlayer,"playermuted") == 1 then to: if getElementData(v,"playermuted") == 1 then very good and thx but when i do unmute the write [muted] still on the player head not removed Link to comment
Et-win Posted August 9, 2014 Share Posted August 9, 2014 Weird... In my eyes it just should work. Maybe someone else knows. Are you sure she/he gets unmuted? Link to comment
Max+ Posted August 9, 2014 Share Posted August 9, 2014 ---ClientSide function testing() local px, py, pz, tx, ty, tz, dist px, py, pz = getCameraMatrix( ) for _, v in ipairs( getElementsByType 'player' ) do tx, ty, tz = getElementPosition( v ) dist = math.sqrt( ( px - tx ) ^ 2 + ( py - ty ) ^ 2 + ( pz - tz ) ^ 2 ) if dist < 32.0 then if isLineOfSightClear( px, py, pz, tx, ty, tz, true, false, false, true, false, false, false,localPlayer ) then local sx, sy, sz = getPedBonePosition( v, 5 ) local x,y = getScreenFromWorldPosition( sx, sy, sz + 0.30 ) local x1,y1 = getScreenFromWorldPosition( sx, sy, sz + 0.35 ) local r,g,b = getPlayerNametagColor(localPlayer) scale = 0.65 if x then if getElementData(v,"playermuted") == 1 then dxDrawText( "Muted", x, y, x, y, tocolor(r, g, b), scale + ( 15 - dist ) * 0.02, "bankgothic" ) elseif getElementData(v,"playermuted") == 0 then setTimer(function() removeEventHandler ("onClientRender",root,testing) end, 1000, 1) end end end end end end addEventHandler("onClientRender",root,testing) Link to comment
Et-win Posted August 9, 2014 Share Posted August 9, 2014 Max+, that's useless. When she/he gets muted again it will not run. Link to comment
Max+ Posted August 9, 2014 Share Posted August 9, 2014 Max+, that's useless. When she/he gets muted again it will not run. he can use a timer to check isPlayerMuted then addEvent Back . if not isPlayerMuted then ---remove it again Link to comment
abod99119911 Posted August 9, 2014 Author Share Posted August 9, 2014 ---ClientSide function testing() local px, py, pz, tx, ty, tz, dist px, py, pz = getCameraMatrix( ) for _, v in ipairs( getElementsByType 'player' ) do tx, ty, tz = getElementPosition( v ) dist = math.sqrt( ( px - tx ) ^ 2 + ( py - ty ) ^ 2 + ( pz - tz ) ^ 2 ) if dist < 32.0 then if isLineOfSightClear( px, py, pz, tx, ty, tz, true, false, false, true, false, false, false,localPlayer ) then local sx, sy, sz = getPedBonePosition( v, 5 ) local x,y = getScreenFromWorldPosition( sx, sy, sz + 0.30 ) local x1,y1 = getScreenFromWorldPosition( sx, sy, sz + 0.35 ) local r,g,b = getPlayerNametagColor(localPlayer) scale = 0.65 if x then if getElementData(v,"playermuted") == 1 then dxDrawText( "Muted", x, y, x, y, tocolor(r, g, b), scale + ( 15 - dist ) * 0.02, "bankgothic" ) elseif getElementData(v,"playermuted") == 0 then setTimer(function() removeEventHandler ("onClientRender",root,testing) end, 1000, 1) end end end end end end addEventHandler("onClientRender",root,testing) still not working. i give unmute and it still not removed the i give mut 1 min and wait 1 min same not removed Link to comment
Sasu Posted August 9, 2014 Share Posted August 9, 2014 Try to put an outputChatBox to test if the event "onPlayerUnmute" has been activated. Link to comment
abod99119911 Posted August 9, 2014 Author Share Posted August 9, 2014 Try to put an outputChatBox to test if the event "onPlayerUnmute" has been activated. so that will remove that [muted] tag after the player get unmuted? Link to comment
Et-win Posted August 9, 2014 Share Posted August 9, 2014 Tested it in my server. Everything is fine, but it seems that this is not setting the data, but it does return 'true': function isNotMuted() lol = setElementData(source,"playermuted",0) outputChatBox(tostring(lol)) end addEventHandler("onPlayerUnmute",root,isNotMuted) I guess a... bug? Link to comment
abod99119911 Posted August 9, 2014 Author Share Posted August 9, 2014 Max+, that's useless. When she/he gets muted again it will not run. he can use a timer to check isPlayerMuted then addEvent Back . if not isPlayerMuted then ---remove it again sorry but when to add that if not isPlayerMuted then ---remove it again Link to comment
abod99119911 Posted August 9, 2014 Author Share Posted August 9, 2014 Tested it in my server. Everything is fine, but it seems that this is not setting the data, but it does return 'true': function isNotMuted() lol = setElementData(source,"playermuted",0) outputChatBox(tostring(lol)) end addEventHandler("onPlayerUnmute",root,isNotMuted) I guess a... bug? where to add that function on client.lua function testing() local px, py, pz, tx, ty, tz, dist px, py, pz = getCameraMatrix( ) for _, v in ipairs( getElementsByType 'player' ) do tx, ty, tz = getElementPosition( v ) dist = math.sqrt( ( px - tx ) ^ 2 + ( py - ty ) ^ 2 + ( pz - tz ) ^ 2 ) if dist < 32.0 then if isLineOfSightClear( px, py, pz, tx, ty, tz, true, false, false, true, false, false, false,localPlayer ) then local sx, sy, sz = getPedBonePosition( v, 5 ) local x,y = getScreenFromWorldPosition( sx, sy, sz + 0.30 ) local x1,y1 = getScreenFromWorldPosition( sx, sy, sz + 0.35 ) local r,g,b = getPlayerNametagColor(localPlayer) scale = 0.65 if x then if getElementData(v,"playermuted") == 1 then dxDrawText( "[Muted]", x, y, x, y, tocolor(255, 0, 0), scale + ( 15 - dist ) * 0.02, "bankgothic" ) elseif getElementData(v,"playermuted") == 0 then setTimer(function() removeEventHandler ("onClientRender",root,testing) end, 1000, 1) end end end end end end addEventHandler("onClientRender",root,testing) 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