Page 1 of 1

Reload script/plugin/addon question

Posted: Tue Dec 18, 2012 8:45 pm
by Tuck
Would it be possible to create a script that could reload it self?

or would it be safest to create a seperate script, that reloads another ?

Posted: Tue Dec 18, 2012 10:44 pm
by satoon101
I'm really not sure why you would want a script that reloaded itself. That makes no sense to me. Could you explain why you would want such a script?

This "should" work fine, though, if you really want to do that (be sure to replace <scriptname> with the name of your script):

Syntax: Select all

from core import GameEngine

def reload_script():
GameEngine.ServerCommand('sp reload <scriptname>\n')
Satoon

Posted: Wed Dec 19, 2012 3:41 am
by Tuck
satoon101 wrote:I'm really not sure why you would want a script that reloaded itself. That makes no sense to me. Could you explain why you would want such a script?

This "should" work fine, though, if you really want to do that (be sure to replace <scriptname> with the name of your script):

Syntax: Select all

from core import GameEngine

def reload_script():
GameEngine.ServerCommand('sp reload <scriptname>\n')
Satoon


basicly for maintaince to load new changes and then i was thinking of a command for devs to reload it

Posted: Wed Dec 19, 2012 4:09 am
by satoon101
New changes to what? The script itself? If that is the case, why not simply use "sp reload" in the server's console (or obviously use "rcon sp reload" remotely)? If you mean external changes, like updates to a .txt, .ini, or other file type that the script reads, there are "much" better ways than reloading the entire script.

Satoon

Posted: Wed Dec 19, 2012 4:14 am
by Tuck
satoon101 wrote:New changes to what? The script itself? If that is the case, why not simply use "sp reload" in the server's console (or obviously use "rcon sp reload" remotely)? If you mean external changes, like updates to a .txt, .ini, or other file type that the script reads, there are "much" better ways than reloading the entire script.

Satoon


i know but i wanted to create a reload feature without giving rcon access, and it was suppose to reload hole source code :)