freudo Posted July 30, 2017 Posted July 30, 2017 Hello friends, I have a problem. I have a little delay when I watch the player. Code: function randomSpectatePlayer() local playerGroup = getElementData(localPlayer, "player:group") or false if playerGroup then local inGame = getElementData(localPlayer, "player:game") or false for k,v in ipairs(playerGroup) do if isElement(v) and getElementData(v, "player:game") and getElementData(localPlayer, "player:onSpawn") then if v ~= localPlayer then setElementFrozen ( localPlayer, true ) oldDim = getElementInterior(localPlayer) oldInt = getElementDimension(localPlayer) setElementInterior(localPlayer, getElementInterior(v)) setElementDimension(localPlayer, getElementDimension(v)) setCameraInterior(localPlayer, getCameraInterior(v)) spectating = v setCameraTarget ( v ) outputChatBox("[SPECTATE] #ffffffYou spectating now "..getPlayerName(v), 255,100,100,true) outputChatBox("[SPECTATE] #ffffffIf you want back to lobby use #ff0000/back #ffffffcommand.", 255,100,100,true) addCommandHandler("back", onStopSpectating) end end end end end
Mr.Loki Posted July 30, 2017 Posted July 30, 2017 Probably lag... what's the ping of the player that you are watching?
MisterQuestions Posted July 30, 2017 Posted July 30, 2017 (edited) Well your topic talks about a function you don't even use, how ever you also should break the loop. Edit: The delay may be caused cause loop and way you get data, you should organize more such spectator system otherwise lag will keep, is really needed do all such things everytime you call to a random spectate target? Edited July 30, 2017 by MisterQuestions 1
MisterQuestions Posted July 31, 2017 Posted July 31, 2017 15 minutes ago, barikat said: yes it's random. Seems like you don't even understand what i said.
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