Jump to content

setElementPosition problem


KariiiM

Recommended Posts

I am scripting an warper system everything scripted fine,but i face a small problem in same time bigger, when selecte the location from gridlist it warps me underground at the place near farm.

Currently it just take cash without warping plus warning.

WARNING: Bad argument @'setElementPosition' [Expected bool at argument 5, got number '0']

--It's part of the script ,server side:

  
--name  ,  city,   price,   x,  y,  z 
local theTable = { 
{"LVPD", "LV", 1200, 2221.2431640625, 2468.7631835938, 10.8203125},  
{"Hospital", "Las Venturas Airport", 1100, 1625.0001220703, 1850.4322509766, 0.8203125}, 
{"AP", "Las Venturas Airport", 2300, 1730.140625, 1480.3857421875, 10.81282043457}, 
{"AMM", "Come-A-Lot", 2000, 2099.7961425781, 967.29669189453, 10.81282043457} 
} 
  
addEvent ("bus:warpplayer",true) 
addEventHandler ("bus:warpplayer",root, 
function (cityname,price,x,y,z) 
if ( getPlayerMoney ( source ) < tonumber(price) ) then 
outputChatBox("You need ".. tonumber(price).."$ to use this service.", source, 255,0,0) 
else 
takePlayerMoney (source, tonumber(price)) 
          setElementPosition(source, x,y,z,0,0,0) 
    end 
end) 
  

Link to comment

You got 3 or 4 columns, and you want to get coordinates from a non-existing column.

triggerServerEvent("bus:warpplayer",localPlayer, cityname,price,guiGridListGetSelectedItem(busGrid)) 

addEvent ("bus:warpplayer",true) 
addEventHandler ("bus:warpplayer",root, 
function (cityname,price,id) 
local x, y, z = theTable[id][4], theTable[id][5], theTable[id][6] 
if ( getPlayerMoney ( source ) < tonumber(price) ) then 
outputChatBox("You need ".. tonumber(price).."$ to use this service.", source, 255,0,0) 
else 
takePlayerMoney (source, tonumber(price)) 
          setElementPosition(source, x,y,z) 
    end 
end) 

Link to comment

Checking if the x,y,z egal to the cordinations, it doesn't works as it must be like, disable all warps no errors/warns ..

addEvent ("bus:warpplayer",true) 
addEventHandler ("bus:warpplayer",root, 
function (cityname,price,id) 
local loc = getZoneName(theTable[id][4], theTable[id][5], theTable[id][6]) 
local x, y, z = theTable[id][4], theTable[id][5], theTable[id][6] 
local location = getZoneName(x, y, z) 
if ( getPlayerMoney ( source ) < tonumber(price) ) then 
if loc == location then 
outputChatBox("You need ".. tonumber(price).."$ to use this service.", source, 255,0,0) 
else 
outputChatBox("You're already in "..location..".",source,225,0,0) 
          takePlayerMoney (source, tonumber(price)) 
          setTimer(setElementPosition, 5000, 1,source, x,y,z) 
       end 
    end 
end) 

Link to comment
addEvent ("bus:warpplayer",true) 
addEventHandler ("bus:warpplayer",root, 
function (cityname,price,id) 
local loc = getZoneName(theTable[id][4], theTable[id][5], theTable[id][6]) 
local x, y, z = theTable[id][4], theTable[id][5], theTable[id][6] 
local location = getZoneName(x, y, z) 
if loc == location then 
    if ( getPlayerMoney ( source ) < tonumber(price) ) then 
        outputChatBox("You need ".. tonumber(price).."$ to use this service.", source, 255,0,0) 
    else 
        outputChatBox("You're already in "..location..".",source,225,0,0) 
        takePlayerMoney (source, tonumber(price)) 
        setTimer(setElementPosition, 5000, 1,source, x,y,z) 
     end 
end 
end) 

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