Jump to content

spawnPlayer


Lloyd Logan

Recommended Posts

Posted

How do i make it so that when a player dies, they have to wait until everyone dies except one player (thesurvivor), then everyone spawns together?

Thanks Lloyd

If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE

SCOTLAND, my hometown, and the Home of GTA!

Posted

How will thesurvivor be selected, i mean how you will make the script select thesurvivor?

What about if thesurvivor dead before everyone?

-- Server Side --

-- thesurvivor should be defined somewhere. 
addEventHandler("onPlayerWasted", root, 
function() 
    local alivePlayers = getAlivePlayers() 
    if source == thesurvivor then 
        -- thesurvivor dead, do something.. 
    elseif #alivePlayers == 1 and alivePlayers[1] == thesurvivor then 
        -- everyone dead, except thesurvivor. 
        for i, player in ipairs(getElementsByType("player")) do -- get all players. 
            spawnPlayer(player, x, y, z) -- spawn all players. 
            setCameraTarget(player) -- make the camera follow him. 
        end 
    end 
end) 

CiTLh.png
Posted
How will thesurvivor be selected, i mean how you will make the script select thesurvivor?

What about if thesurvivor dead before everyone?

-- Server Side --

-- thesurvivor should be defined somewhere. 
addEventHandler("onPlayerWasted", root, 
function() 
    local alivePlayers = getAlivePlayers() 
    if source == thesurvivor then 
        -- thesurvivor dead, do something.. 
    elseif #alivePlayers == 1 and alivePlayers[1] == thesurvivor then 
        -- everyone dead, except thesurvivor. 
        for i, player in ipairs(getElementsByType("player")) do -- get all players. 
            spawnPlayer(player, x, y, z) -- spawn all players. 
            setCameraTarget(player) -- make the camera follow him. 
        end 
    end 
end) 

So is this a valid script or just an "along the lines" example?

If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE

SCOTLAND, my hometown, and the Home of GTA!

Posted
So is this a valid script or just an "along the lines" example?
How will thesurvivor be selected, i mean how you will make the script select thesurvivor?

What about if thesurvivor dead before everyone?

CiTLh.png

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