illestiraqi Posted June 2, 2012 Share Posted June 2, 2012 I would like the /gostaff command for the Staff on the ACL Admin Groups, the admin groups such as, Moderator, Super Moderator, and Admin. So basically i want those 3 ACL Staff Groups to have access to the /gostaff command and gives them the boy staff skin. Server Side: function togglestaffMode(thePlayer) local account = getPlayerAccount(thePlayer) if (not account or isGuestAccount(account)) then return end local accountName = getAccountName(account) if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Admin" ) ) ) then if getElementData(thePlayer,"invincible") then setElementData(thePlayer,"invincible",false) outputChatBox("Staff Mode is now off.",thePlayer,255,255,255) else setElementData(thePlayer,"invincible",true) outputChatBox("Staff Mode is now on.",thePlayer,255,255,255) end end end addCommandHandler("gostaff",togglestaffMode) Server Side 2: function createTeamsOnStart () teamstaff = createTeam ( "Staff", 255, 255, 255 ) end addEventHandler("onResourceStart", resourceRoot, createTeamsOnStart) function lol ( player, command ) setPlayerTeam ( player, teamstaff ) setPlayerSkin(player, 217) end addCommandHandler ( "gostaff", lol ) Client Side: addEventHandler ( "onClientPlayerDamage",root, function () if getElementData(source,"invincible") then cancelEvent() end end) addEventHandler("onClientPlayerStealthKill",localPlayer, function (targetPlayer) if getElementData(targetPlayer,"invincible") then cancelEvent() end end) Link to comment
Jaysds1 Posted June 2, 2012 Share Posted June 2, 2012 try this, Server1: function togglestaffMode(thePlayer) local account = getPlayerAccount(thePlayer) if(not isGuestAccount(account)) then if(isObjectInACLGroup ( "user.".. getAccountName(account), aclGetGroup ( "Admin" ) ) ) then if getElementData(thePlayer,"invincible") then setElementData(thePlayer,"invincible",false) outputChatBox("Staff Mode is now off.",thePlayer,255,255,255) else setElementData(thePlayer,"invincible",true) outputChatBox("Staff Mode is now on.",thePlayer,255,255,255) end end end end addCommandHandler("gostaff",togglestaffMode) Link to comment
Smart. Posted June 2, 2012 Share Posted June 2, 2012 try this,Server1: function togglestaffMode(thePlayer) local account = getPlayerAccount(thePlayer) if(not isGuestAccount(account)) then if(isObjectInACLGroup ( "user.".. getAccountName(account), aclGetGroup ( "Admin" ) ) ) then if getElementData(thePlayer,"invincible") then setElementData(thePlayer,"invincible",false) outputChatBox("Staff Mode is now off.",thePlayer,255,255,255) else setElementData(thePlayer,"invincible",true) outputChatBox("Staff Mode is now on.",thePlayer,255,255,255) end end end end addCommandHandler("gostaff",togglestaffMode) How would that work? You still only check for the admin acl group Link to comment
myonlake Posted June 2, 2012 Share Posted June 2, 2012 Server-side local groups = {"Admin", "Moderator", "Super Moderator"} addEventHandler("onResourceStart", resourceRoot, function() teamstaff = createTeam("Staff", 255, 255, 255) end ) addCommandHandler("gostaff", function(player, cmd) local account = getPlayerAccount(player) if isGuestAccount(account) then return end local accountName = getAccountName(account) for i,v in ipairs(groups) do if isObjectInACLGroup("user." .. accountName, aclGetGroup(groups[v])) then if getElementData(player, "invincible") then setElementData(player, "invincible", false) outputChatBox("Staff Mode is now off.", player, 255, 255, 255) else setElementData(player,"invincible",true) outputChatBox("Staff Mode is now on.", player, 255, 255, 255) end if getPlayerTeam(player) ~= teamstaff then setPlayerTeam(player, teamstaff) setPlayerSkin(player, 217) end end end end ) Client-side addEventHandler("onClientPlayerDamage", root, function(attacker, weapon, bodypart, loss) if getElementData(source, "invincible") then cancelEvent() end end ) addEventHandler("onClientPlayerStealthKill", root, function(player) if getElementData(player, "invincible") then cancelEvent() end end ) 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