#1

So, I'm just revising over several thing and testing a few things out. I'm just wondering how this can be changed around, as I'm actually stuck.

PHP код:
new Actor
The problem is this:

PHP код:
CMD:npc(playeridparams[])
{
    new 
Float:XFloat:YFloat:Z;
    
GetPlayerPos(playeridXYZ);
    
Actor CreateActor(21XYZ+290.0);
    
SetActorInvulnerable(Actorfalse);
    
SetActorHealth(Actor100);
    return 
1;

Everytime I spawn the NPC, it works fine, it spawns +1 each time. Which is what I want, but here:

PHP код:
public OnPlayerGiveDamageActor(playeriddamaged_actoridFloatamountweaponidbodypart)
{
    
ApplyActorAnimation(Actor"WUZI""CS_DEAD_GUY"4.100000);
    return 
1;

is where the problem occurs, it's only applying it to one of the actors at time. Obviously, I must change the
PHP код:
 new Actor
around in order to figure away around this. Any ideas?
Reply
#2

Because 'Actor' variable holds only the last actor ID, you gotta make it 1d array at least and loop through the variable to apply it for all the actors.
Reply
#3

Quote:
Originally Posted by oMa37
Посмотреть сообщение
Because 'Actor' variable holds only the last actor ID, you gotta make it 1d array at least and loop through the variable to apply it for all the actors.
Or...
PHP код:
public OnPlayerGiveDamageActor(playeriddamaged_actoridFloatamountweaponidbodypart

    
ApplyActorAnimation(damaged_actorid"WUZI""CS_DEAD_GUY"4.100000); 
    return 
1

The ID is already given to you!
Reply
#4

Oh, didn't see that. Haven't worked with that callback at all before.
Reply
#5

Ah, it works like a charm. Thank you!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)