Raised This Month: $ Target: $400
 0% 

Run Command Ever 30 Seconds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mofomikeman
Junior Member
Join Date: Nov 2005
Old 02-13-2006 , 19:40   Run Command Ever 30 Seconds
Reply With Quote #1

How would I make my server run a simple command (sv_stepsize 999999) every thirty seconds (as something keeps changing it, not an admin, cause i took all admin off and set it and something changes it at round start, none of my plugins, stopped them all). and somethings it just does sv_stepsize 18 randomly... just, answer the first question.
__________________
+ Karma Please
mofomikeman is offline
Send a message via AIM to mofomikeman Send a message via MSN to mofomikeman
c0rdawg
Senior Member
Join Date: Jan 2006
Old 02-13-2006 , 19:57  
Reply With Quote #2

you need to use set_task or you can hook the command that does the sv_stepsize
c0rdawg is offline
Send a message via AIM to c0rdawg Send a message via MSN to c0rdawg
mofomikeman
Junior Member
Join Date: Nov 2005
Old 02-13-2006 , 20:01  
Reply With Quote #3

Quote:
Originally Posted by c0rdawg
you need to use set_task or you can hook the command that does the sv_stepsize
Woah... uhh, can you put that in english?
__________________
+ Karma Please
mofomikeman is offline
Send a message via AIM to mofomikeman Send a message via MSN to mofomikeman
KoST
Senior Member
Join Date: Jul 2005
Old 02-13-2006 , 20:01  
Reply With Quote #4

The following code checks every 30 seconds if sv_stepsize was changed.
if it was changed then it is set to 18 in this example

Code:
#include <amxmodx> #define sv_stepsize 18 // here you can adjust stepsize new Float:seconds=30.0 // here you can change the seconds public plugin_init(){     register_plugin("Timer","0.1","KoST")     //set_task(seconds,"MyTimer") [edit]     set_task(seconds,"MyTimer",0,"",0,"b") } public MyTimer(){     new step_size=get_cvar_num("sv_stepsize")     if (step_size!=sv_stepsize) {         set_cvar_num("sv_stepsize",sv_stepsize)     } }

you can also lower seconds to 1.0 or sth. like that, since this checks first if change is needed

hope this helps..
__________________
KoST is offline
c0rdawg
Senior Member
Join Date: Jan 2006
Old 02-13-2006 , 20:08  
Reply With Quote #5

doesn't that only check once?
c0rdawg is offline
Send a message via AIM to c0rdawg Send a message via MSN to c0rdawg
KoST
Senior Member
Join Date: Jul 2005
Old 02-13-2006 , 20:13  
Reply With Quote #6

oops:

change:
Code:
set_task(seconds,"MyTimer")

to:
Code:
set_task(seconds,"MyTimer",0,"",0,"b")


btw:
there is another way to do this with no timer at all
with register_logevent, i'm going to try this..
__________________
KoST is offline
c0rdawg
Senior Member
Join Date: Jan 2006
Old 02-13-2006 , 20:15  
Reply With Quote #7

hahaha yeah i thought so
c0rdawg is offline
Send a message via AIM to c0rdawg Send a message via MSN to c0rdawg
mofomikeman
Junior Member
Join Date: Nov 2005
Old 02-13-2006 , 20:22  
Reply With Quote #8

Quote:
Originally Posted by KoST
oops:

change:
Code:
set_task(seconds,"MyTimer")

to:
Code:
set_task(seconds,"MyTimer",0,"",0,"b")


btw:
there is another way to do this with no timer at all
with register_logevent, i'm going to try this..
I was about to say it compiled with 0 errors, but did absolutly dick.
__________________
+ Karma Please
mofomikeman is offline
Send a message via AIM to mofomikeman Send a message via MSN to mofomikeman
c0rdawg
Senior Member
Join Date: Jan 2006
Old 02-13-2006 , 20:24  
Reply With Quote #9

did you wait the complete 30 seconds, it looks right to me...
c0rdawg is offline
Send a message via AIM to c0rdawg Send a message via MSN to c0rdawg
mofomikeman
Junior Member
Join Date: Nov 2005
Old 02-13-2006 , 20:25  
Reply With Quote #10

Quote:
Originally Posted by KoST
oops:

change:
Code:
set_task(seconds,"MyTimer")

to:
Code:
set_task(seconds,"MyTimer",0,"",0,"b")


btw:
there is another way to do this with no timer at all
with register_logevent, i'm going to try this..
if you do it, email me [email protected]
__________________
+ Karma Please
mofomikeman is offline
Send a message via AIM to mofomikeman Send a message via MSN to mofomikeman
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 00:09.


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