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

Top Flags [08/09/2021]


Post New Thread Reply   
 
Thread Tools Display Modes
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-05-2018 , 20:59   Re: Top Flags [05/10/2018]
Reply With Quote #51

Quote:
Originally Posted by iceeedr View Post
Bugsy, please forgive me, but statistics are not redefined once a day, but once a month (this is if the user wants to use it).
Oh, I'm sorry, I didnt realize you had the variable/cvar to determine if it should reset based on the day. Still, your plugin would require no map changes for this to work. I would implement another method for checking the day and resetting.

In plugin_init(), check the vault for a date record, if it does not exist or is expired, reset sets and write the current date. This would make the check occur on each map change while allowing it to only reset stats on the desired day of the month.
__________________

Last edited by Bugsy; 10-05-2018 at 21:06.
Bugsy is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 10-05-2018 , 21:06   Re: Top Flags [05/10/2018]
Reply With Quote #52

Quote:
Originally Posted by Bugsy View Post
Oh, I'm sorry, I didnt realize you had the variable/cvar to control the day it restarts.
Correct me if I'm wrong ..

PHP Code:
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// Here we set the day of the monthly reset and save the value in pcvar "VarTimeToReset"

set_task_ex(86400.0"CheckDate", .flags SetTask_Repeat// Here we configure the task that verifies the day, but it will be changed to a much lower value, I believe that 10 minutes is totally acceptable.

public CheckDate()
{
    new 
Day
    date
(.day Day)
    
    if(
Day == VarTimeToReset)
    {
        
server_cmd("amx_cvar csstats_reset 1")
        
client_print_color(0print_team_red"^x04[TopFlags]^x03: Today is day^x04 %d^x01 and the ranking will be^x04 reseted^x01, at the next map exchange, run to guarantee the^x04 TOP."Day)
        
set_task_ex(3.0"ChangeLevel", .flags SetTask_Once)

    }
// Finally we check the day, if the Day, is equal to pcvar (day chosen for the reset) the statistics will be reset and the map will be reloaded. 
Edit: Okay, parsing the plugin that was not you who wrote is not fun and easy haha, I did not understand this part well, could you give me an example?

Quote:
Originally Posted by Bugsy View Post
In plugin_init(), check the vault for a date record, if it does not exist or is expired, reset sets and write the current date. This would make the check occur on each map change while allowing it to only reset stats on the desired day of the month.
__________________


Quote:
Originally Posted by fysiks View Post
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.
https://iceeedr.com.br/

Last edited by iceeedr; 10-05-2018 at 21:09.
iceeedr is offline
Send a message via Skype™ to iceeedr
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-05-2018 , 21:25   Re: Top Flags [05/10/2018]
Reply With Quote #53

Something like this. It would use the nVault timestamp as the timestamp of the last reset which is accurate down to the second. This would also cover you for example if someone picked 31 as the day, with your current method you'd never get a reset in February or September, for example. When the map is changed or server is restarted and VarTimeToReset days have elapsed, a stats reset would happen. The next would not happen until VarTimeToReset days later.

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

const VarTimeToReset 5//# of days between stats reset (not day of the month)

public plugin_init() 
{
    
CheckDate();
}

public 
CheckDate()
{
    new 
iVault iTimeStamp iRecordExists;
    
    
iVault nvault_open"TopFlags" );
    
    
iRecordExists nvault_lookupiVault "StatsReset" "" iTimeStamp );
    
    if ( !
iRecordExists || ( iRecordExists && ( ( get_systime() - iTimeStamp ) >= ( VarTimeToReset 86400 ) ) ) )
    {
        
server_cmd"amx_cvar csstats_reset 1" );
        
nvault_setiVault "StatsReset" "" );
    }
    
    
nvault_closeiVault );

__________________

Last edited by Bugsy; 10-05-2018 at 21:27.
Bugsy is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 10-05-2018 , 21:31   Re: Top Flags [05/10/2018]
Reply With Quote #54

Great Bugsy, really I had not thought of the possibilities of extra-month days.
__________________


Quote:
Originally Posted by fysiks View Post
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.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 10-06-2018 , 11:35   Re: Top Flags [06/10/2018]
Reply With Quote #55

Code:
1.6 [05/10/2018] Final Release.
* Days count for the reset totally reformulated by Bugsy
* Added new pcvar to enable or disable reset function stats
* Added an #error message if you try to compile sma in versions lower than amxx 1.9
__________________


Quote:
Originally Posted by fysiks View Post
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.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 10-06-2018 , 14:32   Re: Top Flags [05/10/2018]
Reply With Quote #56

Quote:
Originally Posted by iceeedr View Post
error 008: must be a constant expression; assumed zero[/code]

Edit: The correct is:
Code:
#if AMXX_VERSION_NUM <19
    #error "This plugin requires AMXX 1.9"
#endif
Actually, it's < 190, not 19. Right now 181 is bigger than 19, change it to 190.

PHP Code:
#if AMXX_VERSION_NUM < 190
    #error "This plugin requires AMXX 1.9"
#endif 
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
noonsaibot
Junior Member
Join Date: Mar 2011
Old 10-26-2018 , 08:19   Re: Top Flags [06/10/2018]
Reply With Quote #57

İs there anyway that we can use it on 1.8.2 ?
noonsaibot is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 10-26-2018 , 08:29   Re: Top Flags [06/10/2018]
Reply With Quote #58

Quote:
Originally Posted by noonsaibot View Post
İs there anyway that we can use it on 1.8.2 ?
PM me.
__________________


Quote:
Originally Posted by fysiks View Post
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.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 02-26-2019 , 22:38   Re: Top Flags [27/02/2019]
Reply With Quote #59

1.7 [27/02/2019] Final Release.
* Added a define to exclude Admins of the TOPS count, example: I want the top 5 to win the flag, but of the top 5, 3 of them are admins, so only 2 common players would be contemplated, but now, the 5 will be, since adms count is added to the check factor.
__________________


Quote:
Originally Posted by fysiks View Post
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.
https://iceeedr.com.br/

Last edited by iceeedr; 05-08-2019 at 18:18.
iceeedr is offline
Send a message via Skype™ to iceeedr
glmmlg
Junior Member
Join Date: Apr 2014
Old 05-22-2019 , 08:07   Re: Top Flags [27/02/2019]
Reply With Quote #60

Little Help For AmxModx v1.10.0.5250

I have this error

Quote:
//// TopFlags.sma
//
// C:\Users\gm\Desktop\AMX10COMPILE\addons\amxmo dx\scripting\TopFlags.sma(50) : error 017: undefined symbol "iRankPos"
// C:\Users\gm\Desktop\AMX10COMPILE\addons\amxmo dx\scripting\TopFlags.sma(56) : error 017: undefined symbol "iRankPos"
// C:\Users\gm\Desktop\AMX10COMPILE\addons\amxmo dx\scripting\TopFlags.sma(42) : warning 203: symbol is never used: "iRank"
// C:\Users\gm\Desktop\AMX10COMPILE\addons\amxmo dx\scripting\TopFlags.sma(40) : warning 204: symbol is assigned a value that is never used: "iFlagsRestrictToCheck"
//
// 2 Errors.
// Could not locate output file C:\Users\gm\Desktop\AMX10COMPILE\addons\amxmo dx\scripting\compiled\TopFlags.amx (compile failed).
//
// Compilation Time: 0.17 sec
// ----------------------------------------

Press enter to exit ...
glmmlg is offline
Send a message via Skype™ to glmmlg
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 20:46.


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