Captain Cody Posted February 25, 2016 Share Posted February 25, 2016 function createMarkers () local result7 = executeSQLQuery("SELECT * FROM `HeretricsHouses`") for i, v in ipairs(result7) do executeSQLQuery("UPDATE `HeretricsHouses` SET `Locked`=? WHERE `name1`=?", 'no', v.name1 ) houseMarker[v.name1] = createMarker ( v.eX,v.eY,v.eZ+0.2, "cylinder", 1.1, 0, 0, 55, 170 ) houseMarker2[v.name1] = createMarker ( v.exX,v.exY,v.exZ+0.2, "cylinder", 1.1, 0, 0, 55, 170 ) setElementData( houseMarker[v.name1],"House.Id", v.name1, true ) setElementData( houseMarker2[v.name1],"House.Id", v.name1, true ) setElementInterior ( houseMarker[v.name1], v.ei ) setElementInterior ( houseMarker2[v.name1], v.exi ) setElementDimension ( houseMarker[v.name1], v.ed ) setElementDimension ( houseMarker2[v.name1], v.exd ) setElementData ( houseMarker2[v.name1], "house.interior", true ) end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), createMarkers) function housePanel (hitElement,matchingDimension, id) if getElementType ( hitElement ) == "player" then outputDebugString ("Player") if matchingDimension then outputDebugString ("matchingDem") local ElementIda = getElementData (source,"House.Id") if ElementIda then result = executeSQLQuery("SELECT * FROM `HeretricsHouses` WHERE `name1`=?", ElementIda ) resultb = result[1] else result = executeSQLQuery("SELECT * FROM `HeretricsHouses` WHERE `name1`=?", id ) resultb = result[1] end if getElementData (source,"house.interior") == false then outputDebugString ("matchingDem1") outputDebugString ("House") local resulta = resultb local name = resulta.name local Garagesaa = resulta.garages local cost = resulta.cost local Owner1 = resulta.Owner local Lockeda = resulta.Locked local x,y,z = resulta.exX, resulta.exY, resulta.exZ local interior, dem = resulta.exi, resulta.exd local account = getPlayerAccount(hitElement) local accounta = getAccountName(account) local admin = isObjectInACLGroup ("user."..accounta, aclGetGroup ( "Admin" ) ) if ElementIda then triggerClientEvent ( hitElement, "HousePanel", hitElement, ElementIda, accounta, admin, name,Garagesaa,cost,Owner1,Lockeda,x,y,z,interior, dem ) else triggerClientEvent ( hitElement, "HousePanel", hitElement, id, accounta, admin, name,Garagesaa,cost,Owner1,Lockeda,x,y,z,interior, dem ) end else outputDebugString ("matchingDem2") outputDebugString ("Interior") local account = getPlayerAccount(hitElement) if getAccountData ( account, "house.justentered") == false then setElementDimension ( hitElement, resultb.ed ) setElementInterior ( hitElement, resultb.ei ) setElementPosition ( hitElement, resultb.eX,resultb.eY,resultb.eZ+1 ) end end end end end addEventHandler( "onMarkerHit", resourceRoot, housePanel ) This creates the markers, and defines what happens when you hit the markers. Exterior markers are working just fine, but the interior markers are just ignoring any hits. Even if I remove the part about if interiormarker, doesn't even register a hit. And on start some ghost object hits the exterior marker 'nothing in sight around it' Any help would be needed, was working just fine when I first made it then it just quit on me. Link to comment
KariiiM Posted February 25, 2016 Share Posted February 25, 2016 The problem might be because the size of the marker is too small function createMarkers () local result7 = executeSQLQuery("SELECT * FROM `HeretricsHouses`") for i, v in ipairs(result7) do executeSQLQuery("UPDATE `HeretricsHouses` SET `Locked`=? WHERE `name1`=?", 'no', v.name1 ) houseMarker[v.name1] = createMarker ( v.eX,v.eY,v.eZ+0.2, "cylinder", 1.5, 0, 0, 55, 170 ) houseMarker2[v.name1] = createMarker ( v.exX,v.exY,v.exZ+0.2, "cylinder", 1.5, 0, 0, 55, 170 ) setElementData( houseMarker[v.name1],"House.Id", v.name1, true ) setElementData( houseMarker2[v.name1],"House.Id", v.name1, true ) setElementInterior ( houseMarker[v.name1], v.ei ) setElementInterior ( houseMarker2[v.name1], v.exi ) setElementDimension ( houseMarker[v.name1], v.ed ) setElementDimension ( houseMarker2[v.name1], v.exd ) setElementData ( houseMarker2[v.name1], "house.interior", true ) end end Link to comment
Captain Cody Posted February 25, 2016 Author Share Posted February 25, 2016 Increasing marker size does nothing. Link to comment
Captain Cody Posted February 25, 2016 Author Share Posted February 25, 2016 Seams the markers in interiors do not work, any way to fix this? Created a house with interior and exterior in same interior and it fixed it for some reason, removing the house breaks it again but adding it fixes it.. Link to comment
KariiiM Posted February 25, 2016 Share Posted February 25, 2016 I am gonna ask you a question, is you who scripted this part of code? If yes, did you inserted the data to the SQL to update it? Note: I suggest you to use dbFunctions, they're usefull plus you can use them in two types of database, (MySQL / SQLite). Link to comment
Captain Cody Posted February 25, 2016 Author Share Posted February 25, 2016 I scripted the whole code - And I did insert the data function resourceStart () executeSQLQuery("CREATE TABLE IF NOT EXISTS `HeretricsHouses` (`name` TEXT,`name1` TEXT, `eX` NUMERIC, `eY` NUMERIC, `eZ` NUMERIC, `ei` NUMERIC, `ed` NUMERIC,`exX` NUMERIC, `exY` NUMERIC, `exZ` NUMERIC, `exi` NUMERIC, `exd` NUMERIC, `garages` TEXT, `cost` NUMERIC, `Rental` TEXT, `Owner` TEXT, `Locked` TEXT )") end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), resourceStart) function createHouse (namea,name1a,x1a,y1a,z1a,i1a,d1a,x2a,y2a,z2a,i2a,d2a,garages1a,cost1a,rental1a) local locked = "no" executeSQLQuery("INSERT INTO `HeretricsHouses` (`name`,`name1`,`eX`,`eY`,`eZ`,`ei`,`ed`,`exX`,`exY`,`exZ`,`exi`,`exd`,`garages`,`cost`,`Rental`,`Owner`,`Locked`) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",namea,name1a, tonumber(x1a),tonumber(y1a),tonumber(z1a),tonumber(i1a),tonumber(d1a),tonumber(x2a),tonumber(y2a),tonumber(z2a),tonumber(i2a),tonumber(d2a),tonumber(garages1a),tonumber(cost1a),"N/A","none",locked) createHMarker (name1a,x1a,y1a,z1a,i1a,d1a,x2a,y2a,z2a,i2a,d2a) end And I thought that what I did fixed the issue, but no it did not. Issue is still there. Exterior markers are detected but interior markers are not. Link to comment
KariiiM Posted February 25, 2016 Share Posted February 25, 2016 Well, your code look fine, just be sure of these datas are working: ei / exi / ed and exd setElementInterior ( houseMarker[v.name1], v.ei ) setElementInterior ( houseMarker2[v.name1], v.exi ) setElementDimension ( houseMarker[v.name1], v.ed ) setElementDimension ( houseMarker2[v.name1], v.exd ) Link to comment
Captain Cody Posted February 25, 2016 Author Share Posted February 25, 2016 All of them are for sure working, checked with debug Link to comment
Captain Cody Posted February 25, 2016 Author Share Posted February 25, 2016 The markers are being created at the right locations, interiors and dimensions but the only working markers are the markers in interior 0. Link to comment
Captain Cody Posted February 25, 2016 Author Share Posted February 25, 2016 Any one, I really need to get this thing working. But it's not working. // The marker is appearing, but hitting it does nothing // //But when house is first created it works, then after entering it breaks// Link to comment
Mann56 Posted February 26, 2016 Share Posted February 26, 2016 Well, i had a similar problem before a number of times, dunno if this is like it but sometimes marker gets little down, to trigger it try increasing the z co-ordinate by 0.1 , it worked for me, i spent hours on this issue and the solution was very easy lol. Link to comment
Captain Cody Posted February 26, 2016 Author Share Posted February 26, 2016 I have raised marker, increased its size etc. Nothing works Link to comment
Captain Cody Posted February 27, 2016 Author Share Posted February 27, 2016 -- Made the marker hit client side 'And just triggered server side event' and it fixed it. -- Link to comment
Mann56 Posted February 27, 2016 Share Posted February 27, 2016 -- Made the marker hit client side 'And just triggered server side event' and it fixed it. -- great... 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