Help actor dynamic
#1

Hi, why do not my actor ever change his mind and start firing his HP?


PHP код:
hook OnPlayerUpdate(playerid
{
    new 
actorid GetPlayerTargetDynamicActor(playerid);
    if(
actorid == INVALID_ACTOR_ID) return 1;
    if(
IsValidDynamicActor(STREAMER_TAG_ACTOR actorid) && GetPlayerWeapon(playerid) != 0)
    if(
actorid == halloCloun[0])
    {
             
TDtext(playerid"Pataikei i klouna");    
    }
    if(
actorid == halloCloun[1])
    {
             
TDtext(playerid"Pataikei i klouna");    
    }
    if(
actorid == halloCloun[2])
    {
             
TDtext(playerid"Pataikei i klouna");    
    }    
    new 
Float:halloClounHP[3];
    
GetDynamicActorHealth(STREAMER_TAG_ACTOR halloCloun[0], halloClounHP[0]); 
    
GetDynamicActorHealth(STREAMER_TAG_ACTOR halloCloun[1], halloClounHP[1]);
    
GetDynamicActorHealth(STREAMER_TAG_ACTOR halloCloun[2], halloClounHP[2]);
    if(
halloClounHP[0] < 0)
    {
        
DestroyDynamicActor(STREAMER_TAG_ACTOR halloCloun[0]);
    }
    if(
halloClounHP[1] < 0)
    {
        
DestroyDynamicActor(STREAMER_TAG_ACTOR halloCloun[1]);
    }
    if(
halloClounHP[2] < 0)
    {
        
DestroyDynamicActor(STREAMER_TAG_ACTOR halloCloun[2]);
    }    
    return 
1;

Reply
#2

as i understand you want to your actor loss hp but he dosent ye ? anyway

check if your actor invulnerable is true

IsActorInvulnerable

then set it to false

SetActorInvulnerable ( i think )

anyway this part should look like this too


PHP код:
if(halloClounHP[all] < 0
    { 
        
DestroyDynamicActor(STREAMER_TAG_ACTOR halloCloun[2]); 
    } 
to

PHP код:
if(halloClounHP[all] <= 0/* ( even i think == would be just fine) */
    

        
DestroyDynamicActor(STREAMER_TAG_ACTOR halloCloun[2]); 
    } 
Reply
#3

Quote:
Originally Posted by khRamin78
Посмотреть сообщение
as i understand you want to your actor loss hp but he dosent ye ? anyway

check if your actor invulnerable is true

IsActorInvulnerable

then set it to false

SetActorInvulnerable ( i think )

anyway this part should look like this too


PHP код:
if(halloClounHP[all] < 0
    { 
        
DestroyDynamicActor(STREAMER_TAG_ACTOR halloCloun[2]); 
    } 
to

PHP код:
if(halloClounHP[all] <= 0/* ( even i think == would be just fine) */
    

        
DestroyDynamicActor(STREAMER_TAG_ACTOR halloCloun[2]); 
    } 
Actors do not -hp
Reply
#4

Quote:
Originally Posted by TMapping
Посмотреть сообщение
Actors do not -hp
i told you

they are Invulnerable

you have to set them vulnerable using this links please read them
IsActorOnvulnerable // checking if the actor dmg able
SetActorInvulnerable // set actor dmg able
OnPlayerGiveDamageActor // when a player dmg actor



ANYWAY if you use dynamic actor

your code should be like this to make vulnerable actors
PHP код:
CreateDynamicActor(modelidFloat:xFloat:yFloat:zFloat:rinvulnerable 1Float:health 100.0worldid = -1interiorid = -1playerid = -1Float:streamdistance STREAMER_ACTOR_SDareaid STREAMER_TAG_AREA -1priority 0);
/*That invulnerable should be set to 0 in case of taking dmg*/
//or even 
SetDynamicActorInvulnerable(actorid0); 

just in case do them when ever you create the actors or if you too lazy to do that then do something like this


Your new code should be like this but its not the best way of slove of the problem you have to just make them vulnerable in where you createed them not in some point :

PHP код:

hook OnPlayerUpdate
(playerid)
{
    new 
actorid GetPlayerTargetDynamicActor(playerid);
    if(
actorid == INVALID_ACTOR_ID) return 1;
    
    if(
IsValidDynamicActor(STREAMER_TAG_ACTOR actorid) && GetPlayerWeapon(playerid) != 0)
    {
        
SetDynamicActorInvulnerable(actorid0);
        if(
actorid == halloCloun[0])
        {
                 
TDtext(playerid"Pataikei i klouna");
        }
        if(
actorid == halloCloun[1])
        {
                 
TDtext(playerid"Pataikei i klouna");
        }
        if(
actorid == halloCloun[2])
        {
                 
TDtext(playerid"Pataikei i klouna");
        }
        new 
Float:halloClounHP[3];
        
GetDynamicActorHealth(STREAMER_TAG_ACTOR halloCloun[0], halloClounHP[0]);
        
GetDynamicActorHealth(STREAMER_TAG_ACTOR halloCloun[1], halloClounHP[1]);
        
GetDynamicActorHealth(STREAMER_TAG_ACTOR halloCloun[2], halloClounHP[2]);
        if(
halloClounHP[0] < 0)
        {
            
DestroyDynamicActor(STREAMER_TAG_ACTOR halloCloun[0]);
        }
        if(
halloClounHP[1] < 0)
        {
            
DestroyDynamicActor(STREAMER_TAG_ACTOR halloCloun[1]);
        }
        if(
halloClounHP[2] < 0)
        {
            
DestroyDynamicActor(STREAMER_TAG_ACTOR halloCloun[2]);
        }
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)