Problemas con timer.
#1

Hola a todos ya lo siento por tener tantas dudas peroe s que estoy aprendiendo aun y tengo problemas que nunca tuve editando gm(es la primera vez que me lanzo con un gm de cero tomando sistemas y haciendo otros propios)Bueno tengo problemas con los timers.no se ejecutan de buena manera.Por ejemplo .yo tome un callback de ciudad metropolis v4 y ese public se conprueba con un timer.Bueno.en el public esta el sistema de enfermedades que comprueba si tienes la variable pcancer + de 100 te manda un mensaje con proxdetector que estas tosiendo.Bueno aca no manda el mensaje y pasa un tiempo y hace un tremendo flood mandando el mismo mensaje muchнsimas veces

IMG




Pido ayuda D: .El timer no funciona y de repente aparece todo asi floodeando
Reply
#2

No hay adivinos sin ver el cуdigo.
Reply
#3

Quote:
Originally Posted by junkbuster
Посмотреть сообщение
No hay adivinos sin ver el cуdigo.
jajaja se me olvido un detalle no xD

[spoiler]
pawn Код:
forward CarCheck();
public CarCheck()
{
new string[128];
TraceLastCall();
for(new j = 0; j<MAX_PLAYERS; j++)
{
if(IsPlayerConnected(j))
{
new Float:health;
GetPlayerHealth(j, health);
GetPlayerName(j, sendername, sizeof(sendername));
// -============ Cancer ============- //
if(Informacion[j][pCancer] > 250 && Informacion[j][pCancer] < 300)
{
if(CancerEffect[j] > 30)
{
SetHP(j, health-20);
format(string, sizeof(string), "* %s tose.", sendername);
ProxDetector(30.0, j, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
CancerEffect[j] = 0;
Informacion[j][pCancer] += 3;
}
CancerEffect[j] += 1;
}
if(Informacion[j][pCancer] > 300 && Informacion[j][pCancer] < 400)
{
if(CancerEffect[j] > 30)
{
SetHP(j, health-30);
format(string, sizeof(string), "* %s tose.", sendername);
ProxDetector(30.0, j, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
CancerEffect[j] = 0;
Informacion[j][pCancer] += 6;
}
CancerEffect[j] += 1;
}
if(Informacion[j][pCancer] > 400 && Informacion[j][pCancer] < 600)
{
if(CancerEffect[j] > 30)
{
SetHP(j, health-40);
format(string, sizeof(string), "* %s tose.", sendername);
ProxDetector(30.0, j, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
CancerEffect[j] = 0;
Informacion[j][pCancer] += 10;
}
CancerEffect[j] += 1;
}
// -===================== Epilepsia =================- //
if(cEpilepsia[j] == 0)
{
if(Informacion[j][pEpilepsia] > 250 && Informacion[j][pEpilepsia] < 350)
{
if(EpilepsiaCrack[j] > 50)
{
ApplyAnimation(j, "CRACK", "crckdeth2", 2.5, 0, 0, 0, 1, 60000);
ApplyAnimation(j, "CRACK", "crckdeth2", 2.5, 0, 0, 0, 1, 60000);
format(string, sizeof(string), "* %s se cae y empieza a echar saliva.", sendername);
ProxDetector(30.0, j, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
EpilepsiaCrack[j] = 0;
Informacion[j][pEpilepsia] += 10;
SetHP(j, health-30);
SetPlayerDrunkLevel(j, 30000);
}
EpilepsiaCrack[j] += 1;
}
if(Informacion[j][pEpilepsia] > 350 && Informacion[j][pEpilepsia] < 600)
{
if(EpilepsiaCrack[j] > 50)
{
ApplyAnimation(j, "CRACK", "crckdeth1", 2.5, 0, 0, 0, 1, 90000);
ApplyAnimation(j, "CRACK", "crckdeth1", 2.5, 0, 0, 0, 1, 90000);
format(string, sizeof(string), "* %s se cae y empieza a echar saliva.", sendername);
ProxDetector(30.0, j, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
EpilepsiaCrack[j] = 0;
Informacion[j][pEpilepsia] += 20;
SetHP(j, health-40);
SetPlayerDrunkLevel(j, 40000);
}
EpilepsiaCrack[j] += 1;
}
if(Informacion[j][pEpilepsia] > 600)
{
if(EpilepsiaCrack[j] > 50)
{
ApplyAnimation(j, "CRACK", "crckdeth3", 2.5, 0, 0, 0, 1, 120000);
ApplyAnimation(j, "CRACK", "crckdeth3", 2.5, 0, 0, 0, 1, 120000);
format(string, sizeof(string), "* %s se cae y empieza a echar saliva.", sendername);
ProxDetector(30.0, j, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
EpilepsiaCrack[j] = 0;
Informacion[j][pEpilepsia] += 30;
SetHP(j, health-60);
SetPlayerDrunkLevel(j, 50000);
//new death = random(10);
//if(death == 2) { PlayerHasDeath(j, 2); }
}
EpilepsiaCrack[j] += 1;
}
}
// -==================== SIDA ======================- //
if(Informacion[j][pSIDA] > 0 && Informacion[j][pSIDA] < 2)
{
if(SIDA[j] > 30)
{
ApplyAnimation(j, "FOOD", "EAT_Vomit_P", 3.0, 0, 0, 0, 0, 5000);
ApplyAnimation(j, "FOOD", "EAT_Vomit_P", 3.0, 0, 0, 0, 0, 5000);
format(string, sizeof(string), "* %s vomita.", sendername);
ProxDetector(30.0, j, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
if(health > 15) { SetHP(j, health-50); }
}
SIDA[j] -= 1;
}
if(Informacion[j][pSIDA] > 1 && Informacion[j][pSIDA] < 3)
{
if(SIDA[j] > 20)
{
ApplyAnimation(j, "FOOD", "EAT_Vomit_P", 3.0, 0, 0, 0, 0, 10000);
ApplyAnimation(j, "FOOD", "EAT_Vomit_P", 3.0, 0, 0, 0, 0, 10000);
format(string, sizeof(string), "* %s vomita.", sendername);
ProxDetector(30.0, j, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
if(health > 15) { SetHP(j, health-76); }
}
SIDA[j] -= 1;
}
if(Informacion[j][pSIDA] > 3)
{
if(SIDA[j] > 10)
{
ApplyAnimation(j, "FOOD", "EAT_Vomit_P", 3.0, 0, 0, 0, 0, 15000);
ApplyAnimation(j, "FOOD", "EAT_Vomit_P", 3.0, 0, 0, 0, 0, 15000);
format(string, sizeof(string), "* %s vomita.", sendername);
ProxDetector(30.0, j, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
if(health > 15) { SetHP(j, health-70); }
}
SIDA[j] -= 1;
}
}
}
return 1;
}
[/spoiler]

pawn Код:
new cartimer;
/*Ongamememodeinit*/
cartimer = SetTimer("CarCheck", 30000, 1);
me habia olvidado el codigo xD
Reply
#4

No entiendo nada, ese cуdigo es un quilombo pero mi recomendaciуn al flood ese es que hagas una variable y chequee para que no vuelva a mandar el mensaje (recordб que si haces esto, no olvides ponerla en 0 nuevamente al cumplir la funciуn ya que podes tener problemas).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)