[Ajuda] Valores random..
#1

Assim, vou ser direto: Queria que qd o player digitasse um cmd, um valor de tempo RANDOM fosse ativado, e ao fim desse tempo random, mandasse um SendClientMessage.. Att. rep + pra quem ajudar

pawn Code:
if(strcmp("/comecartempo", cmdtext, true, 15) == 0)
{
    //Comecar tempo agora
    SendClientMessage(playerid, -1, "Acabou o tempo"); // No fim dele mandar isso
}
return 1;
att
Reply
#2

Up! Ajuda please.
Reply
#3

pawn Code:
CMD:rand(playerid)
{
    SetTimerEx("Funcao", random(60), false, "i", playerid);
    return true;
}

forward Funcao(playerid); public Funcao(playerid)
{
    SendClientMessage(playerid, -1, "Acabou o tempo");
}
Simples
Reply
#4

Sу usar isto,

PHP Code:
CMD:rand(playerid)
{
    
SetTimerEx("Lol"TRandom(random(60),random(59)), false"i"playerid);
    return 
true;
}
TRandom(minuto,segundo)
{
    
segundo *= 1000;
    
minuto *= 60 1000;
    return 
minuto segundo;
}
forward Lol(playerid);
public 
Lol(playerid)
{
    
//stuff

Tempo pode variar de 0 atй 1h e 59 minutos.
Reply
#5

qero que varie de 15 segs atй 2mins.. esqueci de especificar kk
Reply
#6

PHP Code:
new tempo;
SetTimerEx("Lol", (tempo TRandom(random(2),random(15)), tempo 120000 120000 tempo) , false"i"playerid); 
Apenas substituir por este.
Reply
#7

Quote:
Originally Posted by leonardo1434
View Post
PHP Code:
new tempo;
SetTimerEx("Lol", (tempo TRandom(random(2),random(15)), tempo 120000 120000 tempo) , false"i"playerid); 
Apenas substituir por este.
Ok, muito obrigado funcionou, agora.. Se nгo й de mais pedir, poderia me explicar como funciona a conta para mudar o tempo? Att.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)