Jump to content

[HELP] respawn


Avagard

Recommended Posts

hello! i want to fix a problem.

when player dies and his teammates are dead too i want them to respawn

i tried to do it but instead the window of spectating shows basically it does not trigger 

server:

function RestartRoundLobby1CT()
local players = getElementsByType ( "player" )
for theKey,thePlayers in ipairs ( players ) do
  if getElementDimension ( thePlayers ) == 0 then
    if getElementData ( thePlayers , "alive" ) == false then
	    randomSpawnT1( source, randomSpawnTableT1 )
     end
   end 
 end
end
addEvent("RestartRoundLobby1CT",true)
addEventHandler ( "RestartRoundLobby1CT", root, RestartRoundLobby1CT )    	         
	
addEventHandler( "onPlayerWasted", getRootElement( ),
	function()
		setElementData(source,"alive",false)
	end
)	
	
	
	

client

function getTeamPlayersSpectate1()
local player = getLocalPlayer()
local players = getElementsByType ( "player" )
for theKey,thePlayers in ipairs ( players ) do
  if getElementDimension ( thePlayers ) == 0 then
    if not getElementData ( thePlayers , "alive" ) == true then
	  triggerServerEvent("RestartRoundLobby1CT",player)
	    else
		 guiSetVisible (dead.label[1],true)
          guiSetVisible (dead.window[1],true)
		   showCursor(true)
             guiGridListAddRow(dead.gridlist[1])
	           guiGridListSetItemText(dead.gridlist[1], 0, 1, getPlayerName(thePlayers), false, false)
                 end
           end 
      end
end
addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), getTeamPlayersSpectate1 )      

please help

Edited by Avagard
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...