Agon Posted March 13, 2012 Share Posted March 13, 2012 Hi i made this but how can i use it? (and is this code true? I cannot test it i've written this on my mobile phone) function whoAreYou(thePlayer) local accName=getAccountName(getPlayerAccount(thePlayer)) if isObjectInACLGroup("user." ..accName, aclGetGroup("Admin")) then isPlayerAdmin == "true" else isPlayerAdmin == "false" end end can i use it like this? function justTest(thePlayer) if isPlayerAdmin then outputChatBox("TRUE", thePlayer, 0, 255, 0) else outputChatBox("FALSE", thePlayer, 255, 0, 0) end end addCommandHandler("amiadmin", justTest) btw what is the difference between "thePlayer" and "source" ? Link to comment
TAPL Posted March 13, 2012 Share Posted March 13, 2012 you can check if the player is admin by this way function justTest(thePlayer) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) then outputChatBox("TRUE", thePlayer, 0, 255, 0) else outputChatBox("FALSE", thePlayer, 255, 0, 0) end end addCommandHandler("amiadmin", justTest) also this work too function isPlayerAdmin(thePlayer) local accName=getAccountName(getPlayerAccount(thePlayer)) if isObjectInACLGroup("user." ..accName, aclGetGroup("Admin")) then return true end end function justTest(thePlayer) if isPlayerAdmin(thePlayer) then outputChatBox("TRUE", thePlayer, 0, 255, 0) else outputChatBox("FALSE", thePlayer, 255, 0, 0) end end addCommandHandler("amiadmin", justTest) Link to comment
Agon Posted March 13, 2012 Author Share Posted March 13, 2012 Oh second one will help me thank you so much Link to comment
Kenix Posted March 13, 2012 Share Posted March 13, 2012 btw what is the difference between "thePlayer" and "source" ? source use only in event, in command handler function you can use too if you define it in arguments ( server side ). Source examples: Client triggerServerEvent( 'onDownload',localPlayer ) -- We trigger to server , source is localPlayer -- I think you know, if script download then this event triggered to server. Server addEvent( 'onDownload', true ) addEventHandler( 'onDownload', root, function( ) outputChatBox( string.format( '* %s download requested files.', getPlayerName( source ) ) ) end ) Output like this: * Kenix download requested files. P.S If you not understand say me. Also you can read here: viewtopic.php?f=91&t=39678 Link to comment
Agon Posted March 13, 2012 Author Share Posted March 13, 2012 Oh thanks Kenix i think i got it Link to comment
Kenix Posted March 13, 2012 Share Posted March 13, 2012 Oh thanks Kenix i think i got it No problem. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now