Enargy, Posted April 4, 2015 Share Posted April 4, 2015 Dimos7 and raysmta never defined the element that executes the code. they put player in the function arguments. you have to make a loop thePlayer = getElementsByType( "player" ) for key, value in ipairs( thePlayer ) do -- your code end Link to comment
KainDepZai Posted April 5, 2015 Author Share Posted April 5, 2015 Thanks NearGreen but it not the code i need ) it still not respawn player in team Assasin Link to comment
Dimos7 Posted April 5, 2015 Share Posted April 5, 2015 function respawn() for k, v in ipairs(getElementsByType("player") do local team = getPlayerTeam(v) local health = getElementHealth(v) if team then if (getTeamName(team) == "Assasin" ) and health < 0 then spawnPlayer(source, 0, 0, 5, 0, math.random(0, 288), 0, 0) setPlayerTeam(source, team) giveWeapon(source, 8, 1) giveWeapon(source, 1, 1) elseif (getTeamName(team) == "Gunner") then spawnPlayer(source, 0, 0, 5, 0 , math.random(0, 288), 0, 0) setPlayerTeam(source, team) end end end end addEventHandler("onResourceStart", root, respawn) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now