Hello AM, I come today with a strange problem and I ask for help ..
Spoiler
Code:
#include <amxmodx>
#include <amxmisc>
#include <csstats>
#define Debug "log.log"
new VarRank, VarFlags[MAX_NAME_LENGTH], VarRestrict[MAX_NAME_LENGTH], VarTimeToReset, szMap[MAX_NAME_LENGTH]
new bool:isTop[33]
public plugin_init()
{
register_plugin( "Top Flags", "1.4", "iceeedR" )
register_cvar("TopFlags", "1.0", FCVAR_SERVER | FCVAR_SPONLY)
bind_pcvar_num(create_cvar("tf_ranks", "10", .description = "Range of players that will receive the flags^nbased on rank. (Top 1, 2, 5, 10, 15 etc"), VarRank)
bind_pcvar_string(create_cvar("tf_flags", "k", .description = "The flags that TOP players will receive."), VarFlags, charsmax(VarFlags ))
bind_pcvar_string(create_cvar("tf_restricted", "abcdefghijlmnopqrs", .description = "Players with any of the flags set there will be ignored."), VarRestrict, charsmax(VarRestrict))
bind_pcvar_num(create_cvar("tf_day_reset", "0", .description = "On the selected day of each month the rank will be reset.", .has_min = true, .min_val = 0.0, .has_max = true, .max_val = 31.0), VarTimeToReset)
set_task_ex(86400.0, "CheckDate", .flags = SetTask_Repeat)
set_task_ex(120.0, "UpdateRanks", .flags = SetTask_Repeat)
get_mapname(szMap , charsmax(szMap))
AutoExecConfig(.autoCreate = true, .name = "TopFlags")
}
public UpdateRanks()
{
new iFlagsRestrictToCheck = read_flags(VarRestrict), flags = read_flags(VarFlags)
new izStats[STATSX_MAX_STATS] = {0, ...}, izBody[MAX_BODYHITS], iRank, iPlayers[MAX_PLAYERS], iNum, id
get_players_ex(iPlayers, iNum, GetPlayers_ExcludeBots | GetPlayers_ExcludeHLTV)
for(new i; i < iNum; i++)
{
id = iPlayers[i]
if(get_user_flags(id) & iFlagsRestrictToCheck)
continue
iRank = get_user_stats(id, izStats, izBody)
log_to_file(Debug, "Restrict %s, Vip %s, Ranking %i, Max rank %i",VarRestrict, VarFlags, iRank,VarRank )
if(iRank <= VarRank)
{
if(!isTop[id])
{
client_print_color(id, print_team_red, "^x04[TopFlags]^x03: Voce esta no^x03 TOP%d e ganhou o^x04 chat VIP.", VarRank)
client_print_color(0, print_team_red, "^x04[TopFlags]^x03: ^x04%n^x01 esta no^x03 TOP%d e ganhou o^x04 chat VIP.", id, VarRank)
remove_user_flags(id, ADMIN_USER)
set_user_flags(id, flags)
isTop[id] = true
}
}
else
{
if(isTop[id])
{
client_print_color(id, print_team_red, "^x04[TopFlags]^x03: Voce saiu do^x03 TOP%d e perdeu o^x04 chat VIP.", VarRank)
client_print_color(0, print_team_red, "^x04[TopFlags]^x03: ^x04%n^x01 saiu do^x03 TOP%d e perdeu o^x04 chat VIP.", id, VarRank)
remove_user_flags(id, flags)
set_user_flags(id, ADMIN_USER)
isTop[id] = false
}
}
}
}
public client_putinserver(id)
isTop[id] = false
public CheckDate()
{
new Day
date(.day = Day)
if(Day == VarTimeToReset)
{
server_cmd("amx_cvar csstats_reset 1")
client_print_color(0, print_team_red, "^x04[TopFlags]^x03: Hoje e dia^x04 %d^x01 e o ranking sera^x04 resetado^x01, corra para garantir o^x04 TOP.", Day)
ChangeLevel()
}
}
public ChangeLevel()
engine_changelevel(szMap)
I am trying to write the whole plugin with the new amxx 1.9, however it is crashing my home server (windows) that is with the last build of amxx, the server simply crashes, without any log error, even debug is never created, What is wrong ??
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
Does the server work without this plugin? What have you done to debug the plugin? Start disabling code that is being executed when it crashes, when it stops crashing, you know where to loo further.
Does the server work without this plugin? What have you done to debug the plugin? Start disabling code that is being executed when it crashes, when it stops crashing, you know where to loo further.
It works normally without the plugin, as I believe you have seen I have created a "log_to_file" inside the function before any conditional, but apparently it is never called .. did I use set_task_ex wrong?
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
I wouldn't take the "in-game" method as the best method to test. I would say that testing in HLDS is much better since that is generally the place it will be executed in the long run. If you think it's something with your installation of HLDS then you should create a new HLDS from scratch and install everything new and then test your plugin.
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.