Jump to content

players kill each other same time


Dice

Recommended Posts

addEventHandler( "onPlayerWasted", getRootElement(), 
    function( totalammo, killer, killerWeapon, bodypart ) 
        if isElementWithinColShape ( source, arena ) then 
            local detection = isElementWithinColShape ( source, arena ) 
            local detectionKiller = isElementWithinColShape ( killer, arena ) 
            if detection then 
                if close == 1 then 
                    local dx, dy, dz = unpack(randspawn[math.random(#randspawn)]) 
                    setTimer( setElementPosition, 4550, 1, source, dx, dy, dz ) 
                    setTimer ( setElementHealth, 1000, 6, source, 200 ) 
                else 
                    setTimer( setElementPosition, 4550, 1, source, 577.92224121094, -2621.6677246094, 1378.0678710938 ) 
                    setTimer ( setElementRotation, 4550, 1, source, 0, 0, 180 ) 
                end 
                if detectionKiller then 
                    if getElementHealth ( killer ) < 200 and getElementHealth ( killer ) > 1  then 
                        setElementHealth ( killer, 200 ) 
                    elseif isPedDead ( killer ) then 
                        local dx, dy, dz = unpack(randspawn[math.random(#randspawn)]) 
                        setTimer( setElementPosition, 4550, 1, killer, dx, dy, dz ) 
                    end 
                end 
            end 
        end 
    end 
) 

There is a bug where when someone kills each other their screen is stuck moving up ( which is part of gta when someone dies ) but I just want to prevent that. basically where you see this line elseif isPedDead ( killer ) notice how I didn't set the health there, because I think it has something to do when it sets the health when they are already dead. but rememeber it only happenes when someone kills each other at the same time. do i add elseif isPedDead ( source ) and isPedDead ( killer ) ?

Link to comment
  • Moderators

What will happen when you spawn him and set him to another dimension?

Well then you should try camera matrix, and that also means you have to create your own camera system.

Btw:

if --[[getElementHealth ( killer ) < 200 and]] getElementHealth ( killer ) > 1  then -- why check a player health a both the 200? max is 200, can't be higher. 

Link to comment

No the camera isn't the problem. The issue was that they stayed in that state after the source dies when they killed each other at the same time.

The answer is your BTW : idon't know why I did that. thanks for pointing that out. I think that is the issue for now.

Link to comment
  • Moderators

I don't get it. State?

You mean they get forced to stand still and they aren't on the ground when you kill them?

or

you mean stop the kill when they kill each other and only the one who dies as last won't die?

Well spawn the player instead of reset the health. (spawnPlayer)

Link to comment

What happens is that when a player kills each other simultaneously, the player falls on the ground dead and the camera goes up (don't you know what happens when you die in Grand Theft Auto San Andreas?) but it doesn't respawn the player, the camera keeps going up and up. I think this was more clear than the OP's explanation.

Link to comment

(don't you know what happens when you die in Grand Theft Auto San Andreas?)

i just said like in gta.....

The issue is not the camera the issue is the player never spawns. yes I know spawnPlayer isn't in here but it is in another script.

They just stay dead for ever even setCameraTarget won't work all that will do is set the camera around the dead body. anyways this is only happening when the play dies at the same time. but I think i have fixed it, i still need to test it out with someone. If it doesn't work I will come back or think something else.

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