Jump to content

spawns in game


Recommended Posts

Well here is it.

addEventHandler("onResourceStart", resourceRoot, 
    function() 
        for i,player in ipairs(getElementsByType("player")) do 
            spawn(player) 
        end 
    end 
) 
  
function spawn(player) 
    repeat until spawnPlayer ( player, -711+math.random(1,5), 957+math.random(5,9), 12.4, 90, math.random(9,288) ) 
    fadeCamera(player, true) 
    setCameraTarget(player, player) 
end 
  
addEventHandler("onPlayerJoin", root, 
    function() 
        spawn(source) 
    end 
) 
  
addEventHandler("onPlayerWasted", root, 
    function() 
        setTimer(spawn, 1800, 1, source) 
    end 
) 

Do you think you could tell me what to edit? I've tryed multiple times.

Link to comment

Well here is it.

addEventHandler("onResourceStart", resourceRoot,    function()        for i,player in ipairs(getElementsByType("player")) do            spawn(player)        end    end) function spawn(player)    repeat until spawnPlayer ( player, -711+math.random(1,5), 957+math.random(5,9), 12.4, 90, math.random(9,288) )    fadeCamera(player, true)    setCameraTarget(player, player)end addEventHandler("onPlayerJoin", root,    function()        spawn(source)    end) addEventHandler("onPlayerWasted", root,    function()        setTimer(spawn, 1800, 1, source)    end)

Do you think you could tell me what to edit? I've tryed multiple times.

Link to comment
function playerDied( ammo, attacker, weapon, bodypart )
	gDiedX, gDiedY, gDiedZ= getElementPosition(source) -- We save wheres he/she dies
end
addEventHandler("onPlayerWasted", getRootElement(), playerDied)

You need to research more at the wiki.

You can edit the arguments in spawnPlayer( player, -711+math.random(1,5), 957+math.random(5,9), 12.4, 90, math.random(9,288) ) and set the arguments what you need. Example: You can set there the players pos in the last death IF he/she died.

(x=blue, y=green, z=red)

https://wiki.multitheftauto.com/wiki/SpawnPlayer

Link to comment
function playerDied( ammo, attacker, weapon, bodypart )
	gDiedX, gDiedY, gDiedZ= getElementPosition(source) -- We save wheres he/she dies
end
addEventHandler("onPlayerWasted", getRootElement(), playerDied)

You need to research more at the wiki.

You can edit the arguments in spawnPlayer( player, -711+math.random(1,5), 957+math.random(5,9), 12.4, 90, math.random(9,288) ) and set the arguments what you need. Example: You can set there the players pos in the last death IF he/she died.

(x=blue, y=green, z=red)

https://wiki.multitheftauto.com/wiki/SpawnPlayer

Link to comment
function playerDied( ammo, attacker, weapon, bodypart )
	gDiedX, gDiedY, gDiedZ= getElementPosition(source) -- We save wheres he/she dies
end
addEventHandler("onPlayerWasted", getRootElement(), playerDied)

You need to research more at the wiki.

You can edit the arguments in spawnPlayer( player, -711+math.random(1,5), 957+math.random(5,9), 12.4, 90, math.random(9,288) ) and set the arguments what you need. Example: You can set there the players pos in the last death IF he/she died.

(x=blue, y=green, z=red)

https://wiki.multitheftauto.com/wiki/SpawnPlayer

Big mistake. If you have this code and two players die within a short while, they will both spawn at one location. Use a table, for example table[player][x,y,z]

Link to comment
function playerDied( ammo, attacker, weapon, bodypart )
	gDiedX, gDiedY, gDiedZ= getElementPosition(source) -- We save wheres he/she dies
end
addEventHandler("onPlayerWasted", getRootElement(), playerDied)

You need to research more at the wiki.

You can edit the arguments in spawnPlayer( player, -711+math.random(1,5), 957+math.random(5,9), 12.4, 90, math.random(9,288) ) and set the arguments what you need. Example: You can set there the players pos in the last death IF he/she died.

(x=blue, y=green, z=red)

https://wiki.multitheftauto.com/wiki/SpawnPlayer

Big mistake. If you have this code and two players die within a short while, they will both spawn at one location. Use a table, for example table[player][x,y,z]

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