Jump to content

Give Noob-Players Godmode.


Karuzo

Recommended Posts

Posted

Hey Guys,

i have pulled out my old godmode script out , but i want to add that the people who are downloading have godmode...

I didn't found anything on the wiki , such as functions or an event...

My Code :

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("--TEXT--",thePlayer,0,255,0) 
    else 
        setElementData(thePlayer,"invincible",true) 
        outputChatBox("--TEXT--",thePlayer,0,255,0) 
        end 
    end 
end 
addCommandHandler("godmode",toggleGodMode) 
  
  
  
  
  
  

Posted
godresource=getResourceRootElement(getThisResource()) 
  
function toggleGodMode(thePlayer) 
    if isTransferBoxActive() == true then 
        setElementData(thePlayer,"invincible",true) 
        outputChatBox("--TEXT--",thePlayer,0,255,0) 
    else 
        setElementData(thePlayer,"invincible",false) 
        outputChatBox("--TEXT--",thePlayer,0,255,0) 
    end     
     
end 
addEventHandler("onClientResourceStart",godresource,toggleGodMode) 
  
  
  

Would this work ?

Posted

Not sure or the:

addEventHandler("onClientResourceStart",godresource,toggleGodMode) 

will work. I never tried to attatch it to another resource than the resource where the script is in. (godresource) It has also to check (for example) every 2 seconds or the transferbox is still active, because if the download is done you want to turn the god mode off.

Posted

Edited it , now it checks it , and to the godresource : i defined it above, godresource is the resource which the script is in...

gonna try it now out.

godresource=getResourceRootElement(getThisResource()) 
  
function toggleGodMode(thePlayer) 
    if isTransferBoxActive() == true then 
        setTimer(toggleGodMode,2000,1) 
        setElementData(thePlayer,"invincible",true) 
        outputChatBox("--TEXT--",thePlayer,0,255,0) 
    else 
        setElementData(thePlayer,"invincible",false) 
        outputChatBox("--TEXT--",thePlayer,0,255,0) 
    end     
     
end 
addEventHandler("onClientResourceStart",godresource,toggleGodMode) 

Posted

I know, but I meant I never tried to start a function with 'addEventHandler' that is not in the same resource as this 'addEventHandler' is in.

Anyway:

setTimer(toggleGodMode,2000,1) 

Change the code to:

setTimer(toggleGodMode,2000,1, getLocalPlayer()) 

Just because the timer won't send 'thePlayer' if you don't put the player in the timer as argument.

Posted

outputChatBox doesn't have visibleTo argument on the clientside.

Please do not PM me with scripting related question nor support, use the forums instead.

Posted

Client side:

function checkTransfer() 
    if isTransferBoxActive() == true then 
        setTimer(checkTransfer,2000,1) 
        setElementData(localPlayer,"invincible",true) 
        outputChatBox("--TEXT--",0,255,0) 
    else  
        setElementData(localPlayer,"invincible",false) 
        outputChatBox("--TEXT--",0,255,0) 
    end 
end 
addEventHandler("onClientResourceStart",resourceRoot,checkTransfer) 

Sometimes I dream about cheese

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