Jump to content

[FIXED] getLocalPlayer() - a nil value


TheGamingMann

Recommended Posts

Posted (edited)

I am not quite sure what is going on. But my script keeps giving me this error and its not working.

Here's my code:

function cancelDamage() 
    cancelEvent() 
end 
addEventHandler("onClientDamage", getLocalPlayer(), cancelDamage) 
  

This is a client side script as well.

Edited by Guest
Posted
addEventHandler ( "onClientPlayerDamage", getRootElement(), cancelEvent ) 

Should work aswell;

addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), cancelEvent ) 

It's just the event name as Anubhav mentioned.

Posted
function cancelEvent() 
    cancelEvent() 
    setElementHealth(getRootElement(), 100) 
    outputChatBox("Test") 
end 
addEventHandler("onClientPlayerDamage", getRootElement(), cancelEvent) 

Thats the new code. None of those in the function are running. Here is my meta.xml

    "TheGamingMann" name="Server Info" version="1.0" description="Sets the server info on resource start."/> 
  
    

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