Raised This Month: $ Target: $400
 0% 

I don't know why it's not working


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
killergirl
Senior Member
Join Date: Jul 2010
Old 11-27-2010 , 13:47   I don't know why it's not working
Reply With Quote #1

I've tried to modify the mapchooser.sma to make a bit better for my server. I modified for date and number of players, but the plugin won't working. When the vote time comes the maps it's extracted from maps_mini.ini, "doesen't cares" about the number of players, and what time is it. I've tested it without "check the number of players", only "check the time", and it's working. I don't know what to do.

PHP Code:
static players[32], playerCount;
new 
maps_ini_file[64];
new 
hourminutesecond;

time(hourminutesecond);
get_players(playersplayerCount"ch");
get_configsdir(maps_ini_file63);

if (
playerCount <= get_pcvar_num(pcvar_min_players)){
    
    
format(maps_ini_file63"%s/maps/maps_mini.ini"maps_ini_file);
    
    if (!
file_exists(maps_ini_file))
    
get_cvar_string("mapcyclefile"maps_ini_file63)
    if (
loadSettings(maps_ini_file))
    
set_task(15.0"voteNextmap"987456""0"b")
    }
    else{
    if (
hour >= get_pcvar_num(pcvar_start_night) && 
        
hour get_pcvar_num(pcvar_end_night)){
    
format(maps_ini_file63"%s/maps/maps_night.ini"maps_ini_file);
    
    if (!
file_exists(maps_ini_file))
        
get_cvar_string("mapcyclefile"maps_ini_file63)
    if (
loadSettings(maps_ini_file))
        
set_task(15.0"voteNextmap"987456""0"b")
    }
    else{
    
format(maps_ini_file63"%s/maps/maps_normal.ini"maps_ini_file);
    
    if (!
file_exists(maps_ini_file))
        
get_cvar_string("mapcyclefile"maps_ini_file63)
    if (
loadSettings(maps_ini_file))
        
set_task(15.0"voteNextmap"987456""0"b")
    }

killergirl is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-27-2010 , 17:09   Re: I don't know why it's not working
Reply With Quote #2

There is always ZERO (0) players when the server starts/changes map.
__________________
fysiks is offline
killergirl
Senior Member
Join Date: Jul 2010
Old 11-28-2010 , 05:05   Re: I don't know why it's not working
Reply With Quote #3

The plugin starts when 1 minute remains from the current map. When 1 minute remains the plugin check the number of the players, and not when the server changes the map.

I also check if the plugin works well, and yes...

PHP Code:
#include <amxmodx>

new pcvar_min_players;

static 
players[32

public 
plugin_init()

register_plugin("asd","1.0","KG")

pcvar_min_players register_cvar("min_players""6")
}

public 
juc(id){
set_task(1.0,"jucdoi",id)
}

public 
jucdoi(id){
new 
playerCount;

get_players(playersplayerCount"ch");
if (
playerCount <= get_pcvar_num(pcvar_min_players)){
client_print(0print_chat"THE NUMBER OF PLAYERS IS LESS OR EQUALY THAN %d"get_cvar_num("min_players"));
}
else{
client_print(0print_chat"THE NUMBER OF PLAYERS IS HIGHER THAN %d"get_cvar_num("min_players"));
}
return 
PLUGIN_HANDLED

killergirl is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-28-2010 , 13:24   Re: I don't know why it's not working
Reply With Quote #4

Are you saying that the code in your first post is not in plugin_init()? You are going to need to show your whole code to get help. If it's more than a couple hundred lines then attach the .sma file.
__________________
fysiks is offline
killergirl
Senior Member
Join Date: Jul 2010
Old 11-28-2010 , 16:39   Re: I don't know why it's not working
Reply With Quote #5

Yes is there in plugin_init(). Really I don't get it... why the plugin works with "end night & start night" and the "check the number of players" it's not working. Sorry for my expression, I can't explain it better.

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define SELECTMAPS  5

#define charsof(%1) (sizeof(%1)-1)

new Array:g_mapName;
new 
g_mapNums;

new 
g_nextName[SELECTMAPS]
new 
g_voteCount[SELECTMAPS 2]
new 
g_mapVoteNum
new g_teamScore[2]
new 
g_lastMap[32]

new 
g_coloredMenus
new bool:g_selected false

new pcvar_end_night;
new 
pcvar_start_night;
new 
pcvar_min_players;

public 
plugin_init()
{
    
register_plugin("Nextmap Chooser"AMXX_VERSION_STR"AMXX Dev Team")
    
register_dictionary("mapchooser.txt")
    
register_dictionary("common.txt")
    
    
g_mapName=ArrayCreate(32);
    
    new 
MenuName[64]
    
    
format(MenuName63"%L""en""CHOOSE_NEXTM")
    
register_menucmd(register_menuid(MenuName), (-1^(-1<<(SELECTMAPS+2))), "countVote")
    
register_cvar("amx_extendmap_max""90")
    
register_cvar("amx_extendmap_step""15")
    
pcvar_start_night register_cvar("start_night""0")
    
pcvar_end_night register_cvar("end_night""11")
    
pcvar_min_players register_cvar("min_players""6")

    if (
cstrike_running())
        
register_event("TeamScore""team_score""a")

    
get_localinfo("lastMap"g_lastMap31)
    
set_localinfo("lastMap""")

    static 
players[32], playerCount;
    new 
maps_ini_file[64];
    new 
hourminutesecond;

    
time(hourminutesecond);
    
get_players(playersplayerCount"ch");
    
    
get_configsdir(maps_ini_file63);
    if (
playerCount <= get_pcvar_num(pcvar_min_players)){
    
    
format(maps_ini_file63"%s/maps/maps_mini.ini"maps_ini_file);
    
    if (!
file_exists(maps_ini_file))
    
get_cvar_string("mapcyclefile"maps_ini_file63)
    if (
loadSettings(maps_ini_file))
    
set_task(15.0"voteNextmap"987456""0"b")
    }
    else{
    if (
hour >= get_pcvar_num(pcvar_start_night) && 
        
hour get_pcvar_num(pcvar_end_night)){
    
format(maps_ini_file63"%s/maps/maps_night.ini"maps_ini_file);
    
    if (!
file_exists(maps_ini_file))
        
get_cvar_string("mapcyclefile"maps_ini_file63)
    if (
loadSettings(maps_ini_file))
        
set_task(15.0"voteNextmap"987456""0"b")
    }
    else{
    
format(maps_ini_file63"%s/maps/maps_normal.ini"maps_ini_file);
    
    if (!
file_exists(maps_ini_file))
        
get_cvar_string("mapcyclefile"maps_ini_file63)
    if (
loadSettings(maps_ini_file))
        
set_task(15.0"voteNextmap"987456""0"b")
    }
      }
    
g_coloredMenus colored_menus()
    

killergirl is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-28-2010 , 17:56   Re: I don't know why it's not working
Reply With Quote #6

That answer is the same as I said before, there are ZERO players on the server during plugin_init().
__________________
fysiks is offline
killergirl
Senior Member
Join Date: Jul 2010
Old 11-28-2010 , 17:58   Re: I don't know why it's not working
Reply With Quote #7

hmm, good to know... is there a way to solve my problem?
killergirl is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-28-2010 , 18:02   Re: I don't know why it's not working
Reply With Quote #8

Quote:
Originally Posted by killergirl View Post
hmm, good to know... is there a way to solve my problem?
It's really hard to tell what a "fix" might be because not everybody joins the server at the same time. It will depend on how fast people can cache required resources.

Use a set_task() to do anything related to the number of players. Make it long enough so that all players from the previous map are connected. OR, you can get the number of players at the end of the map previous and use that number but could be inaccurate because people tend to leave on map changes (in my experience; maybe not so much in Counter-Strike since it's more boring than watching paint dry and many will leave early ).
__________________
fysiks is offline
killergirl
Senior Member
Join Date: Jul 2010
Old 11-29-2010 , 08:50   Re: I don't know why it's not working
Reply With Quote #9

Quote:
it's more boring than watching paint dry
haha xD

I will try to use with set_task. Thank you for opinion and post!
killergirl is offline
Reply


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 11:16.


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