Jump to content

how to disable warping


Perfect

Recommended Posts

function warpStatus ( player ) 
    if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( player ) ), aclGetGroup ( "Admin" ) ) then 
        local status = ( not getElementData ( player, "warp.status" ) ) 
        setElementData ( player, "warp.status", status ) 
        outputChatBox ( "You have ".. ( status and "enabled" or "disabled" ) .." your warping", player ) 
    end 
end 
addCommandHandler ( "nowarp", warpStatus ) 
  
function warpMe(targetPlayer) 
    if (getElementData(targetPlayer,"warp.status") == false) then 
    if isPedDead(source) then 
        spawnMe() 
    end 
  
    local vehicle = getPedOccupiedVehicle(targetPlayer) 
    if not vehicle then 
        -- target player is not in a vehicle - just warp next to him 
        local x, y, z = getElementPosition(targetPlayer) 
        clientCall(source, 'setPlayerPosition', x + 2, y, z) 
    else 
        -- target player is in a vehicle - warp into it if there's space left 
        if getPedOccupiedVehicle(source) then 
            --removePlayerFromVehicle(source) 
            outputChatBox('Get out of your vehicle first.', source) 
            return 
        end 
        local numseats = getVehicleMaxPassengers(vehicle) 
        for i=0,numseats do 
            if not getVehicleOccupant(vehicle, i) then 
                if isPedDead(source) then 
                    local x, y, z = getElementPosition(vehicle) 
                    spawnMe(x + 4, y, z + 1) 
                end 
                warpPedIntoVehicle(source, vehicle, i) 
                return 
            end 
        end 
        outputChatBox('No free seats left in ' .. getPlayerName(targetPlayer) .. 's vehicle.', source, 255, 0, 0) 
       
    end 
    local interior = getElementInterior(targetPlayer) 
    setElementInterior(source, interior) 
    setCameraInterior(source, interior) 
end 

You must replace the function "warpMe" at "freeroam/fr_server.lua" with that code.

Link to comment
function warpStatus ( player ) 
    if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( player ) ), aclGetGroup ( "Admin" ) ) then 
        local status = ( not getElementData ( player, "warp.status" ) ) 
        setElementData ( player, "warp.status", status ) 
        outputChatBox ( "You have ".. ( status and "enabled" or "disabled" ) .." your warping", player ) 
    end 
end 
addCommandHandler ( "nowarp", warpStatus ) 
  
function warpMe(targetPlayer) 
    if (getElementData(targetPlayer,"warp.status") == false) then 
    if isPedDead(source) then 
        spawnMe() 
    end 
  
    local vehicle = getPedOccupiedVehicle(targetPlayer) 
    if not vehicle then 
        -- target player is not in a vehicle - just warp next to him 
        local x, y, z = getElementPosition(targetPlayer) 
        clientCall(source, 'setPlayerPosition', x + 2, y, z) 
    else 
        -- target player is in a vehicle - warp into it if there's space left 
        if getPedOccupiedVehicle(source) then 
            --removePlayerFromVehicle(source) 
            outputChatBox('Get out of your vehicle first.', source) 
            return 
        end 
        local numseats = getVehicleMaxPassengers(vehicle) 
        for i=0,numseats do 
            if not getVehicleOccupant(vehicle, i) then 
                if isPedDead(source) then 
                    local x, y, z = getElementPosition(vehicle) 
                    spawnMe(x + 4, y, z + 1) 
                end 
                warpPedIntoVehicle(source, vehicle, i) 
                return 
            end 
        end 
        outputChatBox('No free seats left in ' .. getPlayerName(targetPlayer) .. 's vehicle.', source, 255, 0, 0) 
       
    end 
    local interior = getElementInterior(targetPlayer) 
    setElementInterior(source, interior) 
    setCameraInterior(source, interior) 
end 

You must replace the function "warpMe" at "freeroam/fr_server.lua" with that code.

I have many problems when I paste this.

1) Idk why but this disabling the warps for all players

2) I cant disable this function with a command

3) When I paste this and go to add a weapon, when i press a random weapon the game does not responding

btw, if you are bored with this forget it. :)

Link to comment
  • 2 months later...
  • 4 years later...
On 8/23/2012 at 10:43, Solidsnake14 said:

You're welcome.

 

still the code have errors;

function warpStatus(player,cmd) 
     if player then 
          if (getElementData(player,"warp.status") == false) then 
               setElementData(player, "warp.status", true) 
               outputChatBox("You have enabled your warping", player) 
          else 
               setElementData(player, "warp.status", false) 
               outputChatBox("You have disabled warping", player) 
          end 
     end 
end 
addCommandHandler("warpstatus", warpStatus) 

function warpMe(targetPlayer)
    if (getElementData(targetPlayer,"warp.status") == false) then 
	if isPedDead(source) then
		spawnMe()
	end
end

	local vehicle = getPedOccupiedVehicle(targetPlayer)
	if not vehicle then
		-- target player is not in a vehicle - just warp next to him
		local x, y, z = getElementPosition(targetPlayer)
		clientCall(source, 'setPlayerPosition', x + 2, y, z)
	else
		-- target player is in a vehicle - warp into it if there's space left
		if getPedOccupiedVehicle(source) then
			--removePlayerFromVehicle(source)
			outputChatBox('Get out of your vehicle first.', source)
			return
		end
		local numseats = getVehicleMaxPassengers(vehicle)
		for i=0,numseats do
			if not getVehicleOccupant(vehicle, i) then
				if isPedDead(source) then
					local x, y, z = getElementPosition(vehicle)
					spawnMe(x + 4, y, z + 1)
				end
				warpPedIntoVehicle(source, vehicle, i)
				return
			end
		end
		outputChatBox('No free seats left in ' .. getPlayerName(targetPlayer) .. '\'s vehicle.', source, 255, 0, 0)
	end
	local interior = getElementInterior(targetPlayer)
	setElementInterior(source, interior)
	setCameraInterior(source, interior)
end

need to add end at function and its does not create any gui in freeroampanel how can i make gui of disable warp so that it can work same like the code

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