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

Timeleft Modifier


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Admin Commands       
Honors
Member
Join Date: Jul 2011
Old 07-24-2011 , 19:00   Timeleft Modifier
Reply With Quote #1

Timeleft Modifier
v0.0.1

Simple way to add/remove time of timeleft. It is very easy to use, see Commands and Cvars sections for more informations.


Requirements
AMX Mod X 1.8.x
SnapShot 1.8.2 base and mod (see Installation section)

Commands
tm_addtime value
Add time ( in minute ) of timeleft


tm_removetime value
Remove time ( in minute ) of timeleft

Cvars
tm_looptext text ( default value : "An administrator can add/remove time to timeleft and changemap to the nextmap !" )
text is the text which will be looped every X seconds


tm_loopfrequence time ( default value : 120 )
time is the time ( in minute ) for text looped


tm_delaytochangemap time ( default value : 10.0 )
time is the time ( in second ) for the delay changemap (more informations, see Notes section)

Installations
Plugin :
Place the TimeleftModifier.amxx in your ./amxmodx/plugins/ folder.
Write TimeleftModifier.amxx at the bottom of your ./amxmodx/configs/plugins.ini file
SnapShot :
http://www.amxmodx.org/snapshots.php (base and mod)
Unzip the archives in your ./amxmodx/ folder

Notes
If you don't install SnapShot, you will see a dot after delay time
After removing time, if timeleft is lower than 0, the map is changed to the nextmap after X seconds (tm_delaytochangemap)
You can add/remove a maximum of 999 minutes

Changelog
v0.0.2 - Optimizations (thanks to fysiks)
v0.0.1 - First Release

Download
Attached Files
File Type: sma Get Plugin or Get Source (TimeleftModifier.sma - 673 views - 4.3 KB)

Last edited by Honors; 07-25-2011 at 05:04. Reason: v0.0.2
Honors is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-24-2011 , 19:04   Re: Timeleft Modifier
Reply With Quote #2

Use Pcvars. At least use set_[p]cvar_num() when setting a cvar. (refering to mp_timelimit)

Is a looped message really needed here? IMO, no. If an admin needs to know about it then they can find out other ways. It doesn't need to clutter the screen and tell everybody on the server about admin commands.

Also, make the access flag changeable via cmdaccess.ini. If you don't know how I can show you.
__________________

Last edited by fysiks; 07-24-2011 at 19:24. Reason: Moved edited section to new post.
fysiks is offline
Honors
Member
Join Date: Jul 2011
Old 07-24-2011 , 19:10   Re: Timeleft Modifier
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
At least use set_[p]cvar_num() when setting a cvar. (refering to mp_timelimit)
Done.

Quote:
Originally Posted by fysiks View Post
Is a looped message really needed here? IMO, no. If an admin needs to know about it then they can find out other ways. It doesn't need to clutter the screen and tell everybody on the server about admin commands.
I will add a cvar to enable/disable looped message.

Quote:
Originally Posted by fysiks View Post
Also, make the access flag changeable via cmdaccess.ini. If you don't know how I can show you.
How ?
Honors is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-24-2011 , 19:24   Re: Timeleft Modifier
Reply With Quote #4

Quote:
Originally Posted by Honors View Post
Done.
Use pcvars for all cvars:

PHP Code:

new g_pCvarTimeleft

// plugin_cfg
    
g_pCvarTimeleft get_cvar_pointer("mp_timelimit")

    
// elsewhere
    
set_pcvar_num(gCvarTimeleftiNumberHere

Quote:
Originally Posted by Honors View Post
I will add a cvar to enable/disable looped message.
IMO, it should be removed since there are better methods to do it more efficiently and less cluttered (meaning a plugin that combines all messages that need posted on a regular basis).

Quote:
Originally Posted by Honors View Post
How ?

PHP Code:
// plugin_init
    
register_concmd("tm_addtime""ClientCommand_AddTimeleft"ADMIN_KICK)
    
public 
ClientCommand_AddTimeleft(idlevel)
{
    if( 
get_user_flags(id) & level )
    {
        
//... 
Oh, and note registering as a console command because it can be used in both the server and client consoles.

Last but not least: IIRC, if the new timeleft is less than 0 it will automatically end the map and change to the next map (amx_nextmap).
__________________
fysiks is offline
Honors
Member
Join Date: Jul 2011
Old 07-24-2011 , 19:29   Re: Timeleft Modifier
Reply With Quote #5

Quote:
Originally Posted by fysiks View Post
Use pcvars for all cvars:
Last but not least: IIRC, if the new timeleft is less than 0 it will automatically end the map and change to the next map (amx_nextmap).
The plugin automatically change to the next map after X seconds (see cvars).

Edited.

PS : I have commented the part of code looping message.

Last edited by Honors; 07-24-2011 at 19:32.
Honors is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-24-2011 , 19:39   Re: Timeleft Modifier
Reply With Quote #6

Quote:
Originally Posted by Honors View Post
The plugin automatically change to the next map after X seconds (see cvars).
No, what I'm saying is the server will do it already. Test it without your changing the map functionality.
__________________
fysiks is offline
Honors
Member
Join Date: Jul 2011
Old 07-24-2011 , 19:42   Re: Timeleft Modifier
Reply With Quote #7

I don't understand.
Honors is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-24-2011 , 19:47   Re: Timeleft Modifier
Reply With Quote #8

Quote:
Originally Posted by Honors View Post
I don't understand.
PHP Code:
            if( newTimeLeft <= 


PHP Code:
            if( false 
Then test it. Set mp_timelimit to 3. Then play on your server for 2 minutes. Then do "tm_removetime 2"

It should show the scoreboard then change the map after mp_chattime has elapsed.
__________________
fysiks is offline
Honors
Member
Join Date: Jul 2011
Old 07-25-2011 , 04:55   Re: Timeleft Modifier
Reply With Quote #9

You're right. But why replace "if( newTimeLeft <= 0 )" by "if( false )" ?

If you don't replace this, there isn't bugs.
Honors is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-25-2011 , 06:42   Re: Timeleft Modifier
Reply With Quote #10

Quote:
Originally Posted by Honors View Post
You're right. But why replace "if( newTimeLeft <= 0 )" by "if( false )" ?

If you don't replace this, there isn't bugs.
If was shorter explain doing it that way rather than either rewriting the plugin for you or trying to explain what code to comment out.

But, if you would understand what it does after the changes then just test it as a "black box" then you would see that the code when the if condition is true is not needed.

I'm 99% sure it will work and the map change code is unneeded but I will test it later to change the 99 to a 100.
__________________
fysiks is offline
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 01:46.


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