WiBox Posted June 26, 2018 Share Posted June 26, 2018 zones = { --{id,name,owner,ctrl,price,objects,radio,x,y,sx,sy} -- {id = 1, name = "Test zone", owner = "TsT", ctrl = "", price = 10000, objects = 0, radio = "", x = 1577, y = 1723, sx = 60, sy = 140} } blips = {} zoneSQL = query( "SELECT * FROM zones" ) objectsZones = {} function onStart() for ind,val in ipairs(zoneSQL) do zones[ind] = val zones[ind].z = createColRectangle(val.x,val.y,val.sx,val.sy) setTimer(function () triggerClientEvent(root,"zones.addZonesLines",root,val.x,val.y,val.sx,val.sy,0,255,0) end,2000,1) setElementData(zones[ind].cz,"ind",ind) setElementData(zones[ind].cz,"val",val) addEventHandler ( "onColShapeHit", zones[ind].z, zoneHit ) addEventHandler ( "onColShapeLeave", zones[ind].z, zoneLeave ) local players = getElementsByType ( "player" ) for theKey,thePlayer in ipairs(players) do setElementData(thePlayer, "zones.editingEntity", false) end end end addEventHandler("onResourceStart", resourceRoot, onStart) That a small part of a script, on line 19 { addEventHandler ( "onColShapeHit", zones[ind].z, zoneHit ) } in the function zoneHit is about setElementData(plr,"zone"... my only problem is that the element isn't getting set on zone, I was thinking if the problem is from zones[ind].z, because, zone[ind].z use x, y, sx, sy from ( zone = { ) and I added the zone using a panel but when I add it, it say "you are not in a zone" because the function of "you are not in a zone", add a object in the function I'm speaking of, I use ( getElementData(plr,"zone"), as I said in zoneHit I used in it setElementData("plr,"zone".... , so at line 19 { addEventHandler ( "onColShapeHit", zones[ind].z, zoneHit ) } as I said use zones[ind].z and it use createCol... with val(zoneSQL which return to zones[zones = { ]) x and y and sx and sy, that's why I wanted to ask when I add the zone with a panel I created should I do a way so it get added in [ zones = { ]. or if there another reason it say you are not in a zone I appreciate who help and give some hints... ty. 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