Jump to content

[HELP] Tables with blip and colsphere


squar

Recommended Posts

Posted
createBlipAttachedTo 

With that function, you can attach a blip directly to another element.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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...

Posted

Store everything in a table, then when you the colshape is hit, destroy them?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Why can't you do it?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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 :)

Posted

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?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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.

Posted
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 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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

Posted

I don't see why it shouldn't work, that line checks if 'data' is a table.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

You're welcome.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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...