Playx proximity sound?

Is there a way to modify playx so there is some sort of proximity so the whole server doesn’t have to hear it?

Yeah I was wondering the same thing

Not in current playx as far I know, this is a feature I missed too a few times.
But maybe someone can implement it? -Its opensource (GPL) and hosted on github, so everyone can fork and work on it. I can try to implement it myself - but I have currently not much time.

It should start playing only for the player when he is in a specific range, and stop or pause when he leaves that area. Same for the repeaters.

Yes it is possible I have this working on my DarkRP server.

Don’t leave us hangin dawg.

Already tried he wants 25$ USD for it. Kinda bs.

Anyone that wants money for a fucking proximity modification is retarded 25$! Wtf

25USD, what a joke.

Someone is bound to have it! Common guys lets work together.

Wait ass mod has proximity maybe we can steal code from there and implement it into playx somehow

‘maybe we can steal code’ Or re-make it, to not seem like you stole it.

steal is the wrong term. I say learn from it and implement it.

Ok I’ll look at the lua files later today

You can check function PlayX.SendBeginDStream in playx.lua. It seems there was a player-based filter planned, because there are some commented out lines. In the function you can pass a table of players to the filter var. Or you can call PlayX.SendBeginDStream(ply) passing the player which entered the “playx” zone as argument.

ok thanks ill check it out

Last minutes I did something thats works already, it just needs a little tweaking and a gui part to setup the range, I set the range in this example to 500.
With this it starts playing once the player is in range of the main playx instance and stops if he leaves. If he get back the playing starts from the right position (not just like it was paused).

This “kino” mode should be made optional, so playX can work in both modes. And maybe its a good idea to allow each player to set a local “ignore the range limit” option, so they can still hear it when out of range - if wished. And I think it will work better with some check like is-in-box than is-in-range, maybe by using some “ghost” for setting up the box-size similar the cap shield core is using it for setting up the shield-size.

Hope its a good starting point you can work on.

Paste this into lua/playx/playx.lua:


--Start playing if player is in range
--Stops playing if player is out of range
--Todo: is there a better way instead of using PlayerTick to monitor player movement?
function PlayerTick( ply, movedata )
    local instance = PlayX.GetInstance()
    local range = 500
    if instance ~= nil then
        local distance = ply:GetPos():Distance(instance:GetPos())
        if(distance<=range and not ply.playxIsPlaying) then
            ply.playxIsPlaying = true
            PlayX.SendBeginDStream(ply)
        elseif(distance>range and ply.playxIsPlaying) then
            ply.playxIsPlaying = false
            PlayX.SendEndUMsg(ply)
        end
    end
end
hook.Add("PlayerTick", "PlayXPlayerTick", PlayerTick)

And change the whole function PlayX.SendEndUMsg() to this:


function PlayX.SendEndUMsg(ply)
    local filter = nil
    
    if ply then
        filter = ply
    else
        filter = player.GetHumans()
    end
    
    umsg.Start("PlayXEnd", filter)
    umsg.End()
end

Awesome work man that works great but is it possible to make it that you have to walk upto it for it to start playing, because as it is atm if someone else joins the server it plays automaticly and blows there ear drums they have to run to the movie and then run away to make it stop.

So is it possible to add that script so when some new joins they dont hear it till they run to it.

Shit idk ask the guy who posted the code

Not tested yet but if you remove PlayX.SendBeginDStream(ply) in the function PlayerInitialSpawn it should stop the playing on initial spawn.

awesome mate that worked perfectly :slight_smile: now next lol, when i start the next video the whole server can hear it again and they have to run to the video and then run away again to stop it, can you think of a way so it wont start playing till they are in that radius??