Jump to content

[HELP ME] Why not working toggle warp in freeroam?


Turbe$Z

Recommended Posts

fr_server.lua:

function warpMe(targetPlayer) 
    local interior = getElementInterior(targetPlayer) 
    setElementInterior(source, interior) 
    setCameraInterior(source, interior) 
  
    if getElementData(targetPlayer, "IsWarpLocked") then 
        outputChatBox("Ez a játékos nem engedte meg hogy rá warpoljanak", source, r, g, b, false) 
        return 
    end 
     
    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 
end 

addCommandHandler("warpki", 
function(player) 
	outputChatBox("Nem tudnak rád warpolni", source, r, g, b)
    setElementData(player, "IsWarpLocked", true) 
end) 
  
addCommandHandler("warpbe", 
function(player) 
	outputChatBox("Mostmár rád tudnak warpolni", source, r, g, b)
    removeElementData(player, "IsWarpLocked") 
end) 

fr_client.lua:

function toggleWarponoff()
	local state = guiCheckBoxGetSelected(getControl(wndMain, 'warpkibe'))
	guiCheckBoxSetSelected(getControl(wndMain, 'warpkibe'), not state)
	server.IsWarpLocked(state)
end

	{'chk', id='warpkibe', text='Warp', onclick=toggleWarponoff},

 

Link to comment
function setWarpLocked(player) 
	outputChatBox("Nem tudnak rád warpolni", source, r, g, b)
    setElementData(player, "IsWarpLocked", true) 
end
addCommandHandler("warpki", setWarpLocked) 

function setWarpUnlocked(player) 
	outputChatBox("Mostmár rád tudnak warpolni", source, r, g, b)
    setElementData(player, "IsWarpLocked", false) 
end
addCommandHandler("warpbe", setWarpUnlocked) 

Use these functions ^

Link to comment
12 minutes ago, Gravestone said:

function setWarpLocked(player) 
	outputChatBox("Nem tudnak rád warpolni", source, r, g, b)
    setElementData(player, "IsWarpLocked", true) 
end
addCommandHandler("warpki", setWarpLocked) 

function setWarpUnlocked(player) 
	outputChatBox("Mostmár rád tudnak warpolni", source, r, g, b)
    setElementData(player, "IsWarpLocked", false) 
end
addCommandHandler("warpbe", setWarpUnlocked) 

Use these functions ^

Doesn't working :| 

What wrong? :|     

server.setWarpLocked(state)
server.setWarpUnlocked(state)

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