anufis_ok

Help! It's simple.

Recommended Posts

Help, what's wrong with the code? After the death of the player should be 1 hp.

Quote

function playerDied(killer, weapon, bodypart)
        setElementHealth(player, getElementHealth(player) - 99 )
end
addEventHandler( "onClientPlayerSpawn", getLocalPlayer(), playerDied )

 

Share this post


Link to post
addEventHandler("onClientPlayerSpawn", getLocalPlayer(), function()
        setElementHealth(source, getElementHealth(source) - 99)
end)

 

Edited by 1LoL1

Share this post


Link to post

You can simplify it down even further.

addEventHandler("onClientPlayerSpawn", localPlayer, function()
	setElementHealth(source, 1)
end)

 

Share this post


Link to post
1 hour ago, anufis_ok said:

input:1: attempt to call a nil value (global 'addEventHandler')

Did you add the above code,

8 hours ago, Skully said:

to the client side in meta.xml ??

Edited by DeadthStrock

Share this post


Link to post

<meta>
    <script src="dead.lua" type="server" />
</meta>

I understood what the problem was. It was necessary to deliver (client) instead of (server)
 

Share this post


Link to post

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.