Jump to content

Moderator


SkiZo

Recommended Posts

Hello Guys .. I Hope that you are fine :)) 
I Need some help here .. I don't know where is the Problem here :'( 
i tried i lot and got tired so i need help please :)) 

function chat(thePlayer)
    accountname = getAccountName(getPlayerAccount(thePlayer))
  if isObjectInACLGroup("user." .. accountname, aclGetGroup("Moderator")) then
    outputChatBox("Press 'm' To Open Your Moderator Panel", thePlayer, 0, 255, 0, false)
    else
end
end
addEventHandler("onPlayerLogin",getRootElement(),chat)
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),chat)


Bad argument @ 'getAccountName'

Bad argument @ 'getPlayerAccount'

Link to comment

Both onPlayerLogin and onResourceStart return different parameters, not the player. Use 'source' instead of 'thePlayer', and be sure to check if source is a player element (getElementType).

function chat(
)
  if getElementType(source) ~= "player" then return end
  accountname = getAccountName(getPlayerAccount(source))
  if isObjectInACLGroup("user." .. accountname, aclGetGroup("Moderator")) then
    outputChatBox("Press 'm' To Open Your Moderator Panel", source, 0, 255, 0, false)
    else
end
end
addEventHandler("onPlayerLogin",getRootElement(),chat)
addEventHandler("onResourceStart",resourceRoot,chat)

 

  • Like 1
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...