SA-MP Forums Archive
MAX_X - 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: MAX_X (/showthread.php?tid=642076)



MAX_X - aoky - 24.09.2017

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?


Re: MAX_X - oMa37 - 24.09.2017

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.


Re: MAX_X - Paulice - 24.09.2017

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!


Re: MAX_X - oMa37 - 24.09.2017

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


Re: MAX_X - aoky - 24.09.2017

Ah, it works like a charm. Thank you!