Jump to content

admin god mode


zombienation

Recommended Posts

Hi,

I don't know if someone have allready made this script.

But i think you can made it youself ;)

Example, when the player are domaged, we check if is an admin and if it's an admin, we cancel the event.

So he are not domaged :D

I think it work...

  
addEventHandler ( "onPlayerDamage", getRootElement (), 
function(attacker, weapon, bodypart, loss) 
    local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name 
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
        cancelEvent() 
    end 
end 
  

Link to comment
  • Other Languages Moderators
Hi,

I don't know if someone have allready made this script.

But i think you can made it youself ;)

Example, when the player are domaged, we check if is an admin and if it's an admin, we cancel the event.

So he are not domaged :D

I think it work...

  
addEventHandler ( "onPlayerDamage", getRootElement (), 
function(attacker, weapon, bodypart, loss) 
    local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name 
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
        cancelEvent() 
    end 
end 
  

no it's not work, the event can't be canceled.

https://wiki.multitheftauto.com/wiki/OnPlayerDamage

It should also be noted that canceling this event has no effect. Cancel the client-side event onClientPlayerDamage instead.

Link to comment

@UP

Hmm You think that's working?

addEventHandler ( "onClientPlayerDamage", getRootElement (), 
function(attacker, weapon, bodypart, loss) 
    local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name 
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
        cancelEvent() 
    end 
end 

Link to comment
  
addEventHandler ( "onPlayerDamage", getRootElement (), 
function(attacker, weapon, bodypart, loss) 
    local thePlayer = getPlayerName ( thePlayer ) 
    local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name 
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
    setElementHealth ( thePlayer , 100 )   
    end 
end 

You can instead set his health to 100...

Link to comment
  • Other Languages Moderators
@UP

Hmm You think that's working?

addEventHandler ( "onClientPlayerDamage", getRootElement (), 
function(attacker, weapon, bodypart, loss) 
    local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name 
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
        cancelEvent() 
    end 
end 

No, because the functions:

getAccountName 
getPlayerAccount 
isObjectInACLGroup 
aclGetGroup 

is server-side, and the event 'onClientPlayerDamage' is Client-side

Link to comment

server side

function admin () 
 local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name 
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
setElementData(source,"admin",true) 
end 
 end  
  
addEventHandler("onPlayerLogin",resourceRoot,admin) 

client side

addEventHandler ( "onClientPlayerDamage", getRootElement (), 
function(attacker, weapon, bodypart, loss) 
    if getElementData(source,"admin") then 
        cancelEvent() 
    end 
end) 

Link to comment
server side
function admin () 
 local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name 
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
setElementData(source,"admin",true) 
end 
 end  
  
addEventHandler("onPlayerLogin",resourceRoot,admin) 

client side

addEventHandler ( "onClientPlayerDamage", getRootElement (), 
function(attacker, weapon, bodypart, loss) 
    if getElementData(source,"admin") then 
        cancelEvent() 
    end 
end) 

Fuccckin pro o_O

Link to comment

-- server side:

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("God Mode is now Disabled.",thePlayer,0,255,0) 
    else 
        setElementData(thePlayer,"invincible",true) 
        outputChatBox("God Mode is now Enabled.",thePlayer,0,255,0) 
        end 
    end 
end 
addCommandHandler("godmode",toggleGodMode) 

-- 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
-- server side:
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("God Mode is now Disabled.",thePlayer,0,255,0) 
    else 
        setElementData(thePlayer,"invincible",true) 
        outputChatBox("God Mode is now Enabled.",thePlayer,0,255,0) 
        end 
    end 
end 
addCommandHandler("godmode",toggleGodMode) 

-- 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) 

Castillo comes and fucck everybody :) Great :shock:

Link to comment
  • 2 weeks later...

hey,

i have added a part for godmode for moderators in it :)

original /godmode command for admins is still the same

command for moderators is /god

here is server script

thx again solidsnake

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("God Mode is now Disabled.",thePlayer,0,255,0)

else

setElementData(thePlayer,"invincible",true)

outputChatBox("God Mode is now Enabled.",thePlayer,0,255,0)

end

end

end

addCommandHandler("godmode",toggleGodMode)

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 ( "Moderator" ) ) ) then

if getElementData(thePlayer,"invincible") then

setElementData(thePlayer,"invincible",false)

outputChatBox("God Mode is now Disabled.",thePlayer,0,255,0)

else

setElementData(thePlayer,"invincible",true)

outputChatBox("God Mode is now Enabled.",thePlayer,0,255,0)

end

end

end

addCommandHandler("god",toggleGodMode)

Link to comment

Very messed, lemme help.

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" ) ) or isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Moderator" ) ) then 
        setElementData(thePlayer,"invincible",not getElementData(thePlayer,"invincible")) 
        if getElementData(thePlayer,"invincible") then outputChatBox("God Mode is now Disabled.",thePlayer,0,255,0) 
        else outputChatBox("God Mode is now Enabled.",thePlayer,0,255,0) end 
    end 
    addCommandHandler("godmode",toggleGodMode) 
    addCommandHandler("god",toggleGodMode) 

Link to comment
Very messed, lemme help.
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" ) ) or isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Moderator" ) ) then 
        setElementData(thePlayer,"invincible",not getElementData(thePlayer,"invincible")) 
        if getElementData(thePlayer,"invincible") then outputChatBox("God Mode is now Disabled.",thePlayer,0,255,0) 
        else outputChatBox("God Mode is now Enabled.",thePlayer,0,255,0) end 
    end 
    addCommandHandler("godmode",toggleGodMode) 
    addCommandHandler("god",toggleGodMode) 

ah thx :)

i tried it first to make it work without making the codes double, but here it is now :)

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...