Raised This Month: $ Target: $400
 0% 

Solved [Help] Wrong Value Printed !!!


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Begineer Programmer
Member
Join Date: Nov 2021
Old 08-30-2022 , 09:52   [Help] Wrong Value Printed !!!
Reply With Quote #1

Hi All !!!
i need little help when mapname cfg file not found its should return 0 and if file exist and have no value of mp_maxrounds then should also return 0 and printed to 0 but it print 1 why ? [Where i have done mistake !!!] [See Red Highlighted One !!!]


PHP Code:
#include <amxmodx> 
#include <cstrike>
#include <amxmisc>
#pragma semicolon 1
#pragma tabsize 4
new runde 0;
new 
prefix[32] = "AMXX";
new 
TerrScoreCTScore;
public 
plugin_init()  

    
register_plugin"Info Top""1.4""->UrOS<-");    
    
register_event("HLTV""round_start""a""1=0""2=0");
    
register_event("TextMsg""round_restart""a""2=#Game_will_restart_in""2=#Game_Commencing");
    
register_event("TeamScore""terr_score""a""1=TERRORIST");
    
register_event("TeamScore""ct_score""a""1=CT");

public 
round_restart()
{
    
runde 0;
    
TerrScore=0;
    
CTScore=0;
}
public 
terr_score()
{
    
TerrScore read_data(2);
}
public 
ct_score()
{
    
CTScore read_data(2);
}
public 
round_start() 

    
    
    new 
mapname[32], nextmap[32], players[32], player ,maxrundimaxplayers,maxroundsCvar;
    
    
maxrundi=get_cvar_num("mp_maxrounds");
    
maxplayers=get_maxplayers();
    
get_cvar_string("amx_nextmap",nextmap,31); 
    
get_mapname(mapname,31);
    
get_players(playersplayer);
    
maxroundsCvar=get_map_maxrounds(mapname);
    
client_print_color(0,print_team_default,"^4[%s]^3 Rounds:^4 %d^3/^4%d ^1|^3 Score:^3 Ts:^4%i^3 -^3 CTs:^4%i ^1|^3 Map:^4 %s^3/^4%s [%i] ^1|^3 Players:^4 %d^3/^4%d",prefixrunde,maxrundi,TerrScore,CTScore,mapnamenextmap,maxroundsCvarplayer,maxplayers); 
    
runde++;
}

get_map_maxrounds(szMapname[])
{
    new 
szConfigsDir[64], szFilePath[128];
    
get_configsdir(szConfigsDircharsmax(szConfigsDir));
    
format(szFilePathcharsmax(szFilePath), "%s/maps/%s.cfg",szConfigsDirszMapname);
    new 
fopen(szFilePath"rt");
    if( 
)
    {
        new 
szCvar[32], szValue[32], szCfgData[64],iValue;
    
        while(
fgets(fszCfgDatacharsmax(szCfgData)))
        {
            
parse(szCfgDataszCvarcharsmax(szCvar), szValuecharsmax(szValue));
        
            if(
equali(szCvar"mp_maxrounds"))
            {
                
iValue str_to_num(szValue);    
            }
            
        }
        
fclose(f);
        return 
iValue==1?iValue:0;
    }
    return 
PLUGIN_HANDLED;

Attached Thumbnails
Click image for larger version

Name:	1.png
Views:	36
Size:	37.0 KB
ID:	196577  

Last edited by Begineer Programmer; 08-31-2022 at 05:55.
Begineer Programmer is offline
 


Thread Tools
Display Modes

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 15:33.


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