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

Multi Theft Auto Player since middle of 2011.

Everybody want to act Crazy/Smart/Intelligent/Different/Unique/Innocent and Thats why I am Perfect.

Posted

You are talking about Freeroam warping?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
You are talking about Freeroam warping?

Yes

Multi Theft Auto Player since middle of 2011.

Everybody want to act Crazy/Smart/Intelligent/Different/Unique/Innocent and Thats why I am Perfect.

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.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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 ?

Multi Theft Auto Player since middle of 2011.

Everybody want to act Crazy/Smart/Intelligent/Different/Unique/Innocent and Thats why I am Perfect.

Posted

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

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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 ?

Multi Theft Auto Player since middle of 2011.

Everybody want to act Crazy/Smart/Intelligent/Different/Unique/Innocent and Thats why I am Perfect.

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.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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 

Multi Theft Auto Player since middle of 2011.

Everybody want to act Crazy/Smart/Intelligent/Different/Unique/Innocent and Thats why I am Perfect.

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 
  
  
  
  
  
  

http://www.sincitygaming.net - The next generation of gaming!

SinCity Gaming | UltiRace 24/7 - 188.165.199.162:22003

SinCity Gaming | Roleplay Gaming - Beta soon!

SinCity Gaming | Zombie Mode + - 188.165.199.162:22005

Instead of using ip: 188.165.199.162 you can use: sincitygaming.net

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"

Multi Theft Auto Player since middle of 2011.

Everybody want to act Crazy/Smart/Intelligent/Different/Unique/Innocent and Thats why I am Perfect.

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'

CiTLh.png
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" ?

Multi Theft Auto Player since middle of 2011.

Everybody want to act Crazy/Smart/Intelligent/Different/Unique/Innocent and Thats why I am Perfect.

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 ?

Multi Theft Auto Player since middle of 2011.

Everybody want to act Crazy/Smart/Intelligent/Different/Unique/Innocent and Thats why I am Perfect.

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

CiTLh.png
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 ?

Multi Theft Auto Player since middle of 2011.

Everybody want to act Crazy/Smart/Intelligent/Different/Unique/Innocent and Thats why I am Perfect.

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

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Thank you so much!!! (Solidsnake14,Taalasmaa and TAPL)

Multi Theft Auto Player since middle of 2011.

Everybody want to act Crazy/Smart/Intelligent/Different/Unique/Innocent and Thats why I am Perfect.

Posted

You're welcome.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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.

Posted
getPlayerAccount 
getAccountName 
isObjectInACLGroup 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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