Annas Posted June 20, 2016 Share Posted June 20, 2016 All i need is: - If object created out of ColShape, then destroy it But it's not working.. -- FirstFile.slua (server side) local SmallTest = createColRectangle(1982, -2574, 60, 60 ) function isObjectWithinCityZone(object) if (not (getElementType(object) == "object")) then return false end if (isElementWithinColShape(object, SmallTest)) then return true end return false end -- SecondFile.slua (server side) function CSTmapEditorMouseClick(button, state, el, wX, wY, wZ) local object = createObject(model, wX, wY, wZ) if (not (isObjectWithinCityZone(object))) then destroyElement(object) end end Notice: it should be 2 files. Link to comment
Bean666 Posted June 20, 2016 Share Posted June 20, 2016 is isObjectWithinCityZone defined in 2ndfile? Link to comment
Annas Posted June 20, 2016 Author Share Posted June 20, 2016 is isObjectWithinCityZone defined in 2ndfile? I didn't understand.. how to define it ? Link to comment
Bean666 Posted June 20, 2016 Share Posted June 20, 2016 since the isObjectWithinCityZone function is in the 1stfile. and you're calling the function "isObjectWithinCityZone" in the second file. which the function "isObjectWithinCityZone" is located in 1st file , functions aren't globally shared in resources. Link to comment
KariiiM Posted June 20, 2016 Share Posted June 20, 2016 Just be sure the second file is declared in the meta.xml, that's all. local SmallTest = createColRectangle ( 1982, -2574, 60, 60 ) function isObjectWithinCityZone ( object ) if ( object and not getElementType ( object ) == "object" ) then return false end if isElementWithinColShape ( object, SmallTest ) then return true end end Second code: function CSTmapEditorMouseClick ( button, state, el, wX, wY, wZ ) local object = createObject ( model, wX, wY, wZ ) if isElement ( object ) then if ( not isObjectWithinCityZone ( object ) ) then destroyElement ( object ) end end end 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