07.08.2010, 12:59
How can i make that if a person is low on health like 50% an animation will play like /injured and they cant move until their health is high again like 70%. ALso can someone please give a tutorial for maping?
new Float:health;
GetPlayerHealth(playerid, health)
if(health => 50)
{
// do somethings here
}
public OnGameModeInit()
{
//your OnGameModeInitCode
SetTimer("HealthCheck", 1000, 1);
return 1;
}
forward HealthCheck();
public HealthCheck()
{
for(new i=0; i<MAX_PLAYERS; i++){
if(IsPlayerConnected(i)){
new Float:Health;
GetPlayerHealth(i, Health);
if(Health < 50){
ApplyAnimationEx(playerid,"SWAT","gnstwall_injurd" , 4.0, 1, 0, 0, 0, 0);//Anim
TogglePlayerControllable(playerid, 0);// Freeze the player
SetPlayerHealth(i, Health + 1);//Optional for increace player's life, and unfreeze it
}
else{
ClearAnimations(i);
TogglePlayerControllable(playerid, 1);
}
}
}
}
public OnFilterScriptInit()
{
//your OnGameModeInitCode
SetTimer("HealthCheck", 1000, 1);
return 1;
}
forward HealthCheck();
public HealthCheck()
{
for(new i=0; i<MAX_PLAYERS; i++){
if(IsPlayerConnected(i)){
new Float:Health;
GetPlayerHealth(i, Health);
if(Health < 50){
ApplyAnimation(i,"SWAT","gnstwall_injurd" , 4.0, 1, 0, 0, 0, 0);//Anim
TogglePlayerControllable(i, 0);// Freeze the player
SetPlayerHealth(i, Health + 1);//Optional for increace player's life, and unfreeze it
}
else{
ClearAnimations(i);
TogglePlayerControllable(i, 1);
}
}
}
}