Jump to content

Why not working onPlayerLogout?


Turbe$Z

Recommended Posts

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

My Fun server:

560x95_FFFFFF_FF9900_000000_000000.png

My DD server:

n-560x95_FFFFFF_FFFFFF_000000_000000.png

Posted (edited)

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.

Edited by pa3ck
Posted
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

 

My Fun server:

560x95_FFFFFF_FF9900_000000_000000.png

My DD server:

n-560x95_FFFFFF_FFFFFF_000000_000000.png

Posted (edited)

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

 

My Fun server:

560x95_FFFFFF_FF9900_000000_000000.png

My DD server:

n-560x95_FFFFFF_FFFFFF_000000_000000.png

Posted
Man, when player logs out he is no longer logged in.

:signlol:

G6HYac9.jpg

I love rock/metal/pop but don't mind any other music genre except чалга...that thing sux 
I also love cars

PS I'm friendly

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