FATAL ERROR (shutting down): Host_Error: WriteDest_Parm: not a client
#1
Bueh, hace rato que no posteo aca pacman

Tengo un problemita con este plugin que consegui online y lo modifique a mi gusto para que funcionara en mi server (zombie escape.) El problema es que cuando sale la explocion final, el server se cae con este mensaje:
Código PHP:
FATAL ERROR (shutting down): Host_ErrorWriteDest_Parmnot a client 

Hice chequeos que si el usuario esta conectado en casi todas las funciones y todavia se sigue cayendo, aca esta el code:

Bueh, parece que se soluciono poniendole un is_user_connected al timer_stop y al timer_start pacman

Borren esto porfa pacman
[Imagen: EvoLogo.png.fbcccbc49fb32e6a4bf8f5e72d80c317.png]
nalgas

(03/08/2018, 03:13 PM)Skylar escribió: Está bien que pidas ayudas, pero no para que crees 20 post todos los días mogolico de mierda, me tenes re podrido ya, contraté 10000 sicarios para que te busquen y te maten toda la familia, y a vos que te revienten con una bazooka.
Responder
#2
(13/02/2018, 03:09 AM)elpapimejor escribió: Bueh, hace rato que no posteo aca pacman

Tengo un problemita con este plugin que consegui online y lo modifique a mi gusto para que funcionara en mi server (zombie escape.) El problema es que cuando sale la explocion final, el server se cae con este mensaje:
Código PHP:
FATAL ERROR (shutting down): Host_ErrorWriteDest_Parmnot a client 

Hice chequeos que si el usuario esta conectado en casi todas las funciones y todavia se sigue cayendo, aca esta el code:
Código PHP:
/*

+--------------------------------------+
|      DeathRun Timer - 2015-2016      |
|                                      |
| Author:                              |
|         deniS[MD] a.k.a icimaro1337  |
| Credits:                             |
|         xPaw[EE]                     |
|         Mistrick[RU]                 |
|         Keniski[RU]                  |
|         Klippy[RS]                   |
+--------------------------------------+

*/

#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <nvault>
#include <sqlx>
#include <geoip>
#include <dhudmessage>

#pragma semicolon 1

// Here you can configure main settings

#define TASK_START

new const g_szPrefix[] = "Force Gaming";

const 
maxplayers 32;
new 
g_maxplayers;
#define ADMIN_ACCESS ADMIN_CVAR

// Here you stop

/* Macro */

#define set_bit(%1,%2)    (%1 |= (1<<%2))
#define get_bit(%1,%2)    (%1 & (1<<%2))
#define clr_bit(%1,%2)    (%1 &= ~(1<<%2))
#define is_user_valid_connected(%1) (1 <= %1 <= g_maxplayers && get_bit(g_bConnected, %1))

/* Macro */

new const g_szVersion[] = "0.1";

new const 
g_szTableName[] = "ZERECORDS_STATS";

new 
g_pWebLink;

new 
Handle:g_hSqlTuple;

new 
bool:g_bSqlite;

new 
g_szMapName[64];

new 
Trie:g_tStartsTrie:g_tStops;

new 
bool:g_bTimerFound;

enum _:eTimer
{
    
START,
    
STOP
};

new 
g_szTimerModels[eTimer][] =
{
    
"sprites/FG_ze/FG_meta_starts.spr",
    
"models/FG_ze/FG_meta.mdl"
};
new 
g_szTimerName[eTimer][] =
{
    
"Start",
    
"Stop"
};

new 
g_iTimer[eTimer];
new 
Float:g_vTimerOrigin[eTimer][3];

new 
g_iTimerAngles[eTimer];
new 
Float:g_flTimerAngles[4] =
{
    
0.0,
    
90.0,
    
180.0,
    
270.0
};

new 
g_iPlayerTimer[33];

new 
g_bConnectedg_bAliveg_bStarted;

new 
Float:g_flStartTime[33], Float:g_flFinishTime[33];

new 
g_iVault;

new 
g_iMsgRoundTime;

new 
g_iHudSyncObj;

public 
plugin_precache()
{
    for (new 
0eTimeri++)
        
precache_model(g_szTimerModels[i]);
}
public 
plugin_init()
{
    
register_plugin("DeathRun Timer"g_szVersion"deniS");
    
    
g_pWebLink register_cvar("ze_timer_web_link""http://www.fgaming.pro/records");// link to web files
    
    
register_cvar("ze_timer_sql_host""127.0.0.1");
    
register_cvar("ze_timer_sql_user""records_user");
    
register_cvar("ze_timer_sql_pass""records_user");
    
register_cvar("ze_timer_sql_db""records"); /* If you don't have web server, you can use local stats, just add .db like deathrun_stats.db and enable sqlite module! */
    
g_maxplayers get_maxplayers();
    
get_mapname(g_szMapNamecharsmax(g_szMapName));
    
    
g_tStarts    TrieCreate();
    
g_tStops    TrieCreate();
    
    new 
iiSize;
    
    new const 
szStarts[][] =
    {
        
"counter_start""clockstartbutton""firsttimerelay""but_start""counter_start_button",
        
"multi_start""timer_startbutton""start_timer_emi""gogogo"
    
};
    
iSize sizeof(szStarts);
    
    for (
0iSizei++)
        
TrieSetCell(g_tStartsszStarts[i], 1);
    
    new const 
szStops[][] =
    {
        
"counter_off""clockstopbutton""clockstop""but_stop""counter_stop_button",
        
"multi_stop""stop_counter""m_counter_end_emi"
    
};
    
iSize sizeof(szStops);
    
    for (
0iSizei++)
        
TrieSetCell(g_tStopsszStops[i], 1);
    
    new 
iEntity = -1;
    
    while ((
iEntity find_ent_by_class(iEntity"func_button")) != 0)
    {
        new 
szTargetName[64];
        
entity_get_string(iEntityEV_SZ_targetnameszTargetNamecharsmax(szTargetName));
        
        if (
TrieKeyExists(g_tStartsszTargetName) || TrieKeyExists(g_tStopsszTargetName))
        {
            if (!
g_bTimerFound)
                
g_bTimerFound true;
            
            break;
        }
    }
    
    if (!
g_bTimerFound)
    {
        
TrieDestroy(g_tStarts);
        
TrieDestroy(g_tStops);
        
        new 
szFile[96];
        
formatex(szFilecharsmax(szFile), "%s"g_szMapName);
        
        
g_iVault nvault_open(szFile);

        
//Make the plugin error if vault did not successfully open
        
if ( g_iVault == INVALID_HANDLE )
            
server_print"Error opening nVault." );        
        else
            
server_print("nVault Opened.");

        
LoadTimers();
    }
    
    
//iEntity = create_entity("info_target");
    
    /*if (iEntity)
    {
        entity_set_float(iEntity, EV_FL_nextthink, get_gametime() + 0.5);
        entity_set_string(iEntity, EV_SZ_classname, "_TimerThink");
        register_think("_TimerThink", "TimerThink");
    }*/
    
    
g_iMsgRoundTime get_user_msgid("RoundTime");
    
    
RegisterHam(Ham_Spawn"player""HamSpawnPlayer_Post"true);
    
RegisterHam(Ham_Killed"player""HamKilledPlayer_Post"true);
    
//RegisterHam(Ham_Use, "func_button", "HamUseFuncButton_Pre", false);
    
register_forward(FM_Touch"fw_Touch");
    
register_event("HLTV""event_round_start""a""1=0""2=0");
    
    
register_clcmd("say /timer""ClCmdTimer");
    
register_clcmd("say_team /timer""ClCmdTimer");
    
    
register_clcmd("say /best""ClCmdBest");
    
register_clcmd("say_team /best""ClCmdBest");
    
    
g_iHudSyncObj CreateHudSyncObj();
}

// Event Round Start
public event_round_start()
{

    for(new 
0g_maxplayersi++)
    {
        if(!
is_user_valid_connected(i))
            return;
        
        
Timer_Start(i);
    }

}

public 
plugin_cfg()
{
    
set_task(0.5"DB_Init");
}
public 
DB_Init()
{
    
state mysql;
    
    new 
szDB[64];
    
get_cvar_string("ze_timer_sql_db"szDBcharsmax(szDB));
    
    if (
contain(szDB".") > 0)
    {
        
state sqlite;
        
        
g_bSqlite true;
    }
    
    
SQL_Init();
}
SQL_Init()<mysql>
{
    new 
szHost[64], szUser[64], szPass[64], szDB[64];
    
get_cvar_string("ze_timer_sql_host"szHostcharsmax(szHost));
    
get_cvar_string("ze_timer_sql_user"szUsercharsmax(szUser));
    
get_cvar_string("ze_timer_sql_pass"szPasscharsmax(szPass));
    
get_cvar_string("ze_timer_sql_db"szDBcharsmax(szDB));
    
    
g_hSqlTuple SQL_MakeDbTuple(szHostszUserszPassszDB);
    
    new 
szQuery[512];
    
    
formatex
    
(
        
szQuerycharsmax(szQuery),
        
"CREATE TABLE IF NOT EXISTS `%s` \
        ( \
            `ID`                INT                NOT NULL    AUTO_INCREMENT, \
             \
            `MAPNAME`            VARCHAR(64)        NOT NULL, \
            `AUTHID`            VARCHAR(32)        NOT NULL, \
            `NICKNAME`            VARCHAR(64)        NOT NULL, \
            `IP`                VARCHAR(45)        NOT NULL, \
            `COUNTRY_FULL`        VARCHAR(45)        NOT NULL, \
            `COUNTRY_SHORT`        VARCHAR(3)        NOT NULL, \
            `TIME`                DOUBLE            NOT NULL, \
            `DATE`                DATETIME        NOT NULL, \
             \
            PRIMARY KEY(`ID`) \
        )"
,
        
g_szTableName
    
);
    
    
SQL_ThreadQuery(g_hSqlTuple"Sql_IgnoredQuery_Handler"szQuery);
}
SQL_Init()<sqlite>
{
    
SQL_SetAffinity("sqlite");
    
    new 
szDataDir[128];
    
get_localinfo("amxx_datadir"szDataDircharsmax(szDataDir));
    
    new 
szDB[64];
    
get_cvar_string("ze_timer_sql_db"szDBcharsmax(szDB));
    
    new 
szFile[196];
    
formatex(szFilecharsmax(szFile), "%s/%s"szDataDirszDB);
    
    if (!
file_exists(szFile))
    {
        new 
fp fopen(szFile"w");
        
        if (!
fp)
        {
            
log_amx("[%s] SQL_Init()<sqlite>: File ^"%s^" not found and can't be created!"g_szPrefixszFile);
            return;
        }
        else
            
fclose(fp);
    }
    
    
g_hSqlTuple SQL_MakeDbTuple(""""""szFile0);
    
    new 
szQuery[512];
    
    
formatex
    
(
        
szQuerycharsmax(szQuery),
        
"CREATE TABLE IF NOT EXISTS `%s` \
        ( \
            `MAPNAME`                TEXT            NOT NULL, \
            `AUTHID`                TEXT            NOT NULL, \
            `NICKNAME`                TEXT            NOT NULL, \
            `IP`                    TEXT            NOT NULL, \
            `COUNTRY_FULL`            TEXT            NOT NULL, \
            `COUNTRY_SHORT`            TEXT            NOT NULL, \
            `TIME`                    REAL            NOT NULL, \
            `DATE`                    DATETIME        NOT NULL \
        )"
,
        
g_szTableName
    
);
    
    
SQL_ThreadQuery(g_hSqlTuple"Sql_IgnoredQuery_Handler"szQuery);
}
public 
client_putinserver(id)
{
    
set_bit(g_bConnectedid);
}
public 
client_disconnect(id)
{
    
clr_bit(g_bConnectedid);
    
    if (
get_bit(g_bAliveid))
        
clr_bit(g_bAliveid);
    
    if (
get_bit(g_bStartedid))
        
clr_bit(g_bStartedid);
    
    if (
g_flStartTime[id] != 0.0)
        
g_flStartTime[id] = 0.0;
    
    if (
g_flFinishTime[id] != 0.0)
        
g_flFinishTime[id] = 0.0;
}
public 
HamSpawnPlayer_Post(id)
{
    if(!
is_user_valid_connected(id))
        return ;

    
set_bit(g_bAliveid);
    
    if (
get_bit(g_bStartedid))
    {
        
clr_bit(g_bStartedid);
        
        
g_flStartTime[id] = 0.0;

        
Timer_Start(id);
    }
}

public 
HamKilledPlayer_Post(id)
{
    if(!
is_user_valid_connected(id))
        return ;

    
clr_bit(g_bAliveid);
    
    if (
get_bit(g_bStartedid))
    {
        
clr_bit(g_bStartedid);
        
        
g_flStartTime[id] = 0.0;
    }
}

public 
fw_Touch(entvictim) {

    if (!
get_bit(g_bAlivevictim))
        return(
HAM_IGNORED);

    if (!
pev_valid(ent))
        return 
FMRES_IGNORED;

    
/*new EntClassName[32]
    entity_get_string(ent, EV_SZ_classname, EntClassName, charsmax(EntClassName))
        
    if(equal(EntClassName, "meta") && is_user_alive(victim) && !g_touched[victim])
        load_record(victim)*/

    
if (g_bTimerFound)
    {
        new 
szTarget[32];
        
entity_get_string(entEV_SZ_targetszTargetcharsmax(szTarget));
        
        if (
TrieKeyExists(g_tStartsszTarget))
            
Timer_Start(victim);
        else if (
TrieKeyExists(g_tStopsszTarget))
            
Timer_Stop(victim);
    }
    else
    {
        if (
ent == g_iTimer[START])
            
Timer_Start(victim);
        else if (
ent == g_iTimer[STOP])
            
Timer_Stop(victim);
    }
        
    return 
FMRES_IGNORED;
}

Timer_Start(id)
{
    
set_dhudmessage(25500, -1.00.902_3.00.11.5false);
    if (!
get_bit(g_bStartedid))
    {
        
set_bit(g_bStartedid);
        
        
show_dhudmessage(id"Tiempo Iniciado!");
    }
    else
        
show_dhudmessage(id"Tiempo Iniciado!");
    
    
g_flStartTime[id] = get_gametime();
}
Timer_Stop(id)
{
    if (!
get_bit(g_bStartedid))
        return;
    
    
clr_bit(g_bStartedid);
    
    
g_flFinishTime[id] = get_gametime() - g_flStartTime[id];
    
    
g_flStartTime[id] = 0.0;
    
    
/*message_begin(MSG_ONE_UNRELIABLE, g_iMsgRoundTime, _, id);
    write_short(1);
    message_end();*/
    
    
new szTime[17];
    
ClimbtimeToString(g_flFinishTime[id], szTimecharsmax(szTime));

    
client_print(idprint_chat"[%s] Llegaste a la meta en %s!"g_szPrefixszTime);
    
    new 
iPlayers[maxplayers], iNum;
    
get_players(iPlayersiNum"ch");
    
    if (
iNum)
    {
        new 
szName[32];
        
get_user_name(idszNamecharsmax(szName));
        
        new 
iPlayer;
        
        for (new 
0iNumi++)
        {
            if(!
is_user_valid_connected(i))
                return;

            
iPlayer iPlayers[i];
            
            if (
iPlayer == id)
                continue;
        }
    }
    
    new 
szAuthID[32];
    
get_user_authid(idszAuthIDcharsmax(szAuthID));
    
    new 
szQuery[512], cData[1]; cData[0] = id;
    
    
formatex
    
(
        
szQuerycharsmax(szQuery),
        
"SELECT \
            `TIME` \
        FROM \
            `%s` \
        WHERE \
            `MAPNAME` = '%s' \
        AND \
            `AUTHID` = '%s'"
,
        
g_szTableName,
        
g_szMapName,
        
szAuthID
    
);
    
    
SQL_ThreadQuery(g_hSqlTuple"Sql_QueryTop_Handler"szQuerycDatasizeof(cData));
}
public 
Sql_QueryTop_Handler(iFailStateHandle:hQueryszError[], iErrorcData[], iSize)
{
    if (
iFailState != TQUERY_SUCCESS)
    {
        
log_amx("[%s] Sql_IgnoredQuery_Handler(): SQL_Error #%d - %s"g_szPrefixiErrorszError);
        return;
    }
    
    new 
id cData[0];
    
    if (!
get_bit(g_bConnectedid))
        return;
    
    new 
szAuthID[32], szName[64], szIP[32], szCountryFull[45], szCountryShort[3], szDate[32];
    
get_user_authid(idszAuthIDcharsmax(szAuthID));
    
get_user_name(idszNamecharsmax(szName));
    
get_user_ip(idszIPcharsmax(szIP), 1);
    
geoip_country(szIPszCountryFullcharsmax(szCountryFull));
    
geoip_code2(szIPszCountryShort);
    
get_time("%Y%m%d%H%M%S"szDatecharsmax(szDate));
    
    
SQL_PrepareString(szNameszNamecharsmax(szName));
    
    new 
szQuery[512];
    
    if (
SQL_NumResults(hQuery))
    {
        new 
Float:flOldTimeFloat:flResultszTime[17];
        
        
SQL_ReadResult(hQuery0flOldTime);
        
        if (
g_flFinishTime[id] < flOldTime)
        {
            
flResult flOldTime g_flFinishTime[id];
            
            
ClimbtimeToString(flResultszTimecharsmax(szTime));
            
            
client_print(idprint_chat"[%s] Mejoraste tu tiempo por %s milisegundos!"g_szPrefixszTime);
            
            
formatex
            
(
                
szQuerycharsmax(szQuery),
                
"UPDATE `%s` \
                SET \
                    `NICKNAME`            = '%s', \
                    `IP`                = '%s', \
                    `COUNTRY_FULL`        = '%s', \
                    `COUNTRY_SHORT`        = '%s', \
                    `TIME`                = '%f', \
                    `DATE`                = '%s' \
                WHERE \
                    `MAPNAME`            = '%s' \
                AND \
                    `AUTHID`            = '%s'"
,
                
g_szTableName,
                
szName,
                
szIP,
                
szCountryFull,
                
szCountryShort,
                
g_flFinishTime[id],
                
szDate,
                
g_szMapName,
                
szAuthID
            
);
            
            
SQL_ThreadQuery(g_hSqlTuple"Sql_IgnoredQuery_Handler"szQuery);
            
            
formatex
            
(
                
szQuerycharsmax(szQuery),
                
"SELECT \
                    `AUTHID` \
                FROM \
                    `%s` \
                WHERE \
                    MAPNAME='%s' \
                ORDER BY \
                    `TIME` \
                LIMIT 15"
,
                
g_szTableName,
                
g_szMapName
            
);
            
            
SQL_ThreadQuery(g_hSqlTuple"Sql_GetPlaceQuery_Handler"szQuerycDatasizeof(cData[]));
        }
        else
        {
            
flResult g_flFinishTime[id] - flOldTime;
            
            
ClimbtimeToString(flResultszTimecharsmax(szTime));

            
client_print(idprint_chat"[%s] Fallaste tu tiempo por %s milisegundos!"g_szPrefixszTime);
        }
    }
    else
    {
        
formatex
        
(
            
szQuerycharsmax(szQuery),
            
"INSERT INTO `%s` \
            ( \
                `MAPNAME`, \
                `AUTHID`, \
                `NICKNAME`, \
                `IP`, \
                `COUNTRY_FULL`, \
                `COUNTRY_SHORT`, \
                `TIME`, \
                `DATE` \
            ) \
             \
            VALUES \
            ( \
                '%s', \
                '%s', \
                '%s', \
                '%s', \
                '%s', \
                '%s', \
                '%f', \
                '%s' \
            )"
,
            
g_szTableName,
            
g_szMapName,
            
szAuthID,
            
szName,
            
szIP,
            
szCountryFull,
            
szCountryShort,
            
g_flFinishTime[id],
            
szDate
        
);
        
        
SQL_ThreadQuery(g_hSqlTuple"Sql_IgnoredQuery_Handler"szQuery);
        
        
formatex
        
(
            
szQuerycharsmax(szQuery),
            
"SELECT \
                `AUTHID` \
            FROM \
                `%s` \
            WHERE \
                MAPNAME='%s' \
            ORDER BY \
                `TIME` \
            LIMIT 15"
,
            
g_szTableName,
            
g_szMapName
        
);
        
        
SQL_ThreadQuery(g_hSqlTuple"Sql_GetPlaceQuery_Handler"szQuerycDatasizeof(cData[]));
    }
    
    
g_flFinishTime[id] = 0.0;
}
public 
Sql_GetPlaceQuery_Handler(iFailStateHandle:hQueryszErroriErrorcData[], iSize)
{
    if (
iFailState != TQUERY_SUCCESS)
    {
        
log_amx("[%s] Sql_GetPlaceQuery_Handler(): SQL_Error #%d - %s"g_szPrefixiErrorszError);
        return;
    }
    
    new 
id cData[0];
    
    if (!
get_bit(g_bConnectedid))
        return;
    
    new 
szAuthID[32];
    
get_user_authid(idszAuthIDcharsmax(szAuthID));
    
    new 
iszAuthID_SQL[32];
    
    while(
SQL_MoreResults(hQuery))
    {
        
i++;
        
        
SQL_ReadResult(hQuery0szAuthID_SQLcharsmax(szAuthID_SQL));
        
        if (
equal(szAuthIDszAuthID_SQL))
        {
            
client_print(idprint_chat"[%s] Estas de lugar %d En el top de este mapa!"g_szPrefixi);
            
            new 
iPlayers[maxplayers], iNum;
            
get_players(iPlayersiNum"ch");
            
            if (
iNum)
            {
                new 
szName[32];
                
get_user_name(idszNamecharsmax(szName));
                
                new 
iPlayer;
                
                for (new 
0iNumi++)
                {
                    if(
is_user_valid_connected(i))
                        return;
                    
iPlayer iPlayers[i];
                    
                    if (
iPlayer == id)
                        continue;
                }
            }
            break;
        }
        
SQL_NextRow(hQuery);
    }
}
public 
Sql_IgnoredQuery_Handler(iFailStateHandle:hQueryszError[], iErrorcData[], iSize)
{
    if (
iFailState != TQUERY_SUCCESS)
    {
        
log_amx("[%s] Sql_IgnoredQuery_Handler(): SQL_Error #%d - %s"g_szPrefixiErrorszError);
        return;
    }
}
public 
ClCmdBest(id)
{
    if (!
g_bSqlite)
    {
        new 
szWebLink[128];
        
get_pcvar_string(g_pWebLinkszWebLinkcharsmax(szWebLink));
        
        new 
szMotd[256];
        
formatex(szMotdcharsmax(szMotd), "<META HTTP-EQUIV=^"REFRESH^" CONTENT=^"0;URL=%s/maptop.php?mapname=%s^">"szWebLinkg_szMapName);
        
        
show_motd(idszMotd"DR - Map Top");
    }
    else
    {
        new 
szQuery[512], cData[1]; cData[0] = id;
        
        
formatex
        
(
            
szQuerycharsmax(szQuery),
            
"SELECT \
                `NICKNAME`, \
                `TIME` \
            FROM \
                `%s` \
            WHERE \
                `MAPNAME` = '%s' \
            ORDER BY \
                `TIME` \
            LIMIT 15"
,
            
g_szTableName,
            
g_szMapName
        
);
        
        
SQL_ThreadQuery(g_hSqlTuple"Sql_LoadTopQuery_Handler"szQuerycDatasizeof(cData));
    }
}
public 
Sql_LoadTopQuery_Handler(iFailStateHandle:hQueryszErroriErrorcData[], iSize)
{
    if (
iFailState != TQUERY_SUCCESS)
    {
        
log_amx("[%s] Sql_GetPlaceQuery_Handler(): SQL_Error #%d - %s"g_szPrefixiErrorszError);
        return;
    }
    
    new 
id cData[0];
    
    if (!
get_bit(g_bConnectedid))
        return;
    
    new 
szMotd[1536], iSize charsmax(szMotd);
    
    new 
iLen formatex
    
(
        
szMotdiSize,
        
"<!DOCTYPE HTML> \
        <html> \
        <head> \
            <style type=^"
text/css^"> \
                body \
                { \
                    background: #000; \
                    margin: 8px; \
                    color: #FFB000; \
                    font: normal 16px/20px Verdana, Tahoma, sans-serif; \
                    text-align: center; \
                } \
                th:nth-child(2){ text-align: left; } \
                td:nth-child(2){ text-align: left; } \
            </style> \
        </head> \
        <body>"
    
);
    
    
iLen += formatex
    
(
        
szMotd[iLen], iSize iLen,
        
"<table align=^"center^" width=^"90%%^"> \
            <tr> \
                <th width=^"
5%%^">#</th>\
                <th width=^"
40%%^">Player</th>\
                <th width=^"
20%%^">Time</th>\
            </tr> \
        "
    
);
    
    new 
1;
    new 
Float:flTimeszName[32], szTime[32];
    
    while (
SQL_MoreResults(hQuery))
    {
        
SQL_ReadResult(hQuery0szName31);
        
SQL_ReadResult(hQuery1flTime);
        
        
ClimbtimeToString(flTimeszTime16);
        
        
iLen += formatex
        
(
            
szMotd[iLen], iSize iLen,
            
"<tr> \
                <td>%d</td> \
                <td>%s</td> \
                <td>%s</td> \
            </tr>"
,
            
i,
            
szName,
            
szTime
        
);
        
        
i++;
        
SQL_NextRow(hQuery);
    }
    
    
formatex
    
(
        
szMotd[iLen], iSize iLen,
        
"</table> \
        </body> \
        </html>"
    
);
    
    
show_motd(idszMotd"DR - Map Top");
}
stock SQL_PrepareString(const szQuery[], szOutPut[], iSize)
{
    
copy(szOutPutiSizeszQuery);
    
replace_all(szOutPutiSize"'""\'");
    
replace_all(szOutPutiSize"`""\`");
    
replace_all(szOutPutiSize"\\""\\\\");
}
ClimbtimeToString(Float:flClimbTimeszOutPut[], iLen)
{
    new 
iMinutes floatround(flClimbTime 60.0floatround_floor);
    new 
iSeconds floatround(flClimbTime iMinutes 60floatround_floor);
    new 
iMiliSeconds floatround((flClimbTime - (iMinutes 60 iSeconds)) * 100floatround_floor);
    
    
formatex(szOutPutiLen"%02i:%02i.%02i"iMinutesiSecondsiMiliSeconds);
}
public 
ClCmdTimer(id)
{
    if (~
get_user_flags(id) & ADMIN_ACCESS)
    {
        
client_print(idprint_chat"[%s] You don't have enought access!"g_szPrefix);
        
        return(
PLUGIN_HANDLED);
    }
    if (
g_bTimerFound)
    {
        
client_print(idprint_chat"[%s] This map already have timers!"g_szPrefix);
        return(
PLUGIN_HANDLED);
    }
    if (!
get_bit(g_bAliveid))
    {
        
client_print(idprint_chat"[%s] You should be alive!"g_szPrefix);
        return(
PLUGIN_HANDLED);
    }
    
    
TimerMenu(id);
    
    return(
PLUGIN_HANDLED);
}
public 
TimerMenu(id)
{
    new 
iMenu menu_create("\r[ZE]\y Timer Menu""TimerMenu_Handler");
    
    
menu_additem(iMenu"Create");
    
menu_additem(iMenu"Rotate^n");
    
    
menu_additem(iMenu"Save^n");
    
    new 
szMenuItem[64];
    
formatex(szMenuItemcharsmax(szMenuItem), "Timer - (\y%s\w)"g_szTimerName[g_iPlayerTimer[id]]);
    
menu_additem(iMenuszMenuItem);
    
    
menu_display(idiMenu);
}
public 
TimerMenu_Handler(idiMenuiItem)
{
    if (
iItem == MENU_EXIT)
    {
        
menu_destroy(iMenu);
        return(
PLUGIN_HANDLED);
    }
    
    switch (
iItem)
    {
        case 
0create_timer(idg_iPlayerTimer[id]);
        case 
1:
        {
            if (
is_valid_ent(g_iTimer[g_iPlayerTimer[id]]))
            {
                switch (
g_iTimerAngles[g_iPlayerTimer[id]])
                {
                    case 
3g_iTimerAngles[g_iPlayerTimer[id]] = 0;
                    case 
012g_iTimerAngles[g_iPlayerTimer[id]]++;
                }
                
                new 
Float:vAngles[3];
                
vAngles[1] = g_flTimerAngles[g_iTimerAngles[g_iPlayerTimer[id]]];
                
                
entity_set_vector(g_iTimer[g_iPlayerTimer[id]], EV_VEC_anglesvAngles);
            }
        }
        case 
2:
        {
            if (
is_valid_ent(g_iTimer[g_iPlayerTimer[id]]))
            {
                if (
g_iVault == INVALID_HANDLE)
                    return(
PLUGIN_HANDLED);
                
                new 
szData[128], iTimestamp;
                
                if (
nvault_lookup(g_iVaultg_szTimerName[g_iPlayerTimer[id]], szDatacharsmax(szData), iTimestamp))
                    
nvault_remove(g_iVaultg_szTimerName[g_iPlayerTimer[id]]);
                
                
formatex(szDatacharsmax(szData), "^"%.1f^" ^"%.1f^" ^"%.1f^" ^"%d^""g_vTimerOrigin[g_iPlayerTimer[id]][0], g_vTimerOrigin[g_iPlayerTimer[id]][1], g_vTimerOrigin[g_iPlayerTimer[id]][2], g_iTimerAngles[g_iPlayerTimer[id]]);
                
                
nvault_set(g_iVaultg_szTimerName[g_iPlayerTimer[id]], szData);
                
                
client_print(idprint_chat"[%s] Timer (%s) saved!"g_szPrefixg_szTimerName[g_iPlayerTimer[id]]);
            }
        }
        case 
3:
        {
            switch (
g_iPlayerTimer[id])
            {
                case 
STARTg_iPlayerTimer[id] = STOP;
                case 
STOPg_iPlayerTimer[id] = START;
            }
        }
    }
    
    
ClCmdTimer(id);
    return(
PLUGIN_HANDLED);
}
LoadTimers()
{
    if (
g_iVault == INVALID_HANDLE)
        return;
    
    for (new 
02i++)
    {
        new 
szData[128], iTimestamp;
        if (
nvault_lookup(g_iVaultg_szTimerName[i], szDatacharsmax(szData), iTimestamp))
        {
            new 
szOrigin[3][17], szAngles[2];
            
parse(szDataszOrigin[0], charsmax(szOrigin[]), szOrigin[1], charsmax(szOrigin[]), szOrigin[2], charsmax(szOrigin[]), szAnglescharsmax(szAngles));
            
            for (new 
03x++)
                
g_vTimerOrigin[i][x] = str_to_float(szOrigin[x]);
            
            
g_iTimerAngles[i] = str_to_num(szAngles);
            
            
create_timer(0ig_vTimerOrigin[i]);
        }
        else
            continue;
    }
}
stock create_timer(idiTypeFloat:vOrigin[3] = {0.00.00.0})
{
    if (!
g_iTimer[iType])
    {
        new 
iEntity create_entity("func_button");
        
        if (!
is_valid_ent(iEntity))
            return;
        
        new 
szClassName[32];
        
formatex(szClassNamecharsmax(szClassName), "Timer_%s"g_szTimerName[iType]);
        
        
entity_set_string(iEntityEV_SZ_classnameszClassName);
        
entity_set_int(iEntityEV_INT_solidSOLID_TRIGGER);
        
entity_set_int(iEntityEV_INT_movetypeMOVETYPE_NONE);
        
entity_set_model(iEntityg_szTimerModels[iType]);
        
entity_set_size(iEntityFloat:{-150.0, -1.0, -150.0}, Float:{150.01.0150.0});
        
        
g_iTimer[iType] = iEntity;
    }
    if (
id)
    {
        new 
vOriginI[3];
        
get_user_origin(idvOriginI3);
        
        new 
Float:vOriginF[3];
        
IVecFVec(vOriginIvOriginF);
        
        
entity_set_origin(g_iTimer[iType], vOriginF);
        
        for (new 
03i++)
            
g_vTimerOrigin[iType][i] = vOriginF[i];
    }
    else
        
entity_set_origin(g_iTimer[iType], vOrigin);
    
    new 
Float:vAngles[3];
    
vAngles[1] = g_flTimerAngles[g_iTimerAngles[iType]];
    
    
entity_set_vector(g_iTimer[iType], EV_VEC_anglesvAngles);
    
    
drop_to_floor(g_iTimer[iType]);
}
public 
plugin_end()
{
    if (
g_bTimerFound)
    {
        
TrieDestroy(g_tStarts);
        
TrieDestroy(g_tStops);
    }
    else
    {
        if (
g_iVault != INVALID_HANDLE)
            
nvault_close(g_iVault);
    }
    
    
SQL_FreeHandle(g_hSqlTuple);


Bueh, parece que se soluciono poniendole un is_user_connected al timer_stop y al timer_start pacman

Borren esto porfa pacman

la solución le debe quedar a alguien mas, saludos.
Ingeniero agrónomo y desarrollador de Software.

tutoriales-allied
buscas un zp?

"La imitación es la forma más sincera de admiración con la que puede pagar la mediocridad a la grandeza"

Merci Alliedmodders pour m'introduire dans la programmation.
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)