autocrack when player have 20 hp - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: autocrack when player have 20 hp (
/showthread.php?tid=139621)
autocrack when player have 20 hp -
Malkinu - 05.04.2010
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;
}
}
Re: autocrack when player have 20 hp -
pmk1 - 05.04.2010
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.
Re: autocrack when player have 20 hp -
Jay420 - 05.04.2010
I have something like this.
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