MasKPro Posted May 8, 2016 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
Dimos7 Posted May 8, 2016 Posted May 8, 2016 addEventHandler("onPlayerLogin", root, function() outputChatBox(getPlayerName(source).."has logged in as "..aclGroupGetName(aclGetGroup()), 211, 211, 211) end)
MACIEKW89 Posted May 8, 2016 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)
MasKPro Posted May 9, 2016 Author 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?
Moderators IIYAMA Posted May 9, 2016 Moderators Posted May 9, 2016 Read this: https://www.lua.org/pil/4.3.1.html
MasKPro Posted May 9, 2016 Author 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
Moderators IIYAMA Posted May 9, 2016 Moderators Posted May 9, 2016 else if In lua you have to write it like this: elseif
MasKPro Posted May 9, 2016 Author 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?
MACIEKW89 Posted May 9, 2016 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
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