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

Configs


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Larsen
Senior Member
Join Date: Oct 2011
Old 11-06-2011 , 15:06   Configs
Reply With Quote #1

This isn't actually a script question, but I figure the people who frequent this forum would know the answer best.

I know need to know what kind of numbers (integers, decimal, real numbers, etc.) the configs/convars will read?

This is my config for a cronjob I want to run for map changes/warnings sent out before the restart:
Code:
// Say reboot notice to server 10 mins prior
// Starting at 7:50:00AM CST
sc_addjob 0 ? 7 7 50 50 "say Server is restarting in 10 minutes!"

// Say reboot notice to server 5 mins prior
// Starting at 7:55:00AM CST
sc_addjob 0 ? 7 7 55 55 "say Server is restarting in 5 minutes!"

// Say reboot center-screen notice to server 45 seconds prior
// Starting at 7:59:15AM CST
sc_addjob 0 ? 7 7 59.25 59.25 "sm_csay Server is restarting in 45 seconds, please reconnect!"

// Say reboot menu-say notice to server 40 seconds prior
// Starting at 7:59:20AM CST
sc_addjob 0 ? 7 7 59.33 59.33 "sm_msay Server is restarting in 40 seconds, reconnect!"

// Say reboot admin-chat notice to server 30 seconds prior
// Starting at 7:59:30AM CST
sc_addjob 0 ? 7 7 59.5 59.5 "sm_say Server is restarting in 30 seconds, reconnect!"

// Reboot the server on Sunday once a week at 8am CST
sc_addjob 0 ? 8 8 0 1 "quit"

// Say reboot notice to server 10 mins prior
// Starting at 7:50:00AM CST
sc_addjob 3 ? 7 7 50 50 "say Server is restarting in 10 minutes!"

// Say reboot notice to server 5 mins prior
// Starting at 7:55:00AM CST
sc_addjob 3 ? 7 7 55 55 "say Server is restarting in 5 minutes!"

// Say reboot center-screen notice to server 45 seconds prior
// Starting at 7:59:15AM CST
sc_addjob 3 ? 7 7 59.25 59.25 "sm_csay Server is restarting in 45 seconds, please reconnect!"

// Say reboot menu-say notice to server 40 seconds prior
// Starting at 7:59:20AM CST
sc_addjob 3 ? 7 7 59.33 59.33 "sm_msay Server is restarting in 40 seconds, reconnect!"

// Say reboot admin-chat notice to server 30 seconds prior
// Starting at 7:59:30AM CST
sc_addjob 3 ? 7 7 59.5 59.5 "sm_say Server is restarting in 30 seconds, reconnect!"

// Reboot the server on Wednesday once a week at 8am CST
sc_addjob 3 ? 8 8 0 1 "quit"
Will this work as I wrote for the notes? Am I able to use decimals like 59.5 to represent 30 seconds before the hour?

Also, does it matter if I use "quit" instead of "_restart"?
__________________


Last edited by Larsen; 11-06-2011 at 15:17.
Larsen is offline
Antithasys
Moderator
Join Date: Apr 2008
Old 11-06-2011 , 16:57   Re: Configs
Reply With Quote #2

Quote:
Originally Posted by Larsen View Post
This isn't actually a script question, but I figure the people who frequent this forum would know the answer best.

I know need to know what kind of numbers (integers, decimal, real numbers, etc.) the configs/convars will read?
Depends on the plugin that is reading the cvar. For instance, a plugin can use the following functions to read a cvar:

GetConVarBool()
GetConVarInt()
GetConVarFloat()
GetConVarString()

So, if the plugin is expecting a integer and you set a float, you would not get the result you expected. Likewise, if you set a string and it expects a float. If you don't know what it is expecting... check the source code or run some tests.
__________________
[my plugins]

When you think about asking a question... consider what have you tried?
Antithasys is offline
Larsen
Senior Member
Join Date: Oct 2011
Old 11-06-2011 , 17:06   Re: Configs
Reply With Quote #3

Thanks for the response Anti. The plugin is server crontab.
__________________

Larsen is offline
Antithasys
Moderator
Join Date: Apr 2008
Old 11-06-2011 , 20:00   Re: Configs
Reply With Quote #4

Quote:
Originally Posted by Larsen View Post
Thanks for the response Anti. The plugin is server crontab.
Integers not floats... took a bit to track down, but it appears to deal with integers only.
__________________
[my plugins]

When you think about asking a question... consider what have you tried?
Antithasys is offline
Larsen
Senior Member
Join Date: Oct 2011
Old 11-07-2011 , 00:49   Re: Configs
Reply With Quote #5

Thanks a lot anti, I really appreciate it. I assume in the future, there will be some definition for how long a string/floating point variable is valid? Or is that up to sourcemod?

Now to figure out how to schedule actions within one minute >__<
__________________

Larsen is offline
Antithasys
Moderator
Join Date: Apr 2008
Old 11-07-2011 , 13:12   Re: Configs
Reply With Quote #6

Quote:
Originally Posted by Larsen View Post
I assume in the future, there will be some definition for how long a string/floating point variable is valid? Or is that up to sourcemod?
Not sure I understand the question.
__________________
[my plugins]

When you think about asking a question... consider what have you tried?
Antithasys is offline
Larsen
Senior Member
Join Date: Oct 2011
Old 11-07-2011 , 14:31   Re: Configs
Reply With Quote #7

As in, how many digits? 1.33 or 1.3333333? How many digits would be legitimate?
__________________

Larsen is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 11-07-2011 , 15:46   Re: Configs
Reply With Quote #8

For strings, it's completely up to the plugin.

For floating point, it's likely an implementation of IEEE754... which are actually storing two parts of an equation: X * 2^Y

Needless to say, floating point are not high accuracy.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
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 15:43.


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