Jump to content

[HELP] KILL


GrubaS

Recommended Posts

You should check the wiki pages for examples; this is not how setTimer works. The 0 in setTimer will make it execute every 5 seconds, you only need it once.

addCommandHandler("kill", 
function(player) 
    setTimer(setElementHealth, 5000, 1, player, 0) 
end) 

Link to comment

Hello again, i wanted make kill on Bind (enter). I don't know what write in client ;(

server.lua

addEvent('KillPlayer', true) 
addEventHandler('KillPlayer', resourceRoot, 
function(player, resourceRoot) 
        if not source == resourceRoot then return end 
        setTimer(setElementHealth, 5000, 1, player, 0) 
end) 

client.lua

function kill() 
        triggerServerEvent('KillPlayer', resourceRoot) 
end 
addCommandHandler('kill',kill) 
addCommandHandler('Commit suicide',kill) 
bindKey ( next(getBoundKeys"enter_exit"), "down", "Commit suicide" ) 

Link to comment

You don't need to trigger a server event; setElementHealth is both server and client side. And you don't need that second command.

Also, why are you using next and getBoundKeys? You only need to specify the key that should be bound which is 'enter'.

Client side:

function kill() 
        setTimer(setElementHealth, 5000, 1, localPlayer, 0) 
end 
addCommandHandler('kill',kill) 
bindKey ( "enter", "down", "kill" ) 

Link to comment
  
function kill ( player ) 
    setTimer ( setElementHealth, 5000, 1, player, 0 ) 
end 
  
addEventHandler ( "onPlayerJoin", root, 
    function ( ) 
        bindKey ( source, "enter", "down", kill ) 
    end 
) 

It's serverside code.

Edited by Guest
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...