[Ayuda] - Timers
#1

Hola a todos.
He creado un script de capturas por checkpoint, pero lo que me falla es el timer ya que cuando termina de capturar hace el proceso varias veces :S. Ademбs en los KillTimer otro problema; por ejemplo cuando el jugador sale del checkpoint se supone que debe de funcionar el KillTimer y cuando entre al checkpoint empezar a contar de nuevo, pero se guarda el tiempo cuande se sale del checkpoint y cuando entra sigue el tiempo y entonces captura mas rбpidamente. (Cabe mencionar que si utilizo /kill) el tiempo al volver a capturar es muy largo... y una vez no terminaba.
pawn Код:
//-------------------Zonas
//----------------------------TEST ZONE-------------------
//Script Capture
//----------------------------------Variables para la captura
new nunhead;
//new megafloat;
//new mountain;
//new cj;
//new bigear;
//--------------------------Fin de variables para la captura
//------------------------------Variables para Condiciones Globales
new sincapturarNUN;
new NUNteamcaptureU;
new NUNteamcaptureG;
new NUNteamcaptureN;
new NUNteamcaptureO;
//--------------------------Fin de estas variables
//--------------------------Variables para PickUps
new nuncapture;
//--------------------------Fin de estas variables
//--------------------------Variables para Timers
new TimerNUN[MAX_PLAYERS];
//new FixColorTimer[MAX_PLAYERS];
//--------------------------Fin de estas variables
//*******variables para condiciones playerid
new NUNCheckpoint[MAX_PLAYERS];
//-----------------------------------------------------
new SaveDataNUN;
//new FixColor[MAX_PLAYERS];
//--------------------------------------------------------
public OnPlayerConnect(playerid)
{
    nuncapture = CreatePickup(1247, 23, 1124.7419,-2036.7159,69.8834, -1);
    nunhead = GangZoneCreate(1063.7572,-2115.3784,1291.4698,-1977.1705);
    if(sincapturarNUN == 0)
    {
        GangZoneShowForAll(nunhead,0x7BFF0088);
    }
    else
    {
    switch(SaveDataNUN)
    {
    case 1:
    {
        GangZoneShowForPlayer(playerid,nunhead,0xCCCCCC88);
    }
    case 2:
    {
        GangZoneShowForPlayer(playerid,nunhead,0x00C3FF88);
    }
    case 3:
    {
        GangZoneShowForPlayer(playerid,nunhead,0x00000088);
    }
    case 4:
    {
        GangZoneShowForPlayer(playerid,nunhead,0xFF590088);
    }
    }
    }
}
public OnPlayerDeath(playerid, killerid, reason)
{
    KillTimer(TimerNUN[playerid]);
    TimerNUN[playerid]=-1;
    if(NUNCheckpoint[playerid] == 1)
    {
        GangZoneStopFlashForAll(nunhead);
        NUNCheckpoint[playerid] = 0;
    }
    DisablePlayerCheckpoint(playerid);
}
public OnPlayerEnterCheckpoint(playerid)
{
    if(NUNCheckpoint[playerid] == 1)
    {
    switch(gTeam[playerid])
    {
    case UPEO:
    {
        GangZoneFlashForAll(nunhead,0xCCCCCC88);
    }
    case GRDF:
    {
        GangZoneFlashForAll(nunhead,0x00C3FF88);
    }
    case OUROBOROS:
    {
        GangZoneFlashForAll(nunhead,0x00000088);
    }
    case NEUCOM:
    {
        GangZoneFlashForAll(nunhead,0xFF590088);
    }
    }
    TimerNUN[playerid] = SetTimerEx("CapturarNUN",30000,false,"i",playerid);
    }
    return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
    KillTimer(TimerNUN[playerid]);
    TimerNUN[playerid]=-1;
    if(NUNCheckpoint[playerid] == 1)
    {
        GangZoneStopFlashForAll(nunhead);
        NUNCheckpoint[playerid] = 0;
        //FixColor[playerid] = 0;
    }
    DisablePlayerCheckpoint(playerid);
    return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == nuncapture)
    {
        switch(gTeam[playerid])
        {
        case UPEO:
        {
            if(NUNteamcaptureU == 0)
            {
                SetPlayerCheckpoint(playerid, 1124.7419,-2036.7159,69.8834, 6.0);
                NUNCheckpoint[playerid] = 1;
            }
        }
        case GRDF:
        {
            if(NUNteamcaptureG == 0)
            {
                SetPlayerCheckpoint(playerid, 1124.7419,-2036.7159,69.8834, 6.0);
                NUNCheckpoint[playerid] = 1;
            }
        }
        case OUROBOROS:
        {
            if(NUNteamcaptureO == 0)
            {
                SetPlayerCheckpoint(playerid, 1124.7419,-2036.7159,69.8834, 6.0);
                NUNCheckpoint[playerid] = 1;
            }
        }
        case NEUCOM:
        {
            if(NUNteamcaptureN == 0)
            {
                SetPlayerCheckpoint(playerid, 1124.7419,-2036.7159,69.8834, 6.0);
                NUNCheckpoint[playerid] = 1;
            }
        }
        }
    }
}
forward CapturarNUN(playerid);
public CapturarNUN(playerid)
{
    /*if(FixColor[playerid] == 0){*/
    sincapturarNUN = 1;
    NUNCheckpoint[playerid] = 0;
    GivePlayerWeapon(playerid, 27, 100);
    GivePlayerMoney(playerid, 25000);
    switch(gTeam[playerid])
    {
    case UPEO:
    {
        NUNteamcaptureU = 1;
        NUNteamcaptureG = 0;
        NUNteamcaptureO = 0;
        NUNteamcaptureN = 0;
        GangZoneShowForAll(nunhead,0xCCCCCC88);
        SaveDataNUN = 1;
        //FixColor[playerid] = 0;
        SendClientMessageToAll(0xCCCCCCFF, "UPEO has captured Headquarters N.U.N.");
    }
    case GRDF:
    {
        NUNteamcaptureG = 1;
        NUNteamcaptureU = 0;
        NUNteamcaptureN = 0;
        NUNteamcaptureO = 0;
        GangZoneShowForAll(nunhead,0x00C3FF88);
        SaveDataNUN = 2;
        //FixColor[playerid] = 0;
        SendClientMessageToAll(0x00C3FFFF, "GRDF has captured Headquarters N.U.N.");
    }
    case OUROBOROS:
    {
        NUNteamcaptureO = 1;
        NUNteamcaptureU = 0;
        NUNteamcaptureN = 0;
        NUNteamcaptureG = 0;
        GangZoneShowForAll(nunhead,0x00000088);
        SaveDataNUN = 3;
        //FixColor[playerid] = 0;
        SendClientMessageToAll(0x000000FF, "OUROBOROS has captured Headquarters N.U.N.");
    }
    case NEUCOM:
    {
        NUNteamcaptureN = 1;
        NUNteamcaptureG = 0;
        NUNteamcaptureO = 0;
        NUNteamcaptureU = 0;
        GangZoneShowForAll(nunhead,0xFF590088);
        SaveDataNUN = 4;
        //FixColor[playerid] = 0;
        SendClientMessageToAll(0xFF590088, "NEUCOM has captured Headquarters N.U.N.");
    }
    }
    DisablePlayerCheckpoint(playerid);
    //FixColorTimer[playerid] = SetTimerEx("FIXCOLOR",100,true,"d",playerid);
    //}
    return 1;
}
/*forward FIXCOLOR(playerid);
public FIXCOLOR(playerid)
{
    FixColor[playerid] = 1;
}*/
EDIT: Las lineas de comentarios es el fix que le puse para que no se repitiera el proceso, de todas formas no sirviу.
Reply
#2

Podrias poner en
pawn Код:
y
para poder visualizar el codigo mejor.

Hasta pusiste cosas que estan comentadas
Reply
#3

Ya editй el post anterior, los comentarios son para ver un fix que puse (que no sirviу).

Yo mismo solucione el problema y soy novato!, me asombro que nadie responda ¬¬!
PUEDEN CERRAR TEMA -.-
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)