Luther123 Posted January 14, 2012 Share Posted January 14, 2012 HI,i would like to ask on how to keep them with their team when they die.. because for me when i and other players die i lose my team and i have to manually set my team to admin panel. Please help me out :3 Thanks. Link to comment
arezu Posted January 14, 2012 Share Posted January 14, 2012 use autoteams resource from community Link to comment
Castillo Posted January 14, 2012 Share Posted January 14, 2012 -- server side: addEventHandler("onPlayerWasted",root, function () local team = getPlayerTeam(source) if (team) then setElementData(source, "tempTeam", tostring(getTeamName(team))) end end) addEventHandler("onPlayerSpawn",root, function () local teamName = getElementData(source, "tempTeam") if (not teamName) then return end local team = getTeamFromName(teamName) if (team) then setPlayerTeam(source, team) end removeElementData(source, "tempTeam") end) Link to comment
Luther123 Posted January 14, 2012 Author Share Posted January 14, 2012 err it didnt work Link to comment
Castillo Posted January 14, 2012 Share Posted January 14, 2012 Maybe one of your script's is messing with it, post your spawning script. Link to comment
Luther123 Posted January 14, 2012 Author Share Posted January 14, 2012 you mean the thing that spawns you when you log in? here it is spawnTeam = createTeam ("Unemployed", 205, 201, 201) function spawnOnLogin (prevA, curA, autoLogin) outputChatBox ("Welcome to SAAR:RPG", source, 255, 0, 0, false) spawnPlayer (source,1683.7286376953, -2248.0695800781, 13.550338745117, 0, math.random (0,288), 0, 0, spawnTeam) fadeCamera (source, true) setCameraTarget (source, source) end addEventHandler("onPlayerLogin", getRootElement(), spawnOnLogin) Link to comment
Castillo Posted January 14, 2012 Share Posted January 14, 2012 No, I mean when you get killed, it must have a respawn system. Link to comment
Luther123 Posted January 15, 2012 Author Share Posted January 15, 2012 No, I mean when you get killed, it must have a respawn system. oh here: addEventHandler( "onPlayerWasted", getRootElement( ), function() setTimer(spawnPlayer (source,1176.6987304688, -1323.3176269531, 14.034188270569, 0, math.random (0,288) end ) Link to comment
Castillo Posted January 15, 2012 Share Posted January 15, 2012 addEventHandler("onPlayerWasted",root, function () setTimer(spawnPlayer, 2000, 1, source,1176.6987304688, -1323.3176269531, 14.034188270569, 0, math.random (0,288)) local team = getPlayerTeam(source) if (team) then setElementData(source, "tempTeam", tostring(getTeamName(team))) end end) addEventHandler("onPlayerSpawn",root, function () local teamName = getElementData(source, "tempTeam") if (not teamName) then return end local team = getTeamFromName(teamName) if (team) then setTimer(setPlayerTeam,6000,1,source, team) end removeElementData(source, "tempTeam") end) Link to comment
Luther123 Posted January 16, 2012 Author Share Posted January 16, 2012 addEventHandler("onPlayerWasted",root, function () setTimer(spawnPlayer, 2000, 1, source,1176.6987304688, -1323.3176269531, 14.034188270569, 0, math.random (0,288)) local team = getPlayerTeam(source) if (team) then setElementData(source, "tempTeam", tostring(getTeamName(team))) end end) addEventHandler("onPlayerSpawn",root, function () local teamName = getElementData(source, "tempTeam") if (not teamName) then return end local team = getTeamFromName(teamName) if (team) then setTimer(setPlayerTeam,6000,1,source, team) end removeElementData(source, "tempTeam") end) Thanks Alot Man 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