Walking Style when you under 25HP
#1

I think to add a system where when you under 25HP to change your walking style to Old Man but I need somebody who can show me an example with SetPVarInt

Do you think this will work well?

PHP код:
    if(GetPlayerHealth(playerid) < 25.0 && GetPVarInt(playerid"Under25HP") == 0)
    {
        
ApplyAnimation(playerid,"PED","WALK_DRUNK",4.1,1,1,1,1,1,1);
        
SetPVarInt(playerid"Under25HP"1);
    }
    else if(
GetPVarInt(playerid"Under25HP") == && GetPlayerHealth(playerid) > 25.0)
    {
        
ClearAnimations(playerid);
        
SetPVarInt(playerid"Under25HP"0);
    } 
Reply
#2

ye if you place this under onplayerupdtate then itll work i think
Reply
#3

Quote:
Originally Posted by niels44
Посмотреть сообщение
ye if you place this under onplayerupdtate then itll work i think
god hell no, he will look glitchy and stuff, do you know how many times OnPlayerUpdate is called each second?
Reply
#4

Can you give me an example how it must be?
Reply
#5

Mm...i scripting on pawn about 3 years ago, but try something like this

PHP код:
new boolWalkDrunk[MAX_PLAYERS];
public 
OnPlayerUpdate (playerid) {
    new 
playerState GetPlayerState(playerid), FloatplayerHealth;
    
GetPlayerHealth (playeridplayerHealth);
    if (
playerState == PLAYER_STATE_ONFOOT) {
        if (
playerHealth <= 25 && !WalkDrunk[playerid]) {
            
WalkDrunk[playerid] = true;
            
ApplyAnimation (playerid"PED""WALK_DRUNK"4.1111111);
        } else if (
playerHealth 25 && WalkDrunk) {
            
WalkDrunk[playerid] = false;
            
ClearAnimations (playerid);
        }
    }
    return 
1;

It's not a full working variant, but for example need to work with onplayerstatechange
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)