Jump to content

Problema con funcion de Spectador


Hukaeshi

Recommended Posts

Hola buenas, tengo un problema estoy creando un panel para mi servidor, entonces lo que yo quiero hacer es que cuando yo me seleccione  en la GridList no me deje spectarme ami pero si a los demas y que me bote un mensaje que diga "No puedes spectarte a ti mismo".

 

function spectatePlayer(thePlayer)
	local player = getPlayerFromName(thePlayer)
	local target = getCameraTarget(source)
	if (target == source) then
		local x, y, z = getElementPosition(source)
		sourcePos[source] = {x, y, z}
		sourceDim[source] = getElementInterior(source)
		sourceINT[source] = getElementDimension(source)
		setCameraTarget(source, player)
		setElementInterior(source, getElementInterior(player))
		setElementDimension(source, getElementDimension(player))
		setElementFrozen(source, true)
		toggleControl ( source, "fire", false )
		toggleControl ( source, "aim_weapon", false )
		toggleControl ( source, "next_weapon", false )
		toggleControl ( source, "previous_weapon", false )
		toggleControl ( source, "walk", false )
		toggleControl ( source, "jump", false )
		toggleControl ( source, "sprint", false )
		toggleControl ( source, "forwards", false )
		toggleControl ( source, "backwards", false )
		toggleControl ( source, "left", false )
		toggleControl ( source, "right", false )
		outputChatBox("#FF0000Moderador: #55FF00Estas espectando a "..getPlayerName(player)..".", source, 255, 225, 255, true)
	elseif (not (target == source)) then
		setCameraTarget(source)
		setElementFrozen(source, false)
		toggleControl ( source, "fire", true )
		toggleControl ( source, "aim_weapon", true )
		toggleControl ( source, "next_weapon", true )
		toggleControl ( source, "previous_weapon", true )
		toggleControl ( source, "walk", true )
		toggleControl ( source, "jump", true )
		toggleControl ( source, "sprint", true )
		toggleControl ( source, "forwards", true )
		toggleControl ( source, "backwards", true )
		toggleControl ( source, "left", true )
		toggleControl ( source, "right", true )
		outputChatBox("#FF0000Moderador: #55FF00Ya no estas espectando.", source, 255, 225, 255, true)
		setElementPosition(source, sourcePos[source][1], sourcePos[source][2], sourcePos[source][3])
		setElementInterior(source, sourceDim[source])
		setElementDimension(source, sourceINT[source])
		sourcePos[source] = nil
		sourceDim[source] = nil
		sourceINT[source] = nil
	end
end
addEvent("Spectar", true)
addEventHandler("Spectar", root, spectatePlayer)

 

Link to comment
Hola, podrias crear una condición para que directamente tu no aparezcas en dicha gridlist aca de dejo un ejemplo:

   for i, players in ipairs(getElementsByType("player")) do
 	  if(players ~= localPlayer) then
            row = guiGridListAddRow( gridlist )
            --guiGridListSetItemText(...)
        end    
    end

 

Link to comment
30 minutes ago, Hukaeshi said:

asi seria la unica solucion? es que es un panel de moderador y el staff tambien debe darse cosas xD

Osea quisiera solo desactivar el boton espectar de mi panel solo para el jugador local y solo funcione para los demas

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