server
unknown
lua
2 years ago
714 B
3
Indexable
Never
--- SERVER SIDE addEventHandler ( 'onPlayerLogin', getRootElement ( ), function ( _, theCurrentAccount ) local acc = getAccountName(theCurrentAccount) triggerClientEvent(getLoginPlayers(), "setOnline", resourceRoot, acc) end ) addEventHandler ( 'onPlayerLogout', getRootElement ( ), function ( prevAcc, theCurrentAccount ) local acc = getAccountName(prevAcc) triggerClientEvent(getLoginPlayers(), "setOffline", resourceRoot, acc) end ) function getLoginPlayers() local loginPlayers = {} for _,player in ipairs(getElementsByType("player")) do if not isGuestAccount(getPlayerAccount(player)) then table.insert(loginPlayers,player) end end return loginPlayers end