CeKiT Posted September 29, 2012 Share Posted September 29, 2012 Hola comunidad. Como hago para que al morir un jugador spectee a jugadores que esten vivos. Osea que no quede specteando un cuerpo muerto, y al jugador que esta specteando que esta vivo y si muere specteee a otro vivo. Gracias Link to comment
BorderLine Posted September 29, 2012 Share Posted September 29, 2012 Ejemplo de la Wiki: g_Players = getElementsByType("player") -- get a list of all players in the server for i,aPlayer in ipairs(g_Players) do -- find out what index the local player has in the list if aPlayer == getLocalPlayer() then g_CurrentSpectated = i break end end function spectatePrevious() -- decrement the spectate index and spectate the corresponding player if g_CurrentSpectated == 1 then g_CurrentSpectated = #g_Players else g_CurrentSpectated = g_CurrentSpectated - 1 end setCameraTarget(g_Players[g_CurrentSpectated]) end function spectateNext() -- increment the spectate index and spectate the corresponding player if g_CurrentSpectated == #g_Players then g_CurrentSpectated = 1 else g_CurrentSpectated = g_CurrentSpectated + 1 end setCameraTarget(g_Players[g_CurrentSpectated]) end -- Bind above functions to arrow keys bindKey("arrow_l", "down", spectatePrevious) bindKey("arrow_r", "down", spectateNext) Y para lo que quieres, nose si funcione en la primera linea en vez de g_Players = getElementsByType("player") usa g_Players = getAlivePlayers () y deberas editarlo con el evento onPlayerWasted Link to comment
CeKiT Posted September 30, 2012 Author Share Posted September 30, 2012 Listo, pero de casualidad sabes donde esta la camara actual del stealth para sustituirlo por este? Link to comment
BorderLine Posted September 30, 2012 Share Posted September 30, 2012 la verdad no man, nunca e mirado ese gamemode. Deberias buscar dentro de serverside las funciones de camara y quisas la encuentres Link to comment
CeKiT Posted September 30, 2012 Author Share Posted September 30, 2012 Por lo visto es esto: function spectateNext (source) -- THIS IS THE FUNCTION USED TO SWICH WHO IS BEING SPECTATED BY PRESSING R if playingaround == 1 then -- IF A ROUND IS IN PROGRESS if ( isPedDead ( source ) ) then --IF THE PLAYER IS DEAD local specPlayer = getPlayerSpectatee[source] -- gets the spectatee player if not specPlayer then specPlayer = 1 spectators[source] = true end local deadplayerTeam = getPlayerTeam(source) local playersTable = getPlayersInTeam ( deadplayerTeam ) playersTable = filterPlayersTable ( playersTable ) -- local playerCount = #playersTable if playerCount == 0 then outputSpectateMessage("No hay nadie para mirar.",source) -- IF ITS JUST THE 1 PLAYER, SPECTATING IS IMPOSSIBLE else specPlayer = specPlayer+1 while isPedDead ( playersTable[specPlayer] ) do specPlayer = specPlayer+1 end if specPlayer > playerCount then specPlayer = 1 end setCameraMode ( source, "player" ) setCameraTarget ( source, playersTable[specPlayer] ) outputSpectateMessage("Esta viendo a "..getPlayerName(playersTable[specPlayer]),source) getPlayerSpectatee[source] = specPlayer end end end end function outputSpectateMessage(text,source) triggerClientEvent(source,"showSpectateText",source,text,true) end Pero que debo editar Link to comment
Recommended Posts