Raised This Month: $51 Target: $400
 12% 

%0.0f throwing compile error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 07-10-2017 , 09:17   %0.0f throwing compile error
Reply With Quote #1

Have the following script:
PHP Code:
#include <amxmodx>
#include <engine>

new g_iIDPCVarAccessg_iIDPCVarIntervalFloat:g_fTimeThinkNew,
Float:g_fTimeThinkOldg_iCountWatchersg_iCountThinksFloat:g_fTotalFPS,
Float:g_fTimeWatched;

public 
plugin_init()
{
    
register_plugin("D7 Server FPS""0.0.5""D i 5 7 i n c T")
    
    
register_clcmd("say /svfps""fwClCmdSaySvFPS")
    
register_clcmd("say_team /svfps""fwClCmdSaySvFPS")
    
    
g_iIDPCVarAccess register_cvar("D7SvFPSAccess""d");
    
g_iIDPCVarInterval register_cvar("D7SvFPSInterval""1.0");
}

public 
client_disconnect(id)
{
    if (
task_exists(id))
    {
        
g_iCountWatchers--
        
        
remove_task(id)
    }
}
/*
public client_infochanged(id)
{
    if (!(get_user_flags(id) & ADMIN_BAN) && task_exists(id))
    {
        g_iCountWatchers--
        
        remove_task(id)
    }
}*/

public fwClCmdSaySvFPS(const id)
{
    if (!
task_exists(id))
    {
        static 
szAccess[32];
        
get_pcvar_string(g_iIDPCVarAccessszAccesscharsmax(szAccess))
        
        if (
get_user_flags(id) & read_flags(szAccess))
        {
            
g_iCountWatchers++
            
            
set_task(get_pcvar_float(g_iIDPCVarInterval), "fwTaskShowFps"id__"b")
        }
        else
        {
            
client_print(idprint_center"[D7 Server FPS] %L"id"NO_ACC_COM")
        }
    }
    else
    {
        
g_iCountWatchers--
        
        
remove_task(id)
    }
    
    return 
PLUGIN_HANDLED_MAIN;
}

public 
fwTaskShowFps(const id)
{
/*    static msgSync;
    
    if (!msgSync)
        msgSync = CreateHudSyncObj()
    */
    
    
set_hudmessage(2552552550.790.7900.0get_pcvar_float(g_iIDPCVarInterval) + 0.050.00.04)
    
//ShowSyncHudMsg(id, msgSync, "[D7] Server FPS: %d", g_iServerFPS)
    
show_hudmessage(id"[D7] Server FPS: %f.^n[D7] Average FPS(%0.0f : %0.0f): %f.",
    
1.0 / (g_fTimeThinkNew g_fTimeThinkOld), g_fTimeWatched 60g_fTimeWatched 60g_fTotalFPS g_iCountThinks)
}

public 
server_frame()
{
    if (
g_iCountWatchers)
    {
        
g_fTimeThinkOld g_fTimeThinkNew;
        
g_fTimeThinkNew get_gametime();
        
g_fTotalFPS += (1.0 / (g_fTimeThinkNew g_fTimeThinkOld));
        
g_iCountThinks++;
        
g_fTimeWatched += (g_fTimeThinkNew g_fTimeThinkOld);
    }

which throws me this compile error:


However, I have another script which uses it but compiles fine:
PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < engine >
#include < hamsandwich >
#include < xs >
#include <zombieplaguenightmare>

//native Float: HattrickRange( i, j );
#define HattrickRange(%1,%2) entity_range(%1,%2)

new q;

#define MAX_ENTITIES        1500
#define MAX_PLAYERS        32
#define MINE_ON            1
#define MINE_OFF            0
#define TASK_CREATE        84765
#define TASK_REMOVE        86766
#define MINE_COST            5
#define MINE_CLASSNAME        "lasermine"
#define MINE_MODEL_EXPLODE    "sprites/zerogxplode.spr"
#define MINE_MODEL_VIEW        "models/zombie_plague/lasermine.mdl"
#define MINE_SOUND_ACTIVATE    "weapons/mine_activate.wav"
#define MINE_SOUND_CHARGE        "weapons/mine_charge.wav"
#define MINE_SOUND_DEPLOY        "weapons/mine_deploy.wav"
#define MINE_HEALTH        800.0
#define entity_get_owner(%0)        pev( %0, pev_iuser2 )
#define entity_get_status(%0)        entity_get_int( %0, EV_INT_iuser1 )
#define entity_get_classname(%0,%1)    entity_get_string( %0, EV_SZ_classname, %1, charsmax( %1 ) )
const FFADE_IN 0x0000
new g_iTripMines33 ];
new 
g_iPlantedMines33 ];
new 
g_iPlanting33 ];
new 
g_iRemoving33 ];
new 
g_hExplode;

new 
g_iIDItem;

public 
plugin_init( )
{
    
register_plugin"[ZP] lasermine""1.0""Hattrick bulangiul" );
    
    
register_clcmd"say /lm""Command_Buy" );
    
register_clcmd"say lm""Command_Buy" );
    
q=get_user_msgid("SayText");
    
register_clcmd"Plant_Mine""Command_Plant" );
    
register_clcmd"Take_Mine""Command_Take" );
    
    
register_logevent"Event_RoundStart"2"1=Round_Start" );
    
    
register_thinkMINE_CLASSNAME"Forward_Think" );
    
    
g_iIDItem zp_register_extra_item("Trip Mine (/LM)"MINE_COSTZP_TEAM_HUMAN ZP_TEAM_SURVIVOR ZP_TEAM_SNIPER)
}

public 
plugin_precache( )
{
    
engfuncEngFunc_PrecacheModelMINE_MODEL_VIEW );
    
    
engfuncEngFunc_PrecacheSoundMINE_SOUND_ACTIVATE );
    
engfuncEngFunc_PrecacheSoundMINE_SOUND_CHARGE );
    
engfuncEngFunc_PrecacheSoundMINE_SOUND_DEPLOY );
    
    
g_hExplode engfuncEngFunc_PrecacheModelMINE_MODEL_EXPLODE );
}

public 
client_disconnectiPlayer )
{
    
g_iTripMinesiPlayer ] = 0;
    
g_iPlantingiPlayer ] = false;
    
g_iRemovingiPlayer ] = false;
    
    if( 
g_iPlantedMinesiPlayer ] )
    {
        
Func_RemoveMinesByOwneriPlayer );
        
        
g_iPlantedMinesiPlayer ] = 0;
    }
    
    
remove_taskiPlayer TASK_REMOVE );
    
remove_taskiPlayer TASK_CREATE );
}

public 
Command_BuyiPlayer )
{
    if (
g_iIDItem && is_user_alive(iPlayer))
        
zp_force_buy_extra_item(iPlayerg_iIDItem)
/*    
    if( !is_user_alive( iPlayer ) )
    {
        Message(iPlayer, "^4[ZP]^1 You should be Alive" );
        
        return ZP_PLUGIN_HANDLED;
    }
    
    if( zp_get_user_zombie( iPlayer ) )
    {
        Message(iPlayer, "^4[ZP]^1 You should be Human" );
        
        return ZP_PLUGIN_HANDLED;
    }
    
    if( zp_get_user_ammo_packs( iPlayer ) < MINE_COST )
    {
        Message(iPlayer, "^4[ZP]^1 You need %i Ammo packs", MINE_COST );
        
        return ZP_PLUGIN_HANDLED;
    }
    
    if( zp_is_lnj_round( ) )
    {
        Message(iPlayer, "^4[ZP]^1 You can't buy a Tripmine into an Armageddon round" );
        
        return ZP_PLUGIN_HANDLED;
    }
    
    zp_set_user_ammo_packs( iPlayer, zp_get_user_ammo_packs( iPlayer ) - MINE_COST );
    
    g_iTripMines[ iPlayer ]++;
    
    Message(iPlayer, "^4[ZP]^1 You bought Tripmine" );
    
    //client_cmd( iPlayer, "bind c +setlaser" );
    //client_cmd( iPlayer, "bind v +dellaser" );
    
    return PLUGIN_CONTINUE;*/
}

public 
zp_extra_item_selected(iditem)
{
    if (
item != g_iIDItem)
        return;
    
    
g_iTripMinesid ]++;
    
Message(id"^4[ZP]^1 You bought a^3 Trip Mine^1. Press^4 P^1 to plant it or^4 V^1 to take it" );
    
    
client_cmdid"bind p Plant_Mine" );
    
client_cmdid"bind v Take_Mine" );
}

public 
Command_PlantiPlayer )
{
    if( !
is_user_aliveiPlayer ) )
    {
        
Message(iPlayer"^4[ZP]^1 You should be Alive" );
        
        return 
PLUGIN_CONTINUE;
    }
    
    if( 
zp_get_user_zombieiPlayer ) )
    {
        
Message(iPlayer"^4[ZP]^1 You should be Human" );
        
        return 
PLUGIN_CONTINUE;
    }
    
    if( !
g_iTripMinesiPlayer ] )
    {
        
Message(iPlayer"^4[ZP]^1 You don't have a Tripmine to plant");
        
        return 
PLUGIN_CONTINUE;
    }
    
    if( 
g_iPlantedMinesiPlayer ] > )
    {
        
Message(iPlayer"^4[ZP]^1 You can plant only 2 Mines" );
        
        return 
PLUGIN_CONTINUE;
    }
    
/*
    if( zp_is_lnj_round( ) )
    {
        Message(iPlayer, "^4[ZP]^1 You can't buy a Tripmine into an Armageddon round" );
        
        return PLUGIN_CONTINUE;
    }*/
    
    
if( g_iPlantingiPlayer ] || g_iRemovingiPlayer ] )
        return 
PLUGIN_CONTINUE;
    
    if( 
CanPlantiPlayer ) ) {
        
g_iPlantingiPlayer ] = true;
        
        
message_beginMSG_ONE_UNRELIABLE108_iPlayer );
        
write_byte);
        
write_byte);
        
message_end( );
        
        
set_task1.2"Func_Plant"iPlayer TASK_CREATE );
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
Command_TakeiPlayer )
{
    if( !
g_iPlantedMinesiPlayer ] )
    {
        
//Message(iPlayer, "^4[ZP]^1 You don't have a planted mine" );
        
        
return PLUGIN_CONTINUE;
    }
    
    if( !
is_user_aliveiPlayer ) )
    {
        
Message(iPlayer"^4[ZP]^1 You should be Alive" );
        
        return 
PLUGIN_CONTINUE;
    }
    
    if( 
zp_get_user_zombieiPlayer ) )
    {
        
Message(iPlayer"^4[ZP]^1 You should be Human" );
        
        return 
PLUGIN_CONTINUE;
    }
    
    if( 
g_iPlantingiPlayer ] || g_iRemovingiPlayer ] )
        return 
PLUGIN_CONTINUE;
    
    if( 
CanTakeiPlayer ) ) {
        
g_iRemovingiPlayer ] = true;
        
        
message_beginMSG_ONE_UNRELIABLE108_iPlayer );
        
write_byte);
        
write_byte);
        
message_end( );
        
        
set_task1.2"Func_Take"iPlayer TASK_REMOVE );
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
Event_RoundStart( ) {
    static 
iEntityszClassName32 ], iPlayer;
    for( 
iEntity 0iEntity MAX_ENTITIES 1iEntity++ ) {
        if( !
is_valid_entiEntity ) )
            continue;
        
        
szClassName] = '^0';
        
entity_get_classnameiEntityszClassName );
        
        if( 
equalszClassNameMINE_CLASSNAME ) )
            
remove_entityiEntity );
    }
    
    for( 
iPlayer 1iPlayer 33iPlayer++ ) {
        
g_iTripMinesiPlayer ] = 0;
        
g_iPlantedMinesiPlayer ] = 0;
    }
}

public 
Func_TakeiPlayer ) {
    
iPlayer -= TASK_REMOVE;
    
    
g_iRemovingiPlayer ] = false;
    
    static 
iEntityszClassName32 ], FloatflOwnerOrigin], FloatflEntityOrigin];
    for( 
iEntity 0iEntity MAX_ENTITIES 1iEntity++ ) {
        if( !
is_valid_entiEntity ) )
            continue;
        
        
szClassName] = '^0';
        
entity_get_classnameiEntityszClassName );
        
        if( 
equalszClassNameMINE_CLASSNAME ) ) {
            if( 
entity_get_owneriEntity ) == iPlayer ) {
                
entity_get_vectoriPlayerEV_VEC_originflOwnerOrigin );
                
entity_get_vectoriEntityEV_VEC_originflEntityOrigin );
                
                if( 
get_distance_fflOwnerOriginflEntityOrigin ) < 55.0 ) {
                    
g_iPlantedMinesiPlayer ]--;
                    
g_iTripMinesiPlayer ]++;
                    
                    
remove_entityiEntity );
                    
                    break;
                }
            }
        }
    }
}

public 
boolCanTakeiPlayer ) {
    static 
iEntityszClassName32 ], FloatflOwnerOrigin], FloatflEntityOrigin];
    for( 
iEntity 0iEntity MAX_ENTITIES 1iEntity++ ) {
        if( !
is_valid_entiEntity ) )
            continue;
        
        
szClassName] = '^0';
        
entity_get_classnameiEntityszClassName );
        
        if( 
equalszClassNameMINE_CLASSNAME ) ) {
            if( 
entity_get_owneriEntity ) == iPlayer ) {
                
entity_get_vectoriPlayerEV_VEC_originflOwnerOrigin );
                
entity_get_vectoriEntityEV_VEC_originflEntityOrigin );
                
                if( 
get_distance_fflOwnerOriginflEntityOrigin ) < 55.0 )
                    return 
true;
            }
        }
    }
    
    return 
false;
}

public 
boolCanPlantiPlayer ) {
    static 
FloatflOrigin];
    
entity_get_vectoriPlayerEV_VEC_originflOrigin );
    
    static 
FloatflTraceDirection], FloatflTraceEnd], FloatflTraceResult], FloatflNormal];
    
velocity_by_aimiPlayer64flTraceDirection );
    
flTraceEnd] = flTraceDirection] + flOrigin];
    
flTraceEnd] = flTraceDirection] + flOrigin];
    
flTraceEnd] = flTraceDirection] + flOrigin];
    
    static 
FloatflFractioniTr;
    
iTr 0;
    
engfuncEngFunc_TraceLineflOriginflTraceEnd0iPlayeriTr );
    
get_tr2iTrTR_vecEndPosflTraceResult );
    
get_tr2iTrTR_vecPlaneNormalflNormal );
    
get_tr2iTrTR_flFractionflFraction );
    
    if( 
flFraction >= 1.0 ) {
        
Message(iPlayer"^4[ZP]^1 You must plant the Tripmine on a Wall" );
        
        return 
false;
    }
    
    return 
true;
}

public 
Func_PlantiPlayer ) {
    
iPlayer -= TASK_CREATE;
    
    
g_iPlantingiPlayer ] = false;
    
    static 
FloatflOrigin];
    
entity_get_vectoriPlayerEV_VEC_originflOrigin );
    
    static 
FloatflTraceDirection], FloatflTraceEnd], FloatflTraceResult], FloatflNormal];
    
velocity_by_aimiPlayer128flTraceDirection );
    
flTraceEnd] = flTraceDirection] + flOrigin];
    
flTraceEnd] = flTraceDirection] + flOrigin];
    
flTraceEnd] = flTraceDirection] + flOrigin];
    
    static 
FloatflFractioniTr;
    
iTr 0;
    
engfuncEngFunc_TraceLineflOriginflTraceEnd0iPlayeriTr );
    
get_tr2iTrTR_vecEndPosflTraceResult );
    
get_tr2iTrTR_vecPlaneNormalflNormal );
    
get_tr2iTrTR_flFractionflFraction );
    
    static 
iEntity;
    
iEntity create_entity"info_target" );
    
    if( !
iEntity )
        return;
    
    
entity_set_stringiEntityEV_SZ_classnameMINE_CLASSNAME );
    
entity_set_modeliEntityMINE_MODEL_VIEW );
    
entity_set_int(iEntityEV_INT_rendermodekRenderNormal)
    
entity_set_int(iEntityEV_INT_renderfxkRenderFxGlowShell)
    
entity_set_float(iEntityEV_FL_renderamt16.0)
    
flTraceEnd[0] = random_float(0.050.0);
    
flTraceEnd[1] = random_float(0.0255.0);
    
flTraceEnd[2] = random_float(0.0255.0);
    
entity_set_vector(iEntityEV_VEC_rendercolorflTraceEnd)
    
entity_set_sizeiEntityFloat:{ -4.0, -4.0, -4.0 }, Float:{ 4.04.04.0 } );//Float: { -15.0, -15.0, -15.0 }, Float: { 15.0, 15.0, 15.0 }
    
    
set_peviEntitypev_iuser2iPlayer );
    
    
g_iPlantedMinesiPlayer ]++;

    
set_peviEntitypev_iuser3g_iPlantedMinesiPlayer ] );
    
    
entity_set_floatiEntityEV_FL_frame0.0 );
    
entity_set_floatiEntityEV_FL_framerate0.0 );
    
entity_set_intiEntityEV_INT_movetypeMOVETYPE_FLY );
    
entity_set_intiEntityEV_INT_solidSOLID_NOT );
    
entity_set_intiEntityEV_INT_body);
    
entity_set_intiEntityEV_INT_sequence);
    
entity_set_floatiEntityEV_FL_takedamageDAMAGE_NO );
    
entity_set_intiEntityEV_INT_iuser1MINE_OFF );
    
    static 
FloatflNewOrigin], FloatflEntAngles];
    
flNewOrigin] = flTraceResult] + ( flNormal] * 8.0 );
    
flNewOrigin] = flTraceResult] + ( flNormal] * 8.0 );
    
flNewOrigin] = flTraceResult] + ( flNormal] * 8.0 );
    
    
entity_set_originiEntityflNewOrigin );
    
    
vector_to_angleflNormalflEntAngles );
    
entity_set_vectoriEntityEV_VEC_anglesflEntAngles );
    
flEntAngles] *= -1.0;
    
flEntAngles] *= -1.0;
    
flEntAngles] *= -1.0;
    
entity_set_vectoriEntityEV_VEC_v_angleflEntAngles );
    
    
g_iTripMinesiPlayer ]--;
    
    
emit_soundiEntityCHAN_WEAPONMINE_SOUND_DEPLOYVOL_NORMATTN_NORM0PITCH_NORM );
    
emit_soundiEntityCHAN_VOICEMINE_SOUND_CHARGEVOL_NORMATTN_NORM0PITCH_NORM );
    
    
entity_set_floatiEntityEV_FL_nextthinkget_gametime( ) + 0.6 );
}

public 
Func_RemoveMinesByOwneriPlayer ) {
    static 
iEntityszClassName32 ];
    for( 
iEntity 0iEntity MAX_ENTITIES 1iEntity++ ) {
        if( !
is_valid_entiEntity ) )
            continue;
        
        
szClassName] = '^0';
        
entity_get_classnameiEntityszClassName );
        
        if( 
equalszClassNameMINE_CLASSNAME ) )
            if( 
entity_get_owneriEntity ) == iPlayer )
                
remove_entityiEntity );
    }
}

Func_ExplodeiEntity ) {
    
g_iPlantedMinesentity_get_owneriEntity ) ]--;
    
    static 
FloatflOrigin];
    
entity_get_vectoriEntityEV_VEC_originflOrigin );
    
    
message_beginMSG_BROADCASTSVC_TEMPENTITY );
    
write_byteTE_EXPLOSION );
    
engfuncEngFunc_WriteCoordflOrigin] );
    
engfuncEngFunc_WriteCoordflOrigin] );
    
engfuncEngFunc_WriteCoordflOrigin] );
    
write_shortg_hExplode );
    
write_byte55 );
    
write_byte15 );
    
write_byte);
    
message_end( );
    
    
message_beginMSG_BROADCASTSVC_TEMPENTITY );
    
write_byteTE_EXPLOSION );
    
engfuncEngFunc_WriteCoordflOrigin] );
    
engfuncEngFunc_WriteCoordflOrigin] );
    
engfuncEngFunc_WriteCoordflOrigin] );
    
write_shortg_hExplode );
    
write_byte65 );
    
write_byte15 );
    
write_byte);
    
message_end( );
    
    
message_beginMSG_BROADCASTSVC_TEMPENTITY );
    
write_byteTE_EXPLOSION );
    
engfuncEngFunc_WriteCoordflOrigin] );
    
engfuncEngFunc_WriteCoordflOrigin] );
    
engfuncEngFunc_WriteCoordflOrigin] );
    
write_shortg_hExplode );
    
write_byte85 );
    
write_byte15 );
    
write_byte);
    
message_end( );
    
    static 
szNumber[15];
    
    for( new 
133i++ )
    {
        if( !
is_user_connected) || !is_user_alive) ) continue;
        if( 
zp_get_user_zombie) )
        {
            static 
FloatfDistanceFloatfDamage;

            
fDistance HattrickRangeiiEntity );

            if( 
fDistance 340 )
            {
                
fDamage 2300 fDistance;

                
//if( !zp_get_user_nemesis( i ) )
                    //fDamage *= 0.75;

                
static FloatfVelocity];
                
pevipev_velocityfVelocity );

                
xs_vec_mul_scalarfVelocity1.75fVelocity );

                
set_pevipev_velocityfVelocity );

                
message_beginMSG_ONE_UNRELIABLEget_user_msgid"ScreenFade" ), _);
                
write_short4096 );
                
write_short4096 );
                
write_shortFFADE_IN );
                
write_byte255 );
                
write_byte);
                
write_byte);
                
write_byte225 );
                
message_end( );
/*
                message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "ScreenShake" ), _, i );
                write_short( 4096 * 19 );
                write_short( 4096 * 7 );
                write_short( 4096 * 24 );
                message_end( );*/

                
if( floatget_user_health) ) - fDamage )
                    
ExecuteHamBHam_TakeDamageiiEntityentity_get_owneriEntity ), fDamageDMG_BLAST );

                else 
ExecuteHamBHam_Killedientity_get_owneriEntity ), );

                static 
cName32 ]; get_user_nameicName31 );
                
NumberFormat(floatround(fDamagefloatround_floor), szNumbercharsmax(szNumber))
                
Messageentity_get_owneriEntity ), "^x04[ZP]^x01 Damage to^x03 %s^x01 ::^x04 %s"cNameszNumber );
            }
        }
    }
/*
    for( new i = 1; i < 33; i++ )
    {
        if( !is_user_connected( i ) || !is_user_alive( i ) )
            continue;
        if( !zp_get_user_zombie( i ) )
        {
            if( HattrickRange( i, iEntity ) < 340 )
            {
                static Float: fVelocity[ 3 ];
                pev( i, pev_velocity, fVelocity );

                xs_vec_mul_scalar( fVelocity, 1.5, fVelocity );

                set_pev( i, pev_velocity, fVelocity );

                message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "ScreenShake" ), _, i );
                write_short( 4096 * 19 );
                write_short( 4096 * 7 );
                write_short( 4096 * 24 );
                message_end( );
            }
        }
    }*/

    
remove_entityiEntity );
}

NumberFormat(iNumberszNumber[15], const iSize
{
    
num_to_str(iNumberszNumberiSize);
    
    if (-
1000 iNumber 1000)
        return 
0;
    
    for (
iNumber strlen(szNumber) - 3iNumber > ((szNumber[0] != '-') ? 1); iNumber -= 3)
        
format(szNumber[iNumber], charsmax(szNumber) - iNumber 1",%s"szNumber[iNumber]);
    
    return 
1;
}

public 
Forward_ThinkiEntity ) {
    static 
FloatflGameTimeiStatus;
    
flGameTime get_gametime( );
    
iStatus entity_get_statusiEntity );
    
    switch( 
iStatus ) {
        case 
MINE_OFF: {
            
entity_set_intiEntityEV_INT_iuser1MINE_ON );
            
entity_set_floatiEntityEV_FL_takedamageDAMAGE_YES );
            
entity_set_intiEntityEV_INT_solidSOLID_BBOX );
            
entity_set_floatiEntityEV_FL_healthMINE_HEALTH 1000.0 );
            
            
emit_soundiEntityCHAN_VOICEMINE_SOUND_ACTIVATEVOL_NORMATTN_NORM0PITCH_NORM );
        }
        
        case 
MINE_ON: {
            static 
FloatflHealth;
            
flHealth entity_get_floatiEntityEV_FL_health );

            if( 
is_user_aliveentity_get_owneriEntity ) ) )
            {
                static 
iIDMsgSynciIDMsgSync2;
                
                if (!
iIDMsgSync)
                    
iIDMsgSync CreateHudSyncObj();
                
                if (!
iIDMsgSync2)
                    
iIDMsgSync2 CreateHudSyncObj();
                
                if (
flHealth 1000)
                {
                    if( (
peviEntitypev_iuser3 ) % 2) == )
                        
set_hudmessage(255001.00.300.00.120.00.0, -1),
                        
ShowSyncHudMsgentity_get_owneriEntity ), iIDMsgSync"Mine 1 %0.0f HP"flHealth 1000.0 );
                    else
                        
set_hudmessage(255001.00.3200.00.120.00.0, -1),
                        
ShowSyncHudMsgentity_get_owneriEntity ), iIDMsgSync2"Mine 2 %0.0f HP"flHealth 1000.0 );
                }
                else
                {
                    
ClearSyncHud(entity_get_owneriEntity ), iIDMsgSync)
                    
ClearSyncHud(entity_get_owneriEntity ), iIDMsgSync2)
                }
            }

            if( 
flHealth <= 1000.0 ) {
                
Func_ExplodeiEntity );
                
                return 
FMRES_IGNORED;
            }
        }
    }
    
    if( 
is_valid_entiEntity ) )
        
entity_set_floatiEntityEV_FL_nextthinkflGameTime 0.1 );
    
    return 
FMRES_IGNORED;
}

Messagevc[ ], any: ... )
{
    static 
cBuffer192 ];
    
vformatcBuffer191c);

    if( 
)
    {
        
message_beginMSG_ONE_UNRELIABLEq_);
        
write_byte);
        
write_stringcBuffer );
        
message_end( );
    }

    else
    {
        static 
i32 ], jk;
        
get_playersij"ch" );
        for( 
0jk++ )
        {
            
message_beginMSG_ONE_UNRELIABLEq_i] );
            
write_bytei] );
            
write_stringcBuffer );
            
message_end( );
        }
    }

Can someone explain why and how can I get it to compile?
Attached Thumbnails
Click image for larger version

Name:	Untitled.png
Views:	434
Size:	43.0 KB
ID:	164056  
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
SpawnerF
Member
Join Date: Apr 2017
Location: Morocco
Old 07-10-2017 , 09:54   Re: %0.0f throwing compile error
Reply With Quote #2

It's not %0.0f it's modulus who caused this problem

use this :

Code:
#define floatmodulus(%0,%1) ((%0/%1)-floatround((%0/%1),floatround_floor))*%1

&

Code:
    show_hudmessage(id, "[D7] Server FPS: %.2f.^n[D7] Average FPS(%.f : %.f): %.2f.",             (1.0 / (g_fTimeThinkNew - g_fTimeThinkOld)),             g_fTimeWatched / 60.0,             floatmodulus(g_fTimeWatched,60),             g_fTotalFPS / float(g_iCountThinks))
__________________
XX was created just for giving evidence and not meant to damage public servers.
&We do not test on public servers.
Thank's.
SpawnerF is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 07-10-2017 , 10:06   Re: %0.0f throwing compile error
Reply With Quote #3

Thanks, but the problem was with "% 60" for some reason.
I managed to get it working this way:
PHP Code:
#include <amxmodx>
#include <engine>

new g_iIDPCVarAccessg_iIDPCVarIntervalFloat:g_fTimeThinkNew,
Float:g_fTimeThinkOldg_iCountWatchersg_iCountThinksFloat:g_fTotalFPS,
Float:g_fTimeWatched;

public 
plugin_init()
{
    
register_plugin("D7 Server FPS""0.0.5""D i 5 7 i n c T")
    
    
register_clcmd("say /svfps""fwClCmdSaySvFPS")
    
register_clcmd("say_team /svfps""fwClCmdSaySvFPS")
    
    
g_iIDPCVarAccess register_cvar("D7SvFPSAccess""d");
    
g_iIDPCVarInterval register_cvar("D7SvFPSInterval""1.0");
}

public 
client_disconnect(id)
{
    if (
task_exists(id))
    {
        
g_iCountWatchers--
        
        
remove_task(id)
    }
}
/*
public client_infochanged(id)
{
    if (!(get_user_flags(id) & ADMIN_BAN) && task_exists(id))
    {
        g_iCountWatchers--
        
        remove_task(id)
    }
}*/

public fwClCmdSaySvFPS(const id)
{
    if (!
task_exists(id))
    {
        static 
szAccess[32];
        
get_pcvar_string(g_iIDPCVarAccessszAccesscharsmax(szAccess))
        
        if (
get_user_flags(id) & read_flags(szAccess))
        {
            
g_iCountWatchers++
            
            
set_task(get_pcvar_float(g_iIDPCVarInterval), "fwTaskShowFps"id__"b")
        }
        else
        {
            
client_print(idprint_center"[D7 Server FPS] %L"id"NO_ACC_COM")
        }
    }
    else
    {
        
g_iCountWatchers--
        
        
remove_task(id)
    }
    
    return 
PLUGIN_HANDLED_MAIN;
}

public 
fwTaskShowFps(const id)
{
/*    static msgSync;
    
    if (!msgSync)
        msgSync = CreateHudSyncObj()
    */
    
    
set_hudmessage(2552552550.790.7900.0get_pcvar_float(g_iIDPCVarInterval) + 0.050.00.04)
    
//ShowSyncHudMsg(id, msgSync, "[D7] Server FPS: %d", g_iServerFPS)
    
show_hudmessage(id"[D7] Server FPS: %f.^n[D7] Average FPS(%0.0f : %0.0f): %f.",
    
1.0 / (g_fTimeThinkNew g_fTimeThinkOld), g_fTimeWatched 60.0g_fTimeWatched - (60 floatround(g_fTimeWatched 60floatround_floor)), g_fTotalFPS g_iCountThinks)
}

public 
server_frame()
{
    if (
g_iCountWatchers)
    {
        
g_fTimeThinkOld g_fTimeThinkNew;
        
g_fTimeThinkNew get_gametime();
        
g_fTotalFPS += (1.0 / (g_fTimeThinkNew g_fTimeThinkOld));
        
g_iCountThinks++;
        
g_fTimeWatched += (g_fTimeThinkNew g_fTimeThinkOld);
    }

It still shows the wrong time(even while not watched) tho so I have to fix that.
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
SpawnerF
Member
Join Date: Apr 2017
Location: Morocco
Old 07-10-2017 , 10:38   Re: %0.0f throwing compile error
Reply With Quote #4

Yes I told you it's from the modulus operator "%" ... You can't use modulus with floats so I did a small macro that do for you the job ...
Edit : I think you didn't even test my code.
__________________
XX was created just for giving evidence and not meant to damage public servers.
&We do not test on public servers.
Thank's.

Last edited by SpawnerF; 07-10-2017 at 10:41.
SpawnerF is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 07-10-2017 , 11:24   Re: %0.0f throwing compile error
Reply With Quote #5

Oh sorry I didn't get it the first time. Thanks.
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 07-10-2017 , 12:08   Re: %0.0f throwing compile error
Reply With Quote #6

Quote:
Originally Posted by SpawnerF View Post
It's not %0.0f it's modulus who caused this problem

use this :

Code:
#define floatmodulus(%0,%1) ((%0/%1)-floatround((%0/%1),floatround_floor))*%1

&

Code:
    show_hudmessage(id, "[D7] Server FPS: %.2f.^n[D7] Average FPS(%.f : %.f): %.2f.",             (1.0 / (g_fTimeThinkNew - g_fTimeThinkOld)),             g_fTimeWatched / 60.0,             floatmodulus(g_fTimeWatched,60),             g_fTotalFPS / float(g_iCountThinks))
Code:
stock Float:operator%(Float:dividend, Float:divisor) {     return dividend - divisor*floatround(dividend/divisor, floatround_tozero); } stock Float:operator%(Float:dividend, divisor) {     return dividend%float(divisor); } stock Float:operator%(dividend, Float:divisor) {     return float(dividend)%divisor; }
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
SpawnerF
Member
Join Date: Apr 2017
Location: Morocco
Old 07-10-2017 , 17:19   Re: %0.0f throwing compile error
Reply With Quote #7

Quote:
Originally Posted by PRoSToTeM@ View Post
Code:
stock Float:operator%(Float:dividend, Float:divisor) {     return dividend - divisor*floatround(dividend/divisor, floatround_tozero); } stock Float:operator%(Float:dividend, divisor) {     return dividend%float(divisor); } stock Float:operator%(dividend, Float:divisor) {     return float(dividend)%divisor; }
It exist already but it accept only Integer type and honestly it makes no sense

Code:
forward operator%(Float:oper1, Float:oper2);
forward operator%(Float:oper1, oper2);
forward operator%(oper1, Float:oper2);
__________________
XX was created just for giving evidence and not meant to damage public servers.
&We do not test on public servers.
Thank's.
SpawnerF is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 07-10-2017 , 17:47   Re: %0.0f throwing compile error
Reply With Quote #8

Quote:
Originally Posted by SpawnerF View Post
It exist already but it accept only Integer type and honestly it makes no sense

Code:
forward operator%(Float:oper1, Float:oper2);
forward operator%(Float:oper1, oper2);
forward operator%(oper1, Float:oper2);
This declaration forbids using modulo with floats, because if it is not declared it tries to use operator% for _:.
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:20.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode