• Playx proximity sound?
    25 replies, posted
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 [URL="https://github.com/sk89q/playx/"]github[/URL], 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.
[QUOTE=nickster50;39293570]Is there a way to modify playx so there is some sort of proximity so the whole server doesn't have to hear it?[/QUOTE] Yes it is possible I have this working on my DarkRP server.
[QUOTE=robz;39297292]Yes it is possible I have this working on my DarkRP server.[/QUOTE] Don't leave us hangin dawg.
[QUOTE=Brandon1995;39297963]Don't leave us hangin dawg.[/QUOTE] 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
[QUOTE=nickster50;39304313]Wait ass mod has proximity maybe we can steal code from there and implement it into playx somehow[/QUOTE] '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: [CODE]--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)[/CODE] And change the whole function PlayX.SendEndUMsg() to this: [CODE]function PlayX.SendEndUMsg(ply) local filter = nil if ply then filter = ply else filter = player.GetHumans() end umsg.Start("PlayXEnd", filter) umsg.End() end[/CODE]
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 :-) 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??
any ideas code_x??
Try this: (Replace the whole Function) [CODE]function PlayX.SendBeginDStream(ply) local filter = nil -- modified from here.... local distance = 0 local range = 500 local instance = PlayX.GetInstance() if ply then filter = ply if instance ~= nil then distance = ply:GetPos():Distance(instance:GetPos()) if(distance>range) then return end end else --filter = RecipientFilter() --filter:AddAllPlayers() -- PCMod is a piece of crap filter = player.GetHumans() if instance ~= nil then for key, v in pairs(filter) do distance = v:GetPos():Distance(instance:GetPos()) if(distance>range) then table.remove(filter, key) end end end end -- ...to here local strLength = string.len(PlayX.CurrentMedia.Handler) + string.len(PlayX.CurrentMedia.URI) if next(PlayX.CurrentMedia.HandlerArgs) == nil and strLength <= 200 then umsg.Start("PlayXBegin", filter) umsg.String(PlayX.CurrentMedia.Handler) umsg.String(PlayX.CurrentMedia.URI) umsg.Long(CurTime() - PlayX.CurrentMedia.StartTime) -- To be safe umsg.Bool(PlayX.CurrentMedia.ResumeSupported) umsg.Bool(PlayX.CurrentMedia.LowFramerate) umsg.End() else net.Start("PlayXBegin") net.WriteTable({ ["Handler"] = PlayX.CurrentMedia.Handler, ["URI"] = PlayX.CurrentMedia.URI, ["PlayAge"] = CurTime() - PlayX.CurrentMedia.StartTime, ["ResumeSupported"] = PlayX.CurrentMedia.ResumeSupported, ["LowFramerate"] = PlayX.CurrentMedia.LowFramerate, ["HandlerArgs"] = PlayX.CurrentMedia.HandlerArgs, }) net.Broadcast() end end[/CODE]
what function am i replacing or do you mean the who lua file??
nope did think it worked i was watching video friend joins and he cannot hear it or see it which is good, but when runs to the theater it started playing with your old edit but this time that doesn't work, also if i never the area and come back it doesn't restart ether, these things are not the biggest problem the main problem is that, if i start a new video doesn't matter if you are right next to it or 10km you can hear it still so don't think ^update has worked :-( But please keep trying :-)
out of ideas code_x??
--DELETED--
Sorry, you need to Log In to post a reply to this thread.