freudo Posted August 27, 2017 Share Posted August 27, 2017 Hey, I have a problem this code working player in server. But no working when player quit. exitLobby = function(self) local previousLobby = getElementData(localPlayer, "player:selectedLobby") if previousLobby then if self.lobbies[previousLobby] then for k,v in ipairs(self.lobbies[previousLobby].players) do if v == localPlayer then table.remove(self.lobbies[previousLobby].players, k) end end end end setElementData(resourceRoot, "root:lobbies", self.lobbies) setElementData(localPlayer, "player:selectedLobby", false) exports["br_notifications"]:addNotification(localization:getText(localPlayer, "lobby-leftInRoom"), "success") end Link to comment
Master_MTA Posted August 27, 2017 Share Posted August 27, 2017 3 minutes ago, barikat said: Hey, I have a problem this code working player in server. But no working when player quit. exitLobby = function(self) local previousLobby = getElementData(localPlayer, "player:selectedLobby") if previousLobby then if self.lobbies[previousLobby] then for k,v in ipairs(self.lobbies[previousLobby].players) do if v == localPlayer then table.remove(self.lobbies[previousLobby].players, k) end end end end setElementData(resourceRoot, "root:lobbies", self.lobbies) setElementData(localPlayer, "player:selectedLobby", false) exports["br_notifications"]:addNotification(localization:getText(localPlayer, "lobby-leftInRoom"), "success") end debug? Link to comment
freudo Posted August 27, 2017 Author Share Posted August 27, 2017 (edited) No have any errors. just no removing player when quit. function leav() lobbyInstance:exitLobby() end addCommandHandler("leav", leav) -- this is working function leav() lobbyInstance:exitLobby() end addEventHandler("onClientPlayerQuit", localPlayer, leav) -- no working.. Edited August 27, 2017 by barikat Link to comment
freudo Posted August 27, 2017 Author Share Posted August 27, 2017 its working, just I cant show all codes. Link to comment
Master_MTA Posted August 27, 2017 Share Posted August 27, 2017 3 minutes ago, barikat said: its working, just I cant show all codes. send pm to me Link to comment
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