sckatchof Posted February 10, 2012 Posted February 10, 2012 hello guys , I have a problem when i leave the area i have a spam like this pic this is my script : local posX, posY, posZ = 269.70001220703, -1895.0999755859, 0.69999998807907 local RadioColshape = createColCircle ( 269.70001220703, -1895.0999755859, 0.69999998807907,150 ) local radioURL = "http://www.181.fm/winamp.pls?station=181-power&style=mp3" local radius = 150 local volume = 4.0 local thisRoot = getResourceRootElement(getThisResource()) local root = getRootElement() local RadioColshape = createColCircle ( 269.70001220703, -1895.0999755859, 0.69999998807907,150 ) addEventHandler("onClientResourceStart", thisRoot, function() local radio = playSound3D(radioURL, posX, posY, posZ, false) setSoundVolume(radio, volume) setSoundMaxDistance(radio, radius) end) addEventHandler("onClientResourceStop", thisRoot, function() destroyElement(colShape) end) addEventHandler("onColShapeLeave", getRootElement(), function(leaveElement, matchingDimension) if getElementType(leaveElement) == "player" then outputChatBox("#FFFF00RADIO: #FFFFFFStream stopped.", leaveElement, 255, 255, 255, true) end end)
unknooooown Posted February 10, 2012 Posted February 10, 2012 Please define "spam". Does it write it multiple times or just ONCE when you leave the area/colshape?
sckatchof Posted February 10, 2012 Author Posted February 10, 2012 Please define "spam". Does it write it multiple times or just ONCE when you leave the area/colshape? when i leave the area this text spam like this Radio :Stream Stopped Radio :Stream Stopped Radio :Stream Stopped Radio :Stream Stopped Radio :Stream Stopped I want When I leave the region does not show anything and thnx for help
drk Posted February 10, 2012 Posted February 10, 2012 Doesn't show anything? LOL Only remove onColShapeLeave event.
sckatchof Posted February 10, 2012 Author Posted February 10, 2012 Doesn't show anything? LOL Only remove onColShapeLeave event. thnx for help but some problem local posX, posY, posZ = 269.70001220703, -1895.0999755859, 0.69999998807907 local RadioColshape = createColCircle ( 269.70001220703, -1895.0999755859, 0.69999998807907,150 ) local radioURL = "http://www.181.fm/winamp.pls?station=181-power&style=mp3" local radius = 150 local volume = 4.0 local thisRoot = getResourceRootElement(getThisResource()) local root = getRootElement() local RadioColshape = createColCircle ( 269.70001220703, -1895.0999755859, 0.69999998807907,150 ) addEventHandler("onClientResourceStart", thisRoot, function() local radio = playSound3D(radioURL, posX, posY, posZ, false) setSoundVolume(radio, volume) setSoundMaxDistance(radio, radius) end) addEventHandler("onColShapeLeave", getRootElement(), function(leaveElement, matchingDimension) if getElementType(leaveElement) == "player" then outputChatBox("#FFFF00RADIO: #FFFFFFStream stopped.", leaveElement, 255, 255, 255, true) end end)
drk Posted February 10, 2012 Posted February 10, 2012 LOL Only remove onColShapeLeave event. What you don't understand in this lol addEventHandler('onColShapeLeave',root, function(player,dimension) if source == RadioColshape then if getElementType(player) == 'player' then outputChatBox('#ffff00RADIO: #ffffffStream stopped.', player, 255,255,255,true) end end end)
sckatchof Posted February 10, 2012 Author Posted February 10, 2012 LOL Only remove onColShapeLeave event. What you don't understand in this lol addEventHandler('onColShapeLeave',root, function(player,dimension) if source == RadioColshape then if getElementType(player) == 'player' then outputChatBox('#ffff00RADIO: #ffffffStream stopped.', player, 255,255,255,true) end end end) I understand you but some problem if u want test it and thnx again you mean like this local posX, posY, posZ = 269.70001220703, -1895.0999755859, 0.69999998807907 local RadioColshape = createColCircle ( 269.70001220703, -1895.0999755859, 0.69999998807907,150 ) local radioURL = "http://www.181.fm/winamp.pls?station=181-power&style=mp3" local radius = 150 local volume = 4.0 local thisRoot = getResourceRootElement(getThisResource()) local root = getRootElement() local RadioColshape = createColCircle ( 269.70001220703, -1895.0999755859, 0.69999998807907,150 ) addEventHandler("onClientResourceStart", thisRoot, function() local radio = playSound3D(radioURL, posX, posY, posZ, false) setSoundVolume(radio, volume) setSoundMaxDistance(radio, radius) end) addEventHandler("onClientResourceStop", thisRoot, function() destroyElement(colShape) end)
drk Posted February 10, 2012 Posted February 10, 2012 You get any error? You tried this? addEventHandler('onColShapeLeave',root, function(player,dimension) if source == RadioColshape then if getElementType(player) == 'player' then outputChatBox('#ffff00RADIO: #ffffffStream stopped.', player, 255,255,255,true) end end end)
sckatchof Posted February 10, 2012 Author Posted February 10, 2012 You get any error?You tried this? addEventHandler('onColShapeLeave',root, function(player,dimension) if source == RadioColshape then if getElementType(player) == 'player' then outputChatBox('#ffff00RADIO: #ffffffStream stopped.', player, 255,255,255,true) end end end) any error and some problem .
drk Posted February 10, 2012 Posted February 10, 2012 function onLeave(player) if getElementType(player) == 'player' then outputChatBox('#ffff00RADIO: #ffffffStream stopped.', player, 255, 255, 255, true) end end addEventHandler('onColShapeLeave',RadioColshape,onLeave) If it don't solve, I can't help you.
sckatchof Posted February 10, 2012 Author Posted February 10, 2012 function onLeave(player) if getElementType(player) == 'player' then outputChatBox('#ffff00RADIO: #ffffffStream stopped.', player, 255, 255, 255, true) end end addEventHandler('onColShapeLeave',RadioColshape,onLeave) If it don't solve, I can't help you. some problem , but thnx for ur help
drk Posted February 10, 2012 Posted February 10, 2012 Why you don't try to set a timer to outputChatBox with 800ms delay message = { '#ffff00RADIO: #ffffffStream stopped' } addEventHandler('onColShapeLeave',root, function(tplayer) if source == RadioColshape then if getElementType(tplayer) == 'player' then local msg = math.random(1,#message) setTimer(outputChatBox, 800, 1, msg, tplayer, 255, 255, 255, true) end end end) I not tested it, I think setTimer arguments is invalid but try
sckatchof Posted February 10, 2012 Author Posted February 10, 2012 Why you don't try to set a timer to outputChatBox with 800ms delay message = { '#ffff00RADIO: #ffffffStream stopped' } addEventHandler('onColShapeLeave',root, function(tplayer) if source == RadioColshape then if getElementType(tplayer) == 'player' then local msg = math.random(1,#message) setTimer(outputChatBox, 800, 1, msg, tplayer, 255, 255, 255, true) end end end) I not tested it, I think setTimer arguments is invalid but try Thanxx for help but some problem
drk Posted February 10, 2012 Posted February 10, 2012 lol, I will search about this. Edit: I can't help you. Please wait for a more experienced scripter help you
Castillo Posted February 10, 2012 Posted February 10, 2012 That script is client side, and you're using a server side event. local posX, posY, posZ = 269.70001220703, -1895.0999755859, 0.69999998807907 local RadioColshape = createColCircle ( 269.70001220703, -1895.0999755859, 0.69999998807907,150 ) local radioURL = "http://www.181.fm/winamp.pls?station=181-power&style=mp3" local radius = 150 local volume = 4.0 addEventHandler("onClientResourceStart",resourceRoot, function() local radio = playSound3D(radioURL, posX, posY, posZ, false) setSoundVolume(radio, volume) setSoundMaxDistance(radio, radius) end ) message = { "#ffff00RADIO: #ffffffStream stopped" } addEventHandler("onClientColShapeLeave",RadioColshape, function(tplayer) if (getElementType(tplayer) == "player" and tplayer == localPlayer) then local msg = math.random(#message) setTimer(outputChatBox, 800, 1, msg, tplayer, 255, 255, 255, true) end end )
Kenix Posted February 10, 2012 Posted February 10, 2012 local message = { "#ffff00RADIO: #ffffffStream stopped" } local posX, posY, posZ = 269.70001220703, -1895.0999755859, 0.69999998807907 local RadioColshape = createColCircle ( 269.70001220703, -1895.0999755859, 0.69999998807907,150 ) local radioURL = "http://www.181.fm/winamp.pls?station=181-power&style=mp3" local radius = 150 local volume = 4.0 local radio = playSound3D( radioURL, posX, posY, posZ, false ) setSoundVolume( radio, volume) setSoundMaxDistance( radio, radius ) addEventHandler( "onClientColShapeLeave",RadioColshape, function( tplayer ) if getElementType( tplayer ) == "player" and tplayer == localPlayer then setTimer( outputChatBox, 800, 1, math.random( #message ), 255, 255, 255, true ) end end )
sckatchof Posted February 11, 2012 Author Posted February 11, 2012 thanx guys for help but i have some problem when i leave the area again : this is my client side : local posX, posY, posZ = 269.70001220703, -1895.0999755859, 0.69999998807907 local RadioColshape = createColCircle ( 269.70001220703, -1895.0999755859, 0.69999998807907,150 ) local radioURL = "http://www.181.fm/winamp.pls?station=181-power&style=mp3" local radius = 150 local volume = 4.0 addEventHandler("onClientResourceStart",resourceRoot, function() local radio = playSound3D(radioURL, posX, posY, posZ, false) setSoundVolume(radio, volume) setSoundMaxDistance(radio, radius) end ) message = { "#ffff00RADIO: #ffffffStream stopped" } addEventHandler("onClientColShapeLeave",RadioColshape, function(tplayer) if (getElementType(tplayer) == "player" and tplayer == localPlayer) then local msg = math.random(#message) setTimer(outputChatBox, 800, 1, msg, tplayer, 255, 255, 255, true) end end ) and this is mta.xml
sckatchof Posted February 11, 2012 Author Posted February 11, 2012 If you leave colshape then it output. Yes when i leave it show like this picture.
Evil-Cod3r Posted February 11, 2012 Posted February 11, 2012 lol he want the msg output 1 time only not spaming in the chat
Kenix Posted February 11, 2012 Posted February 11, 2012 local message = { "#ffff00RADIO: #ffffffStream stopped" } local posX, posY, posZ = 269.70001220703, -1895.0999755859, 0.69999998807907 local RadioColshape = createColCircle ( 269.70001220703, -1895.0999755859, 0.69999998807907,150 ) local radioURL = "http://www.181.fm/winamp.pls?station=181-power&style=mp3" local radius = 150 local volume = 4.0 local bSpam local radio = playSound3D( radioURL, posX, posY, posZ, false ) setSoundVolume( radio, volume) setSoundMaxDistance( radio, radius ) addEventHandler( "onClientColShapeLeave",RadioColshape, function( tplayer ) if getElementType( tplayer ) == "player" and tplayer == localPlayer then if not bSpam then setTimer( outputChatBox, 800, 1, math.random( #message ), 255, 255, 255, true ) bSpam = true setTimer( function( ) bSpam = false end, 50000, 1 ) end end end )
sckatchof Posted February 11, 2012 Author Posted February 11, 2012 local message = { "#ffff00RADIO: #ffffffStream stopped" } local posX, posY, posZ = 269.70001220703, -1895.0999755859, 0.69999998807907 local RadioColshape = createColCircle ( 269.70001220703, -1895.0999755859, 0.69999998807907,150 ) local radioURL = "http://www.181.fm/winamp.pls?station=181-power&style=mp3" local radius = 150 local volume = 4.0 local bSpam local radio = playSound3D( radioURL, posX, posY, posZ, false ) setSoundVolume( radio, volume) setSoundMaxDistance( radio, radius ) addEventHandler( "onClientColShapeLeave",RadioColshape, function( tplayer ) if getElementType( tplayer ) == "player" and tplayer == localPlayer then if not bSpam then setTimer( outputChatBox, 800, 1, math.random( #message ), 255, 255, 255, true ) bSpam = true setTimer( function( ) bSpam = false end, 50000, 1 ) end end end ) thank guys and kenix for help but some problem when i leave. I want when i leave the area nothing nothing shows in chatbox or show one time
Kenix Posted February 11, 2012 Posted February 11, 2012 Tested. Lol, If somebody leave it output only 1 time in 50 sec( So if you leave and again leave it not output , but if leave and timer not have it output ). You can remove timer.
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