Jump to content

Godmode for Admins, SuperModerators and Moderators


xJ4ckk

Recommended Posts

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

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
if  isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Admin" ) ) or  isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Moderator" ) ) or  isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "SuperModerator" ) ) then 


 

Link to comment

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 by loki2143
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...