SA-MP Forums Archive
DestroyActor() not working. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: DestroyActor() not working. (/showthread.php?tid=572329)



DestroyActor() not working. - Emmet_ - 27.04.2015

I created an actor and tried to delete it using DestroyActor() but the actor does not seem to disappear.

pawn Код:
// Actor test

#include <a_samp>
#include <a_actor>

new gActor = INVALID_ACTOR_ID;

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (!strcmp(cmdtext, "/add"))
    {
        if (gActor == INVALID_ACTOR_ID)
        {
            gActor = CreateActor(299, 0.0, 0.0, 10.0, 0.0);
        }  
        return 1;
    }
    if (!strcmp(cmdtext, "/delete"))
    {
        DestroyActor(gActor);
        return 1;
    }
    return 0;
}



Re: DestroyActor() not working. - Dragony92 - 27.04.2015

It will disappear but you need to re-stream... I already reported this...

btw you don't need to include a_actor, it's already included in a_samp


Re: DestroyActor() not working. - Michael@Belgium - 27.04.2015

Are you sure you could even create the actor? Check that if statement and realize.


Re: DestroyActor() not working. - Dragony92 - 27.04.2015

[ame]http://www.youtube.com/watch?v=w-d44j7DnrA[/ame]


Re: DestroyActor() not working. - PT - 27.04.2015

if (gActor == INVALID_ACTOR_ID)


Re: DestroyActor() not working. - Emmet_ - 27.04.2015

Quote:
Originally Posted by Michael@Belgium
Посмотреть сообщение
Are you sure you could even create the actor? Check that if statement and realize.
That code was just an example. I didn't use that code for testing.

I tried it while an actor was right in front of me and it didn't disappear.


Re: DestroyActor() not working. - eXeDev - 27.04.2015

Thou shall not try to correct Emmet Jones' code.


Re: DestroyActor() not working. - J4Rr3x - 27.04.2015

Not a perfect solution, but waiting Kalcor repairs:
pawn Код:
SetActorPos(gActor, 0, 0, 0);
DestroyActor(gActor);



Re: DestroyActor() not working. - Tamer - 27.04.2015

Do we need IsValidActor() or would INVALID_ACTOR_ID work out aswell?


Re: DestroyActor() not working. - TommyB - 27.04.2015

I've noticed that after I destroy an actor and make one again in the same slot, it doesn't stream in unless I teleport away and come back to its location.