AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Configs (https://forums.alliedmods.net/showthread.php?t=171494)

Larsen 11-06-2011 15:06

Configs
 
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"?

Antithasys 11-06-2011 16:57

Re: Configs
 
Quote:

Originally Posted by Larsen (Post 1591410)
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.

Larsen 11-06-2011 17:06

Re: Configs
 
Thanks for the response Anti. The plugin is server crontab.

Antithasys 11-06-2011 20:00

Re: Configs
 
Quote:

Originally Posted by Larsen (Post 1591504)
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.

Larsen 11-07-2011 00:49

Re: Configs
 
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 >__<

Antithasys 11-07-2011 13:12

Re: Configs
 
Quote:

Originally Posted by Larsen (Post 1591661)
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.

Larsen 11-07-2011 14:31

Re: Configs
 
As in, how many digits? 1.33 or 1.3333333? How many digits would be legitimate?

Powerlord 11-07-2011 15:46

Re: Configs
 
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.


All times are GMT -4. The time now is 05:05.

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