KariiiM Posted August 4, 2015 Share Posted August 4, 2015 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
GTX Posted August 4, 2015 Share Posted August 4, 2015 Why did you put 0, 0, 0 in setElementPosition? setElementPosition(source, tonumber(x), tonumber(y), tonumber(z)) Link to comment
KariiiM Posted August 4, 2015 Author Share Posted August 4, 2015 (edited) I already tried this way but i out with the same error, Bad argument @'setElementPosition' [Expected vector3 at argument it do the same as setElementPosition(source,x, y, z) Edited August 4, 2015 by Guest Link to comment
GTX Posted August 4, 2015 Share Posted August 4, 2015 You didn't finish the error. That is most likely because you didn't convert it to number or you got it wrong from wherever you get that coordinates. Link to comment
KariiiM Posted August 4, 2015 Author Share Posted August 4, 2015 I sent you the full code via private message Link to comment
GTX Posted August 4, 2015 Share Posted August 4, 2015 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
KariiiM Posted August 4, 2015 Author Share Posted August 4, 2015 My bad.. Thanks it worked but the first row isn't selectable and give this error ERROR: attempt to index field '?' (a nil value) also the first row cordinations went to the 2nd row.. Link to comment
GTX Posted August 4, 2015 Share Posted August 4, 2015 triggerServerEvent("bus:warpplayer",localPlayer, cityname,price,guiGridListGetSelectedItem(busGrid)+1) Link to comment
KariiiM Posted August 4, 2015 Author Share Posted August 4, 2015 Thanks, my problem is solved Link to comment
KariiiM Posted August 4, 2015 Author Share Posted August 4, 2015 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
GTX Posted August 4, 2015 Share Posted August 4, 2015 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
KariiiM Posted August 4, 2015 Author Share Posted August 4, 2015 Now, each warp the message sends not only for the same location/Cord Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now