Jump to content

remove player on table when quit


freudo

Recommended Posts

Posted

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

 

WOC-DD Destruction Derby

-Level system

-Clan system

-Topwins

-Event system for EXP

-Podium with animation

And more

350x20_FFFFF_FFFFF_00000_00000.png

Posted
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?

Skype : 01100001 01101100 01101001 01011111 01101101 01110100 00110001 00111001 00111001 00111001

every thing is gonna be alright

every thing is gonna be okay

it's gonna be a good good life

that's what my therapist say

Posted (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 by barikat

WOC-DD Destruction Derby

-Level system

-Clan system

-Topwins

-Event system for EXP

-Podium with animation

And more

350x20_FFFFF_FFFFF_00000_00000.png

Posted

self?

undefined 

Skype : 01100001 01101100 01101001 01011111 01101101 01110100 00110001 00111001 00111001 00111001

every thing is gonna be alright

every thing is gonna be okay

it's gonna be a good good life

that's what my therapist say

Posted

its working, just I cant show all codes.

WOC-DD Destruction Derby

-Level system

-Clan system

-Topwins

-Event system for EXP

-Podium with animation

And more

350x20_FFFFF_FFFFF_00000_00000.png

Posted
3 minutes ago, barikat said:

its working, just I cant show all codes.

send pm to me

Skype : 01100001 01101100 01101001 01011111 01101101 01110100 00110001 00111001 00111001 00111001

every thing is gonna be alright

every thing is gonna be okay

it's gonna be a good good life

that's what my therapist say

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