xJ4ckk Posted December 18, 2016 Share Posted December 18, 2016 CAN ANYONE TELL ME HOW I CAN ALLOW GODMODE FOR ADMINS, SMODS AND MODS? function toggleGodMode(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("#66CC66[GODMODE] #FFFFFFYou have disabled the God Mode.",thePlayer,255,255,255, true) else setElementData(thePlayer,"invincible",true) outputChatBox("#66CC66[GODMODE] #FFFFFFYou have enabled the God Mode.",thePlayer,255,255,255, true) end end end addCommandHandler("godmode",toggleGodMode) Link to comment
Mr.Loki Posted December 18, 2016 Share Posted December 18, 2016 Do this on the client side. onClientPlayerDamage getElementData(source,"invincible") cancelEvent() Link to comment
xJ4ckk Posted December 18, 2016 Author Share Posted December 18, 2016 Yes I have it already but my problem is how i can allow it for Smods and Mods too? READ THE RED TEXT, I ALREADY ALLOWED IT FOR ADMINS BUT I WANT TO ALLOW IT FOR SMODS AND MODS TOO, BUT HOW? function toggleGodMode(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("#66CC66[GODMODE] #FFFFFFYou have disabled the God Mode.",thePlayer,255,255,255, true) else setElementData(thePlayer,"invincible",true) outputChatBox("#66CC66[GODMODE] #FFFFFFYou have enabled the God Mode.",thePlayer,255,255,255, true) end end end addCommandHandler("godmode",toggleGodMode) Link to comment
Kara Posted December 18, 2016 Share Posted December 18, 2016 if isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Admin" ) ) or isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Moderator" ) ) or isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "SuperModerator" ) ) then Link to comment
Mr.Loki Posted December 18, 2016 Share Posted December 18, 2016 (edited) Replace the red text with this custom function if hasPermission(thePlayer) then Add this to the bottom of your code You can set the allowed groups but just separate them with a comma ",". local allowed= "Admin,Moderator,SuperModerator" function hasPermission(player) local ACLs = split(allowed, ',') for _, group in pairs(ACLs)do local ACLgroup = aclGetGroup ( group ) if ACLgroup then local accName = getAccountName(getPlayerAccount( player )) if isObjectInACLGroup ( "user.".. accName, ACLgroup ) then return true end end end end Edited December 18, 2016 by loki2143 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