//_Dragon Posted December 15, 2015 Share Posted December 15, 2015 i want make aclgetgroup : Admin & Console & S.mod this is the script but doesnt work function shout ( player, cmd, ... ) local accountname = getAccountName ( getPlayerAccount ( player ) ) elseif if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) elseif if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Console" ) ) elseif if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "SuperModerator" ) ) then Link to comment
Captain Cody Posted December 15, 2015 Share Posted December 15, 2015 What exactly are yeh trying to do? Link to comment
//_Dragon Posted December 15, 2015 Author Share Posted December 15, 2015 What exactly are yeh trying to do? I want make Only Admin & console & SuperMod can shout Link to comment
Captain Cody Posted December 15, 2015 Share Posted December 15, 2015 function shout ( player, cmd, ... ) local accountname = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ( "user.".. accountname, aclGetGroup ( "Admin" ) ) or isObjectInACLGroup ( "user." ..accountname, aclGetGroup ( "Console" ) ) or isObjectInACLGroup ( "user." ..accountname, aclGetGroup ( "SuperModerator" ) ) then Link to comment
//_Dragon Posted December 15, 2015 Author Share Posted December 15, 2015 Thanks dude work perfect Link to comment
Dealman Posted December 15, 2015 Share Posted December 15, 2015 If you for some reason don't wanna use the or operator, this is how you properly make use of if statements in Lua; function shout(player, cmd, ...) local accountname = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup("user." .. accountname, aclGetGroup("Admin")) then -- If true, code here -- If false, check next if statement elseif isObjectInACLGroup("user." .. accountname, aclGetGroup("Console")) then -- If true, code here -- If false, check next if statement elseif isObjectInACLGroup("user." .. accountname, aclGetGroup("SuperModerator")) then -- If true, code here else -- If all above if statements fail, you can use else outputChatBox("You do not have permission to use this command!", player, 187, 0, 0) end end Things to note; • if and elseif both need to end with then otherwise it will return an error. • else does not require then as it is used if the previous if statements failed. Link to comment
Captain Cody Posted December 15, 2015 Share Posted December 15, 2015 Well he wanted it so only a certain group could use it, so or works just fine in this situation. Link to comment
//_Dragon Posted December 15, 2015 Author Share Posted December 15, 2015 Doesnt work dude Link to comment
//_Dragon Posted December 15, 2015 Author Share Posted December 15, 2015 I fixe it ! thx Link to comment
Dealman Posted December 15, 2015 Share Posted December 15, 2015 Well he wanted it so only a certain group could use it, so or works just fine in this situation. I'm well aware of this. But the title of the thread is "Ho i can make elseif in script ?", and since he didn't seem to know how to properly structure the if statements - I thought I'd help him out. I never said your method does not work. 1 Link to comment
//_Dragon Posted December 15, 2015 Author Share Posted December 15, 2015 Ok dude Bro can u help me ? chack this topic ok https://forum.multitheftauto.com/viewtopic.php?f=91&t=94962 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