17.05.2018, 20:54
Quote:
PHP Code:
Mais ainda n pensei como que o cara chega no player e aperta a letra pra salvar ele! :/ |
PHP Code:
// topo
new Float:Health,
Curativos[MAX_PLAYERS],
bool:PlayerFerido[MAX_PLAYERS],
PlayerASerCurado[MAX_PLAYERS];
//GetPlayerHealth(playerid, Health);
// OnPlayerUpdate
if(Health <= 15.0)
{
ApplyAnimation(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
SetTimerEx("TempoSalvar", 30000, true, "i", playerid);
}
forward TempoSalvar(playerid);
public TempoSalvar(playerid)
{
if(GetPlayerHealth(playerid, Health) < 15.0)
{
SetPlayerHealth(playerid, 0.0);
SendClientMessage(playerid, -1, "* Vocк morreu apуs perder muito sangue.");
}
return 1;
}
// OnPlayerKeyStateChange
if((newkeys==KEY_YES))
{
for(new i; i < MAX_PLAYERS; i++)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
if(IsPlayerInRangeOfPoint(playerid, 1.5, X, Y, Z))
{
PlayerASerCurado[playerid] = i;
if(PlayerFerido[PlayerASerCurado[playerid]] == true && Curativos[playerid] >= 1)
{
// Aplica as animacoes dos jogadores caso queira
SetPlayerHealth(PlayerASerCurado[playerid], 100.0);
Curativos[playerid] --;
PlayerFerido[PlayerASerCurado[playerid]] = false;
KillTimer("TempoSalvar");
ClearAnimations(playerid);
}
}
}
}