Jump to content

Help! Small Bug!


Recommended Posts

-

-

CLIENT-SIDE

addEventHandler("onClientPlayerWasted", getRootElement(), 
function () 
  if source == localPlayer then 
    spawnSystem() 
    setElementHealth ( localPlayer, 100 ) 
    triggerServerEvent ( "on.death", localPlayer ) 
  end 
end) 

SERVER-SIDE

function onPlayerDeath() 
takeAllWeapons ( source ) 
end 
addEvent("on.death", true) 
addEventHandler("on.death", getRootElement(), onPlayerDeath)) 

When I spawn as a new character, my health is still 0 and I am basically dead, why?

Link to comment

Well I changed it a little,

CLIENT-SIDE

function spawnSystem() 
--- 
addEvent("openGUI", true) 
addEventHandler("openGUI", getRootElement(), spawnSystem) 

SERVER-SIDE

function onDeath() 
  triggerClientEvent(source, "openGUI", source) 
  takeAllWeapons ( source ) 
end 
addEventHandler("onPlayerWasted", getRootElement(), onDeath) 

Doesn't open GUI when I died?

Link to comment

CLIENT-SIDE

function spawnSystem() 
--- 
addEvent("openGUI", true) 
addEventHandler("openGUI", getRootElement(), spawnSystem) 

SERVER-SIDE

function onDeath() 
  triggerClientEvent(source, "openGUI", source) 
  takeAllWeapons ( source ) 
end 
addEventHandler("onPlayerWasted", getRootElement(), onDeath) 

Link to comment

CLIENT-SIDE

function spawnSystem() 
--- 
addEvent("openGUI", true) 
addEventHandler("openGUI", getRootElement(), spawnSystem) 

SERVER-SIDE

function onDeath() 
  triggerClientEvent(source, "openGUI", getRootElement()) 
  takeAllWeapons (source) 
end 
addEventHandler("onPlayerWasted", getRootElement(), onDeath) 

Link to comment

as Walid told you, do you find this?

--SERVER 
function onDeath() 
    local my_position = {getElementPosition( source )}; 
    local playerSpawn = setTimer(spawnPlayer, 2000, 1, source, unpack(my_position) ); 
    if playerSpawn then 
       triggerClientEvent(source, "openGUI", source); 
       takeAllWeapons ( source );       
    end 
end 
addEventHandler("onPlayerWasted", getRootElement(), onDeath) 

-- CLIENT 
function spawnSystem() 
outputChatBox("I am respawning") 
end 
addEvent("openGUI", true) 
addEventHandler("openGUI", getRootElement(), spawnSystem) 

otherwise I tried your code with outputs and it works perfectly. i don't know but it might be your spawnSystem function

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