Morelli Posted March 3, 2008 Posted March 3, 2008 When using getElementsWithinColShape to return objects within a collision shape, nothing occurs. Here's a quick test code, for you to try yourself. function Create() -- Just use this to spawn a few objects around the 0,0,0 origin createObject ( 659, 0, 0, 5, 0, 0, 0 ) createObject ( 982, 0, 3, 5, 0, 0, 0 ) createObject ( 765, 3, 0, 5, 0, 0, 0 ) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), Create) function Join( ) spawnPlayer ( source, 0.0, 0.0, 5.0, 90.0, 0, 0, 0, 0 ) fadeCamera( source, true ) end addEventHandler ( "onPlayerJoin", getRootElement(), Join) function Objects( sourcePlayer, command ) local X, Y, Z = getElementPosition( sourcePlayer ) local tempcol = createColSphere( X, Y, Z, 25.0 ) local allObjectsinCol = getElementsWithinColShape ( tempcol, "object" ) for keyObjects,object in pairs(allObjectsinCol) do local x4,y4,z4 = getElementPosition ( object ) local x1,y1,z1 = getObjectRotation ( object ) local model = getObjectModel( object ) outputDebugString("POS ---- x4: " ..x4.. " y4:" ..y4.. " z4:" ..z4 ) outputDebugString("ROT ---- x1: " ..x1.. " y1:" ..y1.. " z1:" ..z1 ) outputDebugString("MODEL ---- model: " ..model ) outputDebugString("--------------------------------------------------------------" ) end end addCommandHandler("object", Objects) I've only tested this on objects which are spawned via the createObject function. http://www.valhallagaming.net [MTA] Roleplay Server - 69.4.236.229:7777 [sAMP] Roleplay Server - 67.228.177.232:7777 [GTAIV] Server coming soon - [CoD4] Hardcore Server - Offline [L4D] Server coming soon - [CS] Standard settings - ? [CS] Zombie Mode - ?
Ransom Posted March 10, 2008 Posted March 10, 2008 It appears you are right, I'll raise the issue. Thanks. Offical B.L.A.S.T.A.ddict VCP - winners of the official MTA tournament (undefeated!) /smug
Recommended Posts