Store actor in a variable
#1

Hello,
When I try to store an actor ID into a variable it doesn't work properly.

Код:
CMD:test(playerid, params[])
{
	if(IsValidActor(pActor[playerid])) DestroyActor(pActor[playerid]);
	pActor[playerid] = CreateActor(0, 0.0, 0.0, 0.0, 3.0);
	SetActorVirtualWorld(pActor[playerid], playerid);
	return 1;
}
If I type command test the actor is created but if someone else type this command it removes my actor and create just for them.
And I tried to verify IsValidActor(pActor[x]) with x with random values and after I run command /test IsValidActor(pActor[x]) gives true for all x (0-999) even if I created just an actor.

Is there a way to store an Actor id for a player variable?
Reply
#2

Yeah, I figured that IsValidActor(x) return if an id is valid not if an actor was created on that id.

I solved setting pActor[playerid] = -1; if an actor wasn't created for that player.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)