Jump to content

Dayz GodMode


stefutz101

Recommended Posts

Hello , yesterday i work at a script what make de admin invincible ( godmode). I dont have errors or warnings , but i can take damange .

Server-side :

  
function setInince(thePlayer) 
    if (hasObjectPermissionTo(thePlayer, "function.banPlayer")) then 
        if (getElementData(thePlayer, "INV") == "true") then 
            setElementData(thePlayer,"INV", "false") 
            outputChatBox("You are no longer Invincible", thePlayer) 
        else 
            setElementData(thePlayer,"INV", "true") 
            outputChatBox("You are now Invincible", thePlayer) 
        end 
    else 
        outputChatBox("You do not have permission for this", thePlayer) 
    end 
end 
addCommandHandler("inv", setInince) 

Client-side

function noadmdamage() 
if (getElementData(source, "INV") == "true") then 
    cancelEvent() 
else 
 end 
end 
addEventHandler("onClientPlayerDamage", getRootElement(), noadmdamage) 
  

Link to comment

dayz blood is not like gta blood so try

client side

function noadmdamage() 
if getElementData(getLocalPlayer(), "INV") == true then 
    setElementData(getLocalPlayer(),"blood",250000) 
 end 
end 
addEventHandler("onClientPlayerDamage", getRootElement(), noadmdamage) 

Link to comment

server:

function noDayZAdminDamge(thePlayer) 
if (hasObjectPermissionTo(thePlayer, "function.banPlayer")) then 
if not getElementData(thePlayer,"inv") == true then 
setElementData(thePlayer,"inv",true) 
outputChatBox("You are now Invincible", thePlayer,255,0,0) 
else 
setElementData(thePlayer,"inv",false) 
outputChatBox("You are no longer Invincible", thePlayer,255,0,0) 
end 
end 
end 
addCommandHandler("inv",noDayZAdminDamge) 

client

function noadmdamage() 
if getElementData(getLocalPlayer(), "inv") == true then 
    setElementData(getLocalPlayer(),"blood",2500000) 
 end 
end 
addEventHandler("onClientPlayerDamage", getRootElement(), noadmdamage) 

Link to comment

Version 1.4.1-9.07378.0 , i try to change version to 1.5 , didn't work . Server stat in 1.4 , i try to change version in mtaserver.conf or someting like that .

I will test now the script , i will edit with the results . Ty

Results : the same problem : "I am invincible but if i jump from a house i take damange . :(

Link to comment

Well i don't know much about Dayz but you can try this:

addEventHandler ( "onElementDataChange", root, 
    function ( name, oldValue ) 
        if name == "blood" then 
            setElementData ( source, name, oldValue ) 
        end 
    end 
) 

(serverside)

Link to comment
Well i don't know much about Dayz but you can try this:
addEventHandler ( "onElementDataChange", root, 
    function ( name, oldValue ) 
        if name == "blood" then 
            setElementData ( source, name, oldValue ) 
        end 
    end 
) 

(serverside)

it will work it will but also cause a C stack overflow

It triggers itself over and over because "setElementData ( source, name, oldValue )" triggers onElementDataChange

and an overflow = lag

ZNk1Xcs.png

Link to comment

@loki

my bad, this should do the trick:

addEventHandler ( "onElementDataChange", root, 
    function ( name ) 
        if name == "blood" and getElementData ( source, name ) ~= 99999 then 
            setElementData ( source, name, 99999 ) 
        end 
    end 
) 

Link to comment

@t3wz

it did :D

and @stefutz101

it should be something like this, thanks to t3wz

  
function setInince(thePlayer) 
    if hasObjectPermissionTo(thePlayer, "function.banPlayer") then 
        if getElementData(thePlayer, "INV") then 
            setElementData(thePlayer,"INV", false) 
            outputChatBox("You are no longer Invincible", thePlayer) 
        else 
            setElementData(thePlayer,"INV", true) 
            outputChatBox("You are now Invincible", thePlayer) 
        end 
    else 
        outputChatBox("You do not have permission for this", thePlayer) 
    end 
end 
addCommandHandler("inv", setInince) 
  
addEventHandler ( "onElementDataChange", root, 
    function ( name ) 
        if getElementData(source, "INV") then 
            if name == "blood" and getElementData ( source, name ) ~= 12000 then 
                setElementData ( source, name, 12000 ) 
            elseif name == "thirst" and getElementData ( source, name ) ~= 100 then 
                setElementData ( source, name, 12000 ) 
            elseif name == "food" and getElementData ( source, name ) ~= 100 then 
                setElementData ( source, name, 100 ) 
            elseif name == "brokenbone" and getElementData ( source, name ) ~= false then 
                setElementData ( source, name, false ) 
            elseif name == "bleeding" and getElementData ( source, name ) ~= 0 then 
                setElementData ( source, name, 0 ) 
            elseif name == "pain" and getElementData ( source, name ) ~= false then 
                setElementData ( source, name, false ) 
            end 
        end 
    end 
) 

everything is server sided

Link to comment

@ loki2143 I want to make a godmode script for admins , when they are onduty they cant get damange . Thank you , you made my work more easy :) Now i can do the script .

Script work but it calculate the diference between blood verry but verry hard and if someone attack you with m4 you are R.I.P. i will stay at setelementdata(theplayer, "blood" , 99999999999999999999999999) :D

Link to comment

Just try this (clientsided):

  
local adminIsInvincible = false 
function setAdminInvincible(ps) 
    if getElementData(ps,"admin") then 
        if not adminIsInvincible then 
            setElementData(ps,"invincible",true) 
            adminIsInvincible = true 
            outputChatBox("You are invincible.",0,255,0) 
        else 
            setElementData(ps,"invincible",false) 
            adminIsInvincible = false 
            outputChatBox("You are not invincible anymore.",255,0,0) 
        end 
    else 
        outputChatBox("You are not an admin!",255,0,0) 
    end 
end 
addCommandHandler("godmode",setAdminInvincible) 
  
function actOutInvincibility() 
    if getElementData(source,"invincible") then 
        setElementData(source,"blood",12000) 
    end 
enda 
addEventHandler("onClientPlayerDamage",root,actOutInvincibility) 
  

The command is /godmode, and you have to be admin (via /add admin ) to become invincible.

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