DestroyActor() not working.
#1

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;
}
Reply
#2

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
Reply
#3

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

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

if (gActor == INVALID_ACTOR_ID)
Reply
#6

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

Thou shall not try to correct Emmet Jones' code.
Reply
#8

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

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

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


Forum Jump:


Users browsing this thread: