Raised This Month: $ Target: $400
 0% 

Problem with reload


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NiteHawk
Junior Member
Join Date: Oct 2005
Old 10-15-2005 , 22:11   Problem with reload
Reply With Quote #1

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
}
}
NiteHawk is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 10-15-2005 , 22:19  
Reply With Quote #2

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 }
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 10-15-2005 , 22:19  
Reply With Quote #3

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.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
watch
Senior Member
Join Date: Sep 2005
Old 10-15-2005 , 22:23  
Reply With Quote #4

edit : lmao i responded to this too, looks like we all did
watch is offline
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 23:46.


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