Jump to content
  • Global

    Global

    Chatroom Rules

    • NO SE DA SOPORTE EN CHATBOX
    • NO SPAM
    • NO FLOOD

Recommended Posts

  • Usuario
Posted (edited)

Buenas. Quisiera saber porque cuando una persona vuela arriba de un marker, el mismo abre el panel. Sin estar dentro del marker, si no por encima?

 

Lua:

       function vpspawner(hitElement)
       
    if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
           if getPlayerTeam(hitElement) == getTeamFromName("Staff") then
           if not isPedInVehicle(hitElement) then
    if not guiGetVisible(GUIEditor.window[1]) then
        guiSetVisible(GUIEditor.window[1], true)
                      showCursor(true)
                  end
                  end
                                    else
outputChatBox("Acceso denegado", 255, 0, 0 )
               end
                  end
             end
        addEventHandler("onClientMarkerHit", StaffCoche1, vpspawner, false) 
        addEventHandler("onClientMarkerHit", StaffCoche2, vpspawner, false) 
        addEventHandler("onClientMarkerHit", StaffCoche3, vpspawner, false) 

Digamos que pongo el marker en el centro de Groove Street. y cuando pasa un Player volando a miles de kilometros arriba del marker, el panel se abre como si entrar a el. Que sucede aqui? :unsure:

 

EDIT: El "false" que tiene al final el EventHandler de onClientMarkerHit lo añadi yo, porque creia que era igual que las gui's que si no le pones el false se activa X Boton sin dar click en el. Pero con o sin el false sigue el problema.

 

 

- Gracias de Antemano. :)

Edited by Sergioks
  • Ex-Staff
Posted

Los markers se activan cuando la persona esta dentro del rango visto en un plano X,Y ( Por lo tanto no toma en cuenta la altura ), si quieres evitar que se active cuando esta volando encima de este, vas a tener que obtener la posición del jugador y ver si es que la altura coincide con el area del marcador.

  • Usuario
Posted

Los markers se activan cuando la persona esta dentro del rango visto en un plano X,Y ( Por lo tanto no toma en cuenta la altura ), si quieres evitar que se active cuando esta volando encima de este, vas a tener que obtener la posición del jugador y ver si es que la altura coincide con el area del marcador.

Ok.... como hago eso? :huh:

  • Ex-Staff
Posted

simple, verifica la posición del marcador usando

getElementPosition()

lo mismo con el jugador y verifica si la coordenada número 3 es la misma que la del marcador.

 

Para que no te calientes la calientes la cabeza te lo dejo para que aprendas xd

function vpspawner(hitElement)       
	if source == StaffCoche1 or source == StaffCoche2 or source == StaffCoche3 then
		if getElementType(hitElement) == "player" and (hitElement == localPlayer) then
			local x,y,z = getElementPosition(hitElement)
			local mx,my,mz = getElementPosition(source)
			if z == mz then
				if getPlayerTeam(hitElement) == getTeamFromName("Staff") then
					if not isPedInVehicle(hitElement) then
						if not guiGetVisible(GUIEditor.window[1]) then
						guiSetVisible(GUIEditor.window[1], true)
							showCursor(true)
						end
					end                  
				else
					outputChatBox("Acceso denegado", 255, 0, 0 )
				end	
			end
		end
	end	
end
addEventHandler("onClientMarkerHit", root, vpspawner)

Le hice unas pequeñas modificaciones, pero con eso debería andar.

  • Ex-Staff
Posted

es recomendable hacer que se active en cierto rango y no en la posición exacta del marker, ya que puede tender a fallar en ciertos casos

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...