MasKPro Posted May 8, 2016 Share Posted May 8, 2016 So I have just started Programming recently.. I Started with a simple script which I have trouble continuing it It's A Script Which When An Staff Member Login , it Should Get His Acl Group Name whether he's an admin or moderator... Then Says (Player) logged in As (aclGetGroupName) Here's what I have done but couldn't continue addEventHandler ("onPlayerLogin",root, Function WelcomeStaff () aclGetGroup (player) end Link to comment
Dimos7 Posted May 8, 2016 Share Posted May 8, 2016 addEventHandler("onPlayerLogin", root, function() outputChatBox(getPlayerName(source).."has logged in as "..aclGroupGetName(aclGetGroup()), 211, 211, 211) end) Link to comment
MACIEKW89 Posted May 8, 2016 Share Posted May 8, 2016 Hi, Try with that: addEventHandler("onPlayerLogin", root, function() local accName = getAccountName(getPlayerAccount(source)) if not accName then return end if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then outputChatBox(getPlayerName(source).." has logged in as Admin!", root, 255, 255, 255, true) end end) Link to comment
MasKPro Posted May 9, 2016 Author Share Posted May 9, 2016 Hi,Try with that: addEventHandler("onPlayerLogin", root, function() local accName = getAccountName(getPlayerAccount(source)) if not accName then return end if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then outputChatBox(getPlayerName(source).." has logged in as Admin!", root, 255, 255, 255, true) end end) What About of He is Moderator or another staff level ?Should I repeat the last step? Link to comment
Moderators IIYAMA Posted May 9, 2016 Moderators Share Posted May 9, 2016 Read this: https://www.lua.org/pil/4.3.1.html Link to comment
MasKPro Posted May 9, 2016 Author Share Posted May 9, 2016 (edited) else if isObjectInACLGroup("user."..accName, aclGetGroup("Moderator")) then outputChatBox(getPlayerName(source).." has logged in as moderator!", root, 255, 255, 255, true) end end) Should I add that if I want moderator too? Edited May 9, 2016 by Guest Link to comment
Moderators IIYAMA Posted May 9, 2016 Moderators Share Posted May 9, 2016 else if In lua you have to write it like this: elseif Link to comment
MasKPro Posted May 9, 2016 Author Share Posted May 9, 2016 else if In lua you have to write it like this: elseif Ok Thanks for the hint .. Is the script now written right? Link to comment
MACIEKW89 Posted May 9, 2016 Share Posted May 9, 2016 It will be somethink like that : addEventHandler("onPlayerLogin", root, function() local accName = getAccountName(getPlayerAccount(source)) if not accName then return end if isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then outputChatBox(getPlayerName(source).." has logged in as Admin!", root, 255, 255, 255, true) elseif isObjectInACLGroup("user."..accName, aclGetGroup("Moderator")) then outputChatBox(getPlayerName(source).." has logged in as Moderator!", root, 255, 255, 255, true) end end) And sorry for bad english ;b Link to comment
MasKPro Posted May 9, 2016 Author Share Posted May 9, 2016 Ye thanks . I changed Something's too 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