Jump to content

how to disable warping


Perfect

Recommended Posts

Posted

Hi all, How to disable warp players to me.

I mean if players try to warp me then they can't and got message "this player diable warping". yes by using command

Help Pls!!!

Posted

You can use:

setElementData -- To set the warping state. 
getElementData -- To get the warping state. 

You'll have to edit the Freeroam script though.

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

Posted
Click on each link and read, I won't do it for you.

I did'nt understand. can you give any simple example and can you explain me better, what i do with that functions ?

Posted

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.

Posted
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 

Posted

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 
  
  
  
  
  
  

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

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

Posted
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" ?

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

Posted

ok but when player try to warp and i disable warping then that player will get message like "This player is diable his warping", how to that ?

Posted
function warpMe(targetPlayer) 
if getElementData(targetPlayer,"warp.status") then outputChatBox ( "This player has disabled warping.", source, 255, 0, 0 ) return end 
.. 

  • 5 months later...
Posted
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?

Posted
"freeroam/fr_server.lua".

Ok, and how to set this script only for the staff?

e.g.: only staff can type /nowarps and the script is active for these players.

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