Animation Errors
#1

So, firstly. It doesn't put the player into the position as requested nor does it apply the animation - but it doesn't show the Injured Mode text and set his health to 25. A fix would be great.

PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
    new 
Float:xFloat:yFloat:z;
    new 
str[128];
    new 
PlayerName[MAX_PLAYERS];
    
GetPlayerName(playeridPlayerName24);
    if(
PlayerD[playerid][BrutallyW1] == 0)
    {
        
GetPlayerPos(playeridxyz);
        
SetPlayerPos(playeridxyz);
        
SetPlayerHealth(playerid25.0);
        
GameTextForPlayer(playerid"~b~Injured~r~ Mode"100003);
        
ClearAnimations(playerid);
        
ApplyAnimation(playerid"PED""FLOOR_hit_f"4.110000);
        if(
Character[playerid][Level] <= 10)
        
THIS DOES RETURN DON'T WORRY - I JUST SHOWED HALF OF IT.
        { 

Also, when a player takes damage from getting shot in the leg, it doesn't do the animation when he gets hit. Here is the full code:
PHP код:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    new 
vid GetPlayerVehicleID(playerid);
    if(
IsPlayerInAnyVehicle(playerid))
    {
        if(
GetPlayerState(playerid == PLAYER_STATE_DRIVER))
        {
            if(
PRESSED(KEY_HANDBRAKE))
            {
                if(
Engine[vid] == 0)
                {
                    if(
CanDriveVehicle(playeridvid))
                    {
                        
Engine_TOGGLE(playeridvid);
                    }
                }
            }
            else if(
PRESSED(KEY_LOOK_BEHIND))
            {
                
Lights_TOGGLE(playeridvid);
            }
        }
    }
    if(
LoopAnim[playerid])
    {
        if(
PRESSED(KEY_HANDBRAKE))
        {
            
StopLoopingAnim(playerid);
            
TextDrawHideForPlayer(playerid,AnimText[playerid]);
        }
    }
    if(
LegHit[playerid] == 1// Will happen only if the player is shot in his left/right leg.
    
{
        if((
newkeys KEY_JUMP) && !(oldkeys KEY_JUMP)) // When the users presses his Jump key -
        
{
            
ClearAnimations(playerid);
            
ApplyAnimation(playerid"PED""FALL_collapse"4.100000); // Animation would be applied.
            
SendClientMessage(playerid, -1"You can not jump! You've been hit on your leg!"); // Send client message about his injury in his leg.
        
}
        if((
newkeys KEY_SPRINT) && (oldkeys KEY_SPRINT)) // When the user presses the Sprint key -
        
{
            
ClearAnimations(playerid);
            
ApplyAnimation(playerid"PED""FALL_fall"4.100000); // Different Animation would be applied.
            
SendClientMessage(playerid, -1"You're having trouble running because of the Gun Shot Wound"); // Sending client message about his injury(ies) again.
        
}
    }
    return 
1;
 } 
Reply
#2

You can't use these functions on player's death. You must do that when the player spawns. Also when you want to detect a key for that leg hit thing all you need to do is
Код:
if (newkeys & KEY_...)
Reply
#3

Quote:
Originally Posted by GoldenLion
Посмотреть сообщение
You can't use these functions on player's death. You must do that when the player spawns. Also when you want to detect a key for that leg hit thing all you need to do is
Код:
if (newkeys & KEY_...)
So do I GetPlayerPos in OnPlayerDeath, and then SetPlayerPos on onplayerspawn?
Reply
#4

Quote:
Originally Posted by aoky
Посмотреть сообщение
So do I GetPlayerPos in OnPlayerDeath, and then SetPlayerPos on onplayerspawn?
Yes. I think you could use SetSpawnInfo as well. All you need to do is set the injured variable to true on death and when the player spawns and if the injured variable is true then do all of that stuff.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)