new Float:VidaJugador; // Definis la vida del jugador
GetPlayerHealth(playerid,VidaJugador); // Extraes la vida
if(VidaJugador <= 15) // Chequea que si tiene 15 de vida... (podes cambiarlo a cuanto quieras)
{
new string[128];
new Float:POSPH[3];
GetPlayerPos(playerid,POSPH[0],POSPH[1],POSPH[2]);
ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0); // Aplica la animacion de crack
SendClientMessage(playerid,0xFF6347AA,"Tu estado de salud es pйsimo, llama a un medico."); // Le envia el mensaje al jugador
return 1;
}
new bool:Msg[MAX_PLAYERS];//fuera del callback
new Float:VidaJugador; // Definis la vida del jugador
GetPlayerHealth(playerid,VidaJugador); // Extraes la vida
if(VidaJugador <= 15){
new string[128], Float:POSPH[3];
GetPlayerPos(playerid,POSPH[0],POSPH[1],POSPH[2]);
ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0); // Aplica la animacion de crack
if(!Msg[playerid])SendClientMessage(playerid,0xFF6347AA,"Tu estado de salud es pйsimo, llama a un medico."); // Le envia el mensaje al jugador
Msg[playerid] = true;
}
else{
Msg[playerid] = false;
}
return 1;
Bueno tambien andaba buscando algo asн, el de Tincho funciona pero le falta algo. El mensaje "Tu estado de salud es pйsimo, llama a un medico." Se repite continuamente, alguna idea para que solo salga una vez?
Y tambien queria ponerle que cada tanto tiempo vaya perdiendo vida una vez esta en el suelo. |
// definн en otra parte:
MandarMensajeHerido[MAX_PLAYERS];
// en OnPlayerConnect:
MandarMensajeHerido[playerid] = 0;
// lo edite un poco...
new Float:VidaJugador;
GetPlayerHealth(playerid,VidaJugador);
if(VidaJugador <= 15)
{
new string[128];
new Float:POSPH[3];
GetPlayerPos(playerid,POSPH[0],POSPH[1],POSPH[2]);
ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
if(MandarMensajeHerido[playerid] == 0)
{
MandarMensajeHerido[playerid] = 1;
TogglePlayerControllable(playerid, 0);
SendClientMessage(playerid,0xFF6347AA,"Tu estado de salud es pйsimo, llama a un medico."); // Le envia el mensaje al jugador
}
}
SetTimer("BajarVida", 10000, 1); // Son 10 segundos, cambialo a cuantos quieras vos.
// Y en cualquier parte del GM:
forward BajarVida(playerid);
public BajarVida(playerid)
{
static Float:BajarVida;
GetPlayerHealth(playerid,BajarVida);
SetPlayerHealth(playerid,BajarVida-10); // Le baja 10 de vida, ponele lo que quieras.
return 1;
}