AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Problem with reload (https://forums.alliedmods.net/showthread.php?t=19394)

NiteHawk 10-15-2005 22:11

Problem with reload
 
I want a script to make it reload on startup. Some files that I have
require a restart to be activated.

I tried doing this, but it reloads over and over, a loop, even though I'd think it shouldn't.

Code:

#include <amxmodx>

new RELOAD_YES 0

public plugin_init() {
if ( RELOAD_YES == 0) {
server_cmd( "reload" )
RELOAD_YES = 1
}
}


Zenith77 10-15-2005 22:19

Because everytime the plugin is activated this is called




Code:
new RELOAD_YES 0

which means that this line will be executed every time

Code:
if ( RELOAD_YES == 0) { server_cmd( "reload" ) RELOAD_YES = 1 }

XxAvalanchexX 10-15-2005 22:19

RELOAD_YES is set to 0 every time the server loads, it isn't saved between maps. Try a cvar instead.

Code:
#include <amxmodx> public plugin_init() {    register_cvar("reload_yes","1");    if(get_cvar_num("reload_yes")) {       set_cvar_num("reload_yes",0);       server_cmd("reload");    } }

The two things to note is that the 1 in register_cvar means that it will only be set to 1 the first time the cvar is created, not every time the plugin loads. The second thing is that the cvar is set before you tell the server to reload itself.

watch 10-15-2005 22:23

edit : lmao :D i responded to this too, looks like we all did


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

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