squar Posted October 25, 2013 Share Posted October 25, 2013 (edited) Solved Edited October 25, 2013 by Guest Link to comment
Castillo Posted October 25, 2013 Share Posted October 25, 2013 createBlipAttachedTo With that function, you can attach a blip directly to another element. Link to comment
squar Posted October 25, 2013 Author Share Posted October 25, 2013 Oh, what if i've got an object using createObject? My bad... I should've pointed out that I wanted the col and blip attached to the object. However, the blip isn't a problem now. Since it will be deleted if i get the object deleted. You know how i can fix that? The plan though is to get the object, blip and colsphere deleted when i hit that colsphere... Link to comment
Castillo Posted October 25, 2013 Share Posted October 25, 2013 Store everything in a table, then when you the colshape is hit, destroy them? Link to comment
squar Posted October 25, 2013 Author Share Posted October 25, 2013 That was exactly how i wanted it to be. Its just the fact that i can't do that Link to comment
squar Posted October 25, 2013 Author Share Posted October 25, 2013 I don't have the knowledge to do that. I just tried throwing them all in a table like showed above, and some other weird ways. However, that ended with a failure you see. That's why I would like you guys to give me a clue about how to do it Link to comment
Castillo Posted October 25, 2013 Share Posted October 25, 2013 Lemme get it right: you created an object, and you want to attach to this object a blip and a colshape, and when you hit this colshape, you want all the three things destroyed? Link to comment
squar Posted October 25, 2013 Author Share Posted October 25, 2013 Yes. I want it tabled since it will be creating a new object with blip and colsphere like every sec. Therefore I want it to be like; when I hits the col, it will destroy the blip, col and object. Of course there's other things added to that than it getting deleted only. Its just that part I'm having problems with. Link to comment
Castillo Posted October 25, 2013 Share Posted October 25, 2013 local aTable = { } function test ( ) local obj = createObject ( ) -- Create an object. local col = createColTube ( ) -- Create a colshape. local blip = createBlipAttachedTo ( obj, 0 ) -- Create a blip attached to the object. attachElements ( col, obj ) -- Attach the colshape to the object. aTable [ col ] = { } -- Create a sub table inside 'aTable' using the colshape as index. aTable [ col ].object = obj -- Store the object element in this subtable. aTable [ col ].blip = blip -- Store the blip element in this subtable. addEventHandler ( "onClientColShapeHit", col, test2 ) end function test2 ( element ) if ( element == localPlayer ) then local data = aTable [ source ] if ( type ( data ) == "table" ) then destroyElement ( source ) destroyElement ( data.blip ) destroyElement ( data.object ) aTable [ source ] = nil end end end Link to comment
squar Posted October 25, 2013 Author Share Posted October 25, 2013 It didnt work. local data = aTable [ source ] outputChatBox("test") if ( type ( data ) == "table" ) then I tried an output under the "if" and it didnt work. However above did work, so i guess its something wrong with that line Link to comment
Castillo Posted October 25, 2013 Share Posted October 25, 2013 I don't see why it shouldn't work, that line checks if 'data' is a table. Link to comment
squar Posted October 25, 2013 Author Share Posted October 25, 2013 Oh i fixed it!. Thank you very much, I really appreciate your help. I messed up with the source and localPlayer. 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