[Ajuda] 50 Segundos pra acontecer... - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: Non-English (
https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (
https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (
https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] 50 Segundos pra acontecer... (
/showthread.php?tid=497265)
50 Segundos pra acontecer... -
eNtinityGaming - 25.02.2014
Tipo quando carrega o caminhao e tals, vai andando de boa, ai tu sai do caminhгo perde a carga, eu queria q tivesse um tempo de 50 segundos, ai se ele voltar pro caminhao em menos de 50 segundos ele n perderia a carga, caso n consiga chegar a tempo dentro do caminhгo perderia a carga...
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
if (Carregamento[playerid] == 1)
{
SendClientMessage(playerid, COR_VERMELHO, "(») Vocк saiu do Veiculo e perdeu sua carga volte para o carregamento!");
Carregamento[playerid] = 0;
return 1;
}
return 1;
}
Re: 50 Segundos pra acontecer... -
Dieguinho - 25.02.2014
use :
pawn Код:
SetTimer("caminhao", 5000, false); // Set a timer of 1000 miliseconds (1 second)
//exemplo
forward caminhao();
public caminhao()
{
//funзгo
}
//quando ele entrar usar
KillTimer(caminhao);
https://sampwiki.blast.hk/wiki/SetTimer // setime
https://sampwiki.blast.hk/wiki/KillTimer // cancela o time
Re: 50 Segundos pra acontecer... -
RockFire - 25.02.2014
pawn Код:
new
g_TimerID[MAX_PLAYERS];
g_Vehicle_Carregamento[MAX_PLAYERS];
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(Carregamento[playerid])
{
g_TimerID[playerid] = SetTimerEx("GoBackToYourVehicle", 50000, false, "d", playerid);
SendClientMessage(playerid, COR_VERMELHO, "(») Volte para seu veнculo ou perderб sua carga!");
g_Vehicle_Carregamento[playerid] = vehicleid;
}
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(Carregamento[playerid] && !ispassenger && vehicleid == g_Vehicle_Carregamento[playerid])
{
KillTimer(g_TimerID[playerid]);
SendClientMessage(playerid, COR_VERMELHO, "(») Vocк voltou para seu veнculo BLABLABLA!");
}
return 1;
}
forward GoBackToYourVehicle(playerid);
public GoBackToYourVehicle(playerid)
{
SendClientMessage(playerid, COR_VERMELHO, "(») Vocк nгo voltou para seu veнculo a tempo e perdeu sua carga.");
Carregamento[playerid] = 0;
return 1;
}
Й sу vocк criar um timer e destruн-lo quando o player voltar ao veнculo.
Vocк pode usar OnPlayerStateChange no lugar de OnPlayerEnterVehicle.