autocrack when player have 20 hp
#1

I want that when a player is in a car and have 20 hp , he will be ejected from his car (RemovePlayerFromVehicle(i); and have the crack animation. My problem is that when he is ejected from car, he stays stand up and the crack animation dont work :/ Any help pls . Here is the code



Код:
	    	new Float:health;
				GetPlayerHealth(i, health);
				if (health <= 20 && dying[i] == 0)
				{
				  if(!(IsPlayerInAnyVehicle(i)))
					{
					 format(string, sizeof(string), "* %s falls on the floor", GetPlayerNameEx(i));
				     ProxDetector(15.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					 SendClientMessage(i, COLOR_WHITE, "  You are dying now , you can wait for medic or you can use '/accept death' ");
					printf("%s", string);
			  		TogglePlayerControllable(i, 0);
			  		ApplyAnimation(i,"CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
			  		gPlayerUsingLoopingAnim[i] = 1;
					dying[i] = 1;
					}
					else
					{
					  TogglePlayerControllable(i, 0);
                      ApplyAnimation(i,"CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
					  format(string, sizeof(string), "* %s loses consciousness", GetPlayerNameEx(i));
					   ProxDetector(15.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                       SendClientMessage(i, COLOR_WHITE, "  You are dying now , you can wait for medic or you can use '/accept death' ");
                       RemovePlayerFromVehicle(i);
						printf("%s", string);
						dying[i] = 1;
	   
					}
				}
Reply
#2

w8, is your player stuck or trying to move but cannot? if yes that could mean that only other people can see the anim, it's a bug, try your script wit ha friend and ask him if he see the animation.
Reply
#3

I have something like this.

pawn Код:
forward Health();
pawn Код:
public Health()
{
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(gPlayerSpawned[i] == 1)
{
new Float:health;
GetPlayerHealth(i, health);
if(health < 30)
{
if(IsPlayerInAnyVehicle(i))
{
RemovePlayerFromVehicle(i);
ApplyAnimation(i, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
GameTextForPlayer(i, "~r~You are injured, you need a medic !", 5000, 3);
}
ApplyAnimation(i, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
GameTextForPlayer(i, "~r~You are injured, you need a medic !", 5000, 3);
}
}
}
}
return 1;
}
Don't mind the identation..

E:Fixed the failure
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)