Hukaeshi Posted March 11, 2018 Share Posted March 11, 2018 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
MaurO^ Posted March 11, 2018 Share Posted March 11, 2018 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
Hukaeshi Posted March 11, 2018 Author Share Posted March 11, 2018 asi seria la unica solucion? es que es un panel de moderador y el staff tambien debe darse cosas Link to comment
Hukaeshi Posted March 11, 2018 Author Share Posted March 11, 2018 30 minutes ago, Hukaeshi said: asi seria la unica solucion? es que es un panel de moderador y el staff tambien debe darse cosas Osea quisiera solo desactivar el boton espectar de mi panel solo para el jugador local y solo funcione para los demas Link to comment
aka Blue Posted March 12, 2018 Share Posted March 12, 2018 Hola @Hukaeshi, Necesitamos el código cliente, sino, poco podemos hacer (o solo la parte en la que se mete a los jugadores en la lista). Como te dijo @Xero~, lo que puedes hacer es una condición if player ~= localPlayer then y que de ahí ponga a todos los de la lista menos al jugador que ha abierto el panel. 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