Deleting objects
#1

Well, I need a little help. I made body part objects at OnPlayerDeath.

When someone dies those objects spawn, but I want an command to delete them. Offcourse I tried it and it worked (sort of) when you have multiple bodies, it only deletes one and not the others.

Code:

OnPlayerDeath:
new Float:X, Float:Y, Float:Z;

GetPlayerPos(playerid, X, Y, Z);
torso = CreateDynamicObject(2907, X, Y, Z, 0, 0, 274); //torso
legg = CreateDynamicObject(2905, X+0.85376, Y+0.161621, Z-1.01857662, 0, 26, 27; //leg
legg2 = CreateDynamicObject(2905, X+0.739746, Y-0.158935, Z-1.006423, 356.68469238281, 145.93511962891, 263.75891113281); //leg
arm = CreateDynamicObject(2906, X-0.081787, Y+0.239991, Z-1.03601265, 359.30590820313, 273.93939208984, 298.02392578125); //arm
arm2 = CreateDynamicObject(2906, X-0.024414, Y-0.30957, Z-1.03601265, 359.01071166992, 339.99688720703, 242.68936157227); //arm

__________________________________________________ ______________________________________________

command(deletebodies, playerid, params[])
{
if( Player[playerid][AdminLevel] >= 5 )
{
DestroyDynamicObject( torso );
DestroyDynamicObject( legg );
DestroyDynamicObject( legg2 );
DestroyDynamicObject( arm );
DestroyDynamicObject( arm2 );
}
}

__________________________________________________ ______________________________________________

new torso, legg, legg2, arm, arm2;

If anyone has an better plan (timers or something) please tell me (I suck at timers :P).

All help is appreciated.
Reply
#2

set a timer
Reply
#3

It won't do anything else. As I say it deletes, the last made object and not the others.

Maybe I can set a timer for everytime its creates it. But I suck at timers :P
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)