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

Check value of a cvar for x seconds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bladell
Senior Member
Join Date: Jun 2012
Old 11-01-2013 , 07:51   Check value of a cvar for x seconds
Reply With Quote #1

How can I check, for example, if mp_timelimit value is 20 for x seconds?

Last edited by Bladell; 11-01-2013 at 10:54.
Bladell is offline
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 11-01-2013 , 08:32   Re: Check
Reply With Quote #2

Check this
__________________
alan_el_more is offline
Bladell
Senior Member
Join Date: Jun 2012
Old 11-01-2013 , 09:20   Re: Check
Reply With Quote #3

Sure, thnaks...I still wait a answer.
Bladell is offline
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 11-01-2013 , 10:33   Re: Check
Reply With Quote #4

Quote:
Use descriptive topic titles. People should know at a glance of the title what the thread is about.
__________________
alan_el_more is offline
Bladell
Senior Member
Join Date: Jun 2012
Old 11-01-2013 , 10:55   Re: Check value of a cvar for x seconds
Reply With Quote #5

Done, hope you are happy now because I really need some help asap.
Bladell is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-01-2013 , 10:56   Re: Check value of a cvar for x seconds
Reply With Quote #6

Quote:
Originally Posted by Bladell View Post
How can I check, for example, if mp_timelimit value is 20 for x seconds?
Your request doesn't make any sense. What are you actually trying to accomplish?
__________________
fysiks is offline
Bladell
Senior Member
Join Date: Jun 2012
Old 11-04-2013 , 11:46   Re: Check value of a cvar for x seconds
Reply With Quote #7

I have a problem with a plugin but I don't know how to solve it.The problem is that sometimes sv_maxspeed is blocked at 0 and players can't play untill change of map.So, I want to check if sv_maxspeed is 0 for more than 30 seconds, if yes, change the map to dust2.
Don't ask me to post here the source of plugin because I don't have it yet...
Bladell is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 11-04-2013 , 11:51   Re: Check value of a cvar for x seconds
Reply With Quote #8

Wouldn't it make more sense to try and figure out why you are having this issue than to create a plugin to workaround it? If you know the plugin that is causing the issue, go bug the author to fix it
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Bladell
Senior Member
Join Date: Jun 2012
Old 11-04-2013 , 12:07   Re: Check value of a cvar for x seconds
Reply With Quote #9

I think that is because of podbot module...

Code:
public plugin_init() {
	set_task(1.0, "check_cvar", _, _, _, "b")
}
	
public check_cvar() {
	new i;
	if(get_cvar_num("sv_maxspeed") <= 100)
		i++;

	if(i>=30)
		server_cmd("amx_map de_dust2")
}
Should work, right?

About the plugin...it's Super map chooser, but the author announced that the plugin have a lot of bugs and he will not update it.So...the source from alliedmodders isn't good.I fixed this plugin a few weeks ago, but I lost the source.
Trying to remove all bugs again isn't an option because I don't have enough time to make again 100 tests...I think that this is the reason because the author left this plugin.
Is my method good?
Bladell is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 11-04-2013 , 12:12   Re: Check value of a cvar for x seconds
Reply With Quote #10

Quote:
Originally Posted by Bladell View Post
I think that is because of podbot module...

Code:
public plugin_init() {
	set_task(1.0, "check_cvar", _, _, _, "b")
}
	
public check_cvar() {
	new i;
	if(get_cvar_num("sv_maxspeed") <= 100)
		i++;

	if(i>=30)
		server_cmd("amx_map de_dust2")
}
Should work, right?
No, because i will always be 0 at the start of the check. Move i to be a global variable and then it will work. Though, you should use PCVARs and reset i to 0 when it detects that it is higher than 100
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou 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 06:31.


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