Jump to content

Need help


sckatchof

Recommended Posts

hello guys ,

I have a problem when i leave the area i have a spam like this pic

gg.png

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) 

Link to comment
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

Link to comment
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) 

Link to comment

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) 

Link to comment
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) 

Link to comment

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) 

Link to comment
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 .

Link to comment
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.

Link to comment
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

Link to comment

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 :)

Link to comment
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 xD

Link to comment

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 
) 

Link to comment
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 
) 

Link to comment

thanx guys for help but i have some problem when i leave the area again :

screen2.jpg

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

     

Link to comment
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 
) 

Link to comment
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

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...