Jump to content

Problem .


sckatchof

Recommended Posts

Posted

hello guys i have a spam problem like this in chat

You have left the song area ! 
You have left the song area ! 
You have left the song area ! 
You have left the song area ! 
You have left the song area ! 
You have left the song area ! 
  

  
local radius = 150 
local volume = 1.0 
local posX, posY, posZ = 251.5, -1890.8000488281, 3.7000000476837 
local radioURL = "http://www.true.nl/streams/slamfmlivestream.asx" 
local thisRoot = getResourceRootElement(getThisResource()) 
  
addEventHandler("onClientResourceStart", thisRoot, 
function() 
    radio = playSound3D(radioURL, posX, posY, posZ, false) 
    setSoundVolume(radio, volume) 
    setSoundMaxDistance(radio, radius) 
end) 
  
addEventHandler("onClientRender", getRootElement(), 
function() 
    local x, y, z = getElementPosition(getLocalPlayer()) 
    if x and y and z then 
        local distance = getDistanceBetweenPoints3D(x, y, z, posX, posY, posZ) 
        if distance >= radius then 
            outputChatBox("You have left the song area !") 
        end 
    end 
end) 
  

Posted
This happens when you use event without knowing its function.Its because you put it in onClientRender event.

Instead of this create a marker or something and use onMarkerExit

Colshapes would be better for this kind of thing.

P.S: It's "onMarkerLeave".

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