Jump to content

Elements in colShape not recognized


Lavire

Recommended Posts

Posted (edited)

Hey there,

I'm working with colShapes for quite some time now, and they've worked so far. But now I'm working on a command where I need to know the objects in the player's range. The colShape is being created (I tested it already), but it says there is only 1 object in range (the player himself).

local x, y, z = getElementPosition(thePlayer) 
    local atmSphere = createColSphere(tonumber(x), tonumber(y), tonumber(z), tonumber(20.0)) 
    local atms = getElementsWithinColShape(atmSphere) 
    outputChatBox(tostring(table.getn(atms))) 

What am I doing wrong?

Edited by Guest
Posted

Hm, with the vehicle it works.

If it helps: the object is being created in a .map file, not in the script itself.

What could it be?

Posted

Yes, when I create it ingame it works... so what is the problem with loading it with .map files? Something with collisions maybe?

Posted (edited)

Oh, here's an example of the .map file, in which the objects are defined:

<object id="atm8" doublesided="false" model="2942" interior="0" dimension="0" posX="-1980.5885009766" posY="131.54470825195" posZ="27.33039855957" rotX="0" rotY="0" rotZ="270" type="atm" /> 

Edited by Guest
  • MTA Team
Posted

Now without creating the object with script, restart the resource that contains the map file. and see if it finds it then.

Posted

I restarted the server a hundreds of times... still won't work =/

Btw: it recognizes other objects created by other .map files, just not the .map file with my ATMs...

  • MTA Team
Posted

Definitely weird, I have no idea what to do then. I will try and get more people to see this topic and if they can't fix it I recommend you report it to MTA Bug Tracker

EDIT: Really sorry for the late reply, I know how it feels when someone doesn't help you.

Posted

Just for the ones having the same problem:

You have to add an

collision="1" 

to each of your objects in the .map file, if you want them to be collided with colShapes.

Thanks anyways for the help, qaisjp.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...