Jump to content

Why not working onPlayerLogout?


Turbe$Z

Recommended Posts

addEventHandler("onPlayerLogout", getRootElement(),
function ()
local name = getPlayerName ( source )
    if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then
		exports[getResourceName(resource)]:addNotification(root, name.." kilépett a tulajdonos szolgálatból!", "success")
    end
end
)

what wrong? onPlayerLogin working with this.. wtf?!

Link to comment
8 hours ago, pa3ck said:

Maybe because when they logout they are no longer in any team? (guest account). onPlayerLogout passes through 2 arguments, one of them is the oldAccount, use that instead.

Like this? 

function test()
		if (isGuestAccount(getPlayerAccount(v)) == false) then
			accountname = getAccountName (getPlayerAccount(v))
			if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then
				exports[getResourceName(resource)]:addNotification(root, " logged out", "success")
		end
	end
end

 

Link to comment

Man, when player logs out he is no longer logged in. Look what argument onPlayerLogout event gives.

account thePreviousAccount, account theCurrentAccount

Do you see? So,

addEventHandler("onPlayerLogout", getRootElement(),
	function (acc, _)
		local name = getPlayerName ( source )
    	if isObjectInACLGroup("user." .. getAccountName(acc), aclGetGroup("Admin")) then
			exports[getResourceName(resource)]:addNotification(root, name.." kilépett a tulajdonos szolgálatból!", "success")
   	 	end
	end
)
Edited by WhoAmI
  • Like 1
Link to comment
3 minutes ago, WhoAmI said:

Man, when player logs out he is no longer logged in. Look what argument onPlayerLogout event gives.


account thePreviousAccount, account theCurrentAccount

Do you see? So,


addEventHandler("onPlayerLogout", getRootElement(),
	function (acc, _)
		local name = getPlayerName ( source )
    	if isObjectInACLGroup("user." .. getAccountName(acc), aclGetGroup("Admin")) then
			exports[getResourceName(resource)]:addNotification(root, name.." kilépett a tulajdonos szolgálatból!", "success")
   	 	end
	end
)

thanks :D

 

Link to comment

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