Sign in to follow this  

Help with Warp panel.

Recommended Posts

I Am creating a panel for moderators and I want to implement a warp function a selected player in one GridList to another Player selected in another GridList. But I can't do it.

I Have the following code:


Client Side:

function WarpearJugadores(btn, state)
if source == WarpearOtroJugador then
				local r, c = guiGridListGetSelectedItem (JugadorListadoWarpeo)
				if not r or r == -1 or not c or c == -1 then
					return outputChatBox("#FF0000Moderador: #55FF00Selecciona a un jugador de la lista.", 255, 255, 255, true)
				local WarpData = guiGridListGetItemData (JugadorListadoWarpeo, r, c)
				if not WarpData or not isElement(WarpData) then
					return outputChatBox("#FF0000Moderador: #55FF00El jugador #FFE800"..getPlayerName(WarpData).." #55FF00No existe o no se encuentra conectado.", 255, 255, 255, true)
				player = guiGridListGetItemText(GridJugadores, guiGridListGetSelectedItem(GridJugadores), 1)
				selected2 = guiGridListGetItemText(JugadorListadoWarpeo, guiGridListGetSelectedItem(JugadorListadoWarpeo), 1)
				triggerServerEvent ("WarpOtro", getLocalPlayer(), selected1)
				triggerServerEvent ("WarpOtro", getLocalPlayer(), selected2)
addEventHandler ("onClientGUIClick", root, WarpearJugadores)

Server Side:

function warpearOtro (thePlayer) 
   toggleControl ( source, "radio_next", false )
  toggleControl ( source, "radio_previous", false )
if isPedInVehicle(source) == true then return
outputChatBox("#FF0000Moderador: #55FF00No puedes teletransportarte a un jugador si estas en un vehiculo." , source, 255, 255, 255, true)
local player = getPlayerFromName(thePlayer) 
local x, y, z = getElementPosition(player) 
	local int = getElementInterior(player)
	local dim = getElementDimension(player)
	local vehicle = getPedOccupiedVehicle ( player )
	local seat = 0
	if ( vehicle ) then seat = getPedOccupiedVehicleSeat ( player ) end
	if ( vehicle ) then warpPedIntoVehicle ( player, vehicle, seat ) end
		if ( isPedInVehicle ( player ) ) then
      		  		local vehicle = getPedOccupiedVehicle ( player )
					local seats = getVehicleMaxPassengers ( vehicle ) + 1
					local i = 0
					while ( i < seats ) do
						if ( not getVehicleOccupant ( vehicle, i ) ) then
   						warpPedIntoVehicle (source, vehicle, i )
						i = i + 1
					if ( i >= seats ) then
						warp ( source, player )
	setElementPosition(source, x + 0.5,y,z )
addEvent("WarpOtro", true) 
addEventHandler("WarpOtro", getRootElement(), warpearOtro)


Share this post

Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.