Jump to content

how to disable warping


Perfect

Recommended Posts

You can use:
setElementData -- To set the warping state. 
getElementData -- To get the warping state. 

You'll have to edit the Freeroam script though.

I know i need to edit but i don't know how use those funcions and yes i try wiki but can't help. can you explain me how to use those functions or can you make disable warping for me Pls ?

Link to comment
Both functions has examples, you should make a command to enable/disable warping and then on the function ( at the freeroam script ) where it tries to warp, it'll check that element data with getElementData and if it's disabled, don't let him warp.

ok i try but not working

here is my code

function warpStatus(player,cmd,) 
     if Player then 
          if not getElementData(player, "warp.status") then 
               setElementData(player, "warp.status", true) 
               outputChatBox("You have enabled your warping", player) 
          else 
               setElementData(player, "lift.permission", false) 
               outputChatBox("You have disabled warping", player) 
          end 
     end 
end 
addCommandHandler("warpstatus", warpStatus) 
function warpMe(targetPlayer) 
    if getElementData(player, "warp.status") 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 

Link to comment

Try:

EDIT: Fixed some arguements.

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

Link to comment
Try:

EDIT: Fixed some arguements.

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

thnx but I don't know where i put "if (getElementData(targetPlayer,"warp.status") == false) then"

Link to comment
Try:

EDIT: Fixed some arguements.

  
  
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 
  
    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 have missed 'end'

Link to comment
Try:

EDIT: Fixed some arguements.

  
  
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 
  
    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 have missed 'end'

where i put "if (getElementData(targetPlayer,"warp.status") == false) then" ?

Link to comment
can't you see it?

it's already on the code.

you mean code is complete ?

if i write warpstatus then i can disallowed warping ?

function warpMe is from freeroam > fr_server.lua > line (251)

just copy this

if getElementData(targetPlayer,"warp.status") then return end 

and paste it below

function warpMe(targetPlayer) 

result

function warpMe(targetPlayer) 
if getElementData(targetPlayer,"warp.status") then return end 
.. 

Link to comment
  • 5 months later...
Try:

EDIT: Fixed some arguements.

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

Guys, where can i insert this?

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