Actors can't have a variable applied to them?
#1

I tried applying an array variable to an actor.

It doesn't work properly.

PHP код:
if(IsValidActor(DeadBody[playerid])) DestroyActor(DeadBody[playerid]); 
It destroys the previously created actor, ignoring the playerid parameter.
Reply
#2

https://sampwiki.blast.hk/wiki/CreateActor

Quote:

Return Values:
The created Actor ID (start at 0).

They have ID, they can.
Reply
#3

Quote:
Originally Posted by Troydere
Посмотреть сообщение
Quote:

They do NOT use player IDs/slots on the server and CANNOT be handled like NPCs.

Something tells me this means they can't be handled with an array variable.
Reply
#4

Try something like this:
Код:
new actors[4]; // Change 4 to 1 more than however many actors you want.
Then whenever you create the actor, do so like this:
Код:
actor[0] = CreateActor(0, 0.0, 0.0, 3.0, 0.0);
Then it'd be like:
Код:
if(actor[0])
{
    //Do something here.
}
No idea if this would work, just an idea.
Reply
#5

Quote:

They do NOT use player IDs/slots on the server and CANNOT be handled like NPCs.

Quote:
Originally Posted by Aerotactics
Посмотреть сообщение
Something tells me this means they can't be handled with an array variable.
Quote:

These 'actors' are like NPCs, however they have limited functionality.

https://sampwiki.blast.hk/wiki/CreateActor

Код:
new ActorCJ;
 
public OnGameModeInit()
{
    // Create an actor (CJ) at Blueberry Acres (Center of SA map)
    ActorCJ = CreateActor(0, 0.0, 0.0, 3.0, 0.0);
}
Quote:
ActorCJ
is the Actor ID.
Reply
#6

Yeah as mentioned above, think of actors like creating an object or a vehicle. When creating the actor, it returns an id. This is the ID you use to refer to the actor. You'll need to create an array to keep track of these ID's or you can define them specifically.
Reply
#7

Quote:
Originally Posted by Aerotactics
Посмотреть сообщение
Something tells me this means they can't be handled with an array variable.
What you quoted from the wiki says, that functions like GetPlayerPos cannot be used on Actors, because they do not use playerids but their own ID range.

Other than that, they have regular IDs like Objects, Vehicles, TextDraws, etc. It's just a number that you can store as you wish.

I assume you want to create one actor per player while he is dead. The code you posted seems correct if you saved the actor IDs into the right slot (slot of the dead player's ID), can you show that part as well?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)