Perder vida com o tempo -
F1N4L - 25.11.2015
Anteriormente eu criei um tуpico onde estava com algumas dъvidas referente ao meu code, que jб foi resolvido e deixei o cуdigo ъtil se alguйm quiser... Enfim, eu pensei em alguma coisa mais bacana, nгo uma explosгo, e sim, perder vida em determinada бrea do spawn, onde o player й obrigado a sair do lugar em 15 segundos!
@Search
*[ajuda] Perder vida ao bater no carro!
*[AJUDA] Como fazer para o player nгo perder vida
Nгo quero nada disso, quero que o player perca vida cada segundo em determinada бrea, parecido com um GM zumbi...
Re: Perder vida com o tempo -
Coringa_Vilao - 26.11.2015
Use Settimer para o tempo,
https://sampforum.blast.hk/showthread.php?tid=151047 = para posiзгo do player;
Exemplo da vida perdendo apenas -20 ...
Код:
new Float: Vida
GetPlayerHealth(playerid, Vida);
SetPlayerHealth(playerid, Vida - 20 );
Re: Perder vida com o tempo -
cicinho - 26.11.2015
Olб F1N4L, vocк pode usar tambйm callback OnPlayerUpdate para atualizar a posiзгo do player e podemos usar IsPlayerInRangeOfPoint para verificar se o player estб naquele determinado local.
Код:
public OnPlayerUpdate(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, 1958.3783, 1343.1572, 15.3746))
{
new Float:Health;
GetPlayerHealth(playerid, Health);
SetPlayerHealth(playerid, Health-0.1);
}
return true;
}
Re: Perder vida com o tempo -
PT - 26.11.2015
Quote:
Originally Posted by cicinho
Olб F1N4L, vocк pode usar tambйm callback OnPlayerUpdate para atualizar a posiзгo do player e podemos usar IsPlayerInRangeOfPoint para verificar se o player estб naquele determinado local.
Код:
public OnPlayerUpdate(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 5.0, 1958.3783, 1343.1572, 15.3746))
{
new Float:Health;
GetPlayerHealth(playerid, Health);
SetPlayerHealth(playerid, Health-0.1);
}
return true;
}
|
Essa й a pior ideia.
Tambйm podes usar dynamic бreas para saber quando o Player entra ou sai dessa posiзгo.
Re: Perder vida com o tempo -
BykiLler - 26.11.2015
kkkkkkkk eu pensei em fazer a sim
// public on game mode init ou fliter script init
SetTimer("Perdevida" 15000);
//Em baixo da sua GM ou FS
forward Perdevida(playerid);
public Perdevida(playerid){
if(IsPlayerInRangeOfPoint(playerid, 5.0, 1958.3783, 1343.1572, 15.374){
new Float:Health;
GetPlayerHealth(playerid, Health);
SetPlayerHealth(playerid, Health-0.1);
}else{
}
return 1;
}
Re: Perder vida com o tempo -
F1N4L - 26.11.2015
Certo, mesmo definindo o 'Float' eu tenho que definir a public para fazer perder vida a cada 1 segundo (SetTimer...1000 ms....):
Preciso de algo como isso:
Quote:
forward PerderVida();
public PerderVida()
{
new Float:tmphealth;
for(new i; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
if(!(PLAYER_STATE_ONFOOT <= GetPlayerState(i) <= PLAYER_STATE_PASSENGER)) continue; //Ignores players that are dead, spectating or in class-selection
for(new e; e < sizeof(InfecAreas); e++)
{
if(IsPlayerInPlace(i, RandomSpawns[e][0], RandomSpawns[e][1], RandomSpawns[e][2], RandomSpawns[e][3]))
{
GetPlayerHealth(i, tmphealth);
tmphealth -= 1.0; //Change it to the amount that you want, the player will lose this amount of health while he is in the area
SetPlayerHealth(i, tmphealth);
break; //Stops the areas loop
}
}
return 1;
}
|
Re: Perder vida com o tempo -
F1N4L - 26.11.2015
@cicinho
Obg amigo, уtima ideia... acabei de fazer isso nesta callback e deu certo! rep+
@PT
Este mйtodo й simples e ъtil, nгo que uma бrea dinвmica nгo seja, mas optei pela atualizaзгo na callback. Obrigado pelo feedback.
Re: Perder vida com o tempo -
BykiLler - 27.11.2015
legal
Xdxd