Jump to content

isPedDead Issue


'LinKin

Recommended Posts

Hello,

I have this:

addEventHandler("onClientPlayerWasted", root, 
function() 
     setTimer(function(thePlayer) 
                         if isPedDead(thePlayer) then 
                              outputChatBox(getPlayerName(thePlayer).." isDead") 
                         else 
                              outputChatBox(getPlayerName(thePlayer).." isNotDead") 
                         end 
                    end, 
      2000, 1, source) 
end) 

When I'm alone in the server (Destruction Derby game-mode) and I die, it shows that I'm dead. So it's right.

But when I'm not alone in the server and I die, it says that I am NOT dead..

If other player dies, it works OK, it shows that he's dead, but it seems it just doesn't work with me, why?

Thanks.

EDIT: I have tried by changing the timer's execution time. It seems that anything >= 2000 won't work. While anything < 2000 would work flawlessly. But I still wonder; Why with other players it works no matter what? (I tried setting the timer to 4000 ms and it still worked for other players).

This script is client-side (obviously), do you think that the Laptop that I'm currently using is causing the trouble? because I don't really see any other reason.

Link to comment

Oh god how would it work even?

You have a extra end,

  
addEventHandler("onClientPlayerWasted", root, 
function() 
     setTimer(function(thePlayer) 
                         if isPedDead(thePlayer) then 
                              outputChatBox(getPlayerName(thePlayer).." isDead") 
                         else 
                              outputChatBox(getPlayerName(thePlayer).." isNotDead") 
                         end 
                    end, 
      2000, 1, source) 
) 
  

Link to comment

Try using this

  
  
addEventHandler("onClientPlayerWasted", localPlayer, 
function() 
     setTimer(function(thePlayer) 
                         if isPedDead(thePlayer) then 
                              outputChatBox(getPlayerName(thePlayer).." isDead") 
                         else 
                              outputChatBox(getPlayerName(thePlayer).." isNotDead") 
                         end 
                    end, 
      2000, 1, source) 
) 
  

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