[help] NewTimer / Function / object.Delete() Does not work properly

Started by longhackmc, Aug 06, 2017, 12:41 AM

Previous topic - Next topic

longhackmc

function onCheckpointEntered( player, checkpoint )
{
if (checkpoint.ID == 14)
{
    Boomb <- CreateObject( 380, 1,  Vector(-945.472, -343.736, 8.12693), 255 );
    Boomb.RotateByEuler( Vector( 3.14159, 3.14159, 1.46159), 0);
    NewTimer( "deletebom", 3000,1);
}
}
function deletebom()
{
Boomb.Delete()
}

When I went to checkpoint the bomb was created but after 3 seconds it was not deleted

ℛḝξ☂

Quotefunction ( player, pickup )
Quoteif (checkpoint.ID == 14)
And btw, you're defining every object created as "Boomb" which means if you pick up it twice(or more) in 3 seconds it will delete the last object you created during the 3 seconds.
With that i came up this
NewTimer( "deletebom", 3000,1,Boomb.ID);

function deletebom(objid)
FindObject(objid).Delete();
I may be a slow walker but I am always walking.

longhackmc

Quote from: Rest on Aug 06, 2017, 03:43 AM
Quotefunction ( player, pickup )
Quoteif (checkpoint.ID == 14)
And btw, you're defining every object created as "Boomb" which means if you pick up it twice(or more) in 3 seconds it will delete the last object you created during the 3 seconds.
With that i came up this
NewTimer( "deletebom", 3000,1,Boomb.ID);

function deletebom(objid)
FindObject(objid).Delete();


I was mistaken when writing this article between pickup and checkpoint. I edited the post
And thanks for it's working