Raised This Month: $ Target: $400
 0% 

Plugin not working after restart


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mordi
Senior Member
Join Date: Jul 2007
Location: o rly?
Old 08-27-2007 , 15:15   Plugin not working after restart
Reply With Quote #1

Code:
#include <amxmodx> #include <amxmisc> #include <fun> #define MAX_PLAYERS 32 new bool:g_restart_attempt[MAX_PLAYERS + 1] public plugin_init() {         register_plugin("test", "0.1", "test")     register_cvar("amx_test", "1")     register_event("ResetHUD", "event_hud_reset", "be")     register_clcmd("fullupdate", "clcmd_fullupdate")     register_event("TextMsg", "event_restart_attempt", "a", "2=#Game_will_restart_in")     } public clcmd_fullupdate() {     return PLUGIN_HANDLED_MAIN } public event_restart_attempt() {     new players[32], num     get_players(players, num, "a")     for (new i; i < num; ++i)         g_restart_attempt[players[i]] = true } public event_hud_reset(id) {     if (g_restart_attempt[id]) {         g_restart_attempt[id] = false         return             }         event_player_spawn(id) } public event_player_spawn(id) {     if(is_user_alive(id) && get_cvar_num("amx_test") > 0) {     set_task(0.1, "test", id)     }     } public test (id) {     strip_user_weapons(id)     give_item(id, "weapon_hegrenade") }

Compiles and works great, but if I restart the round it stops working. Why? And how do I cause amx_test 0 to restart?
__________________
Quote:
Originally Posted by Alka View Post
engine ?! 0o... *barf*

Last edited by mordi; 08-27-2007 at 15:19.
mordi is offline
X-Script
BANNED
Join Date: Jul 2007
Location: (#504434)
Old 08-28-2007 , 08:15   Re: Plugin not working after restart
Reply With Quote #2

It doesn't work because your registering it as a CVAR and if you want amx_text to restart you shouldn't use it as a CVAR.

Try this:
PHP Code:
#include <amxmodx>
#include <amxmisc>
 
#define PLUGIN "Restart"
#define VERSION "1.0"
#define AUTHOR "Blah"
 
public plugin_init()
{  
        
register_plugin(PLUGINVERSIONAUTHOR);
       
register_concmd("amx_restartserver""cmdrestart")
       
register_logevent("logevent_round_start"2"1=Round_Start");
    
}
public 
Round_Start()
{
        
set_task(2.5"auto_restart")
}
public 
auto_restart()
{
        
server_cmd("sv_restart 1");
}
public 
cmdrestart(id)
{
    
set_task(2.5"auto_restart")
    return 
PLUGIN_HANDLED

To restart just type in the console:
amx_restartserver
X-Script is offline
mordi
Senior Member
Join Date: Jul 2007
Location: o rly?
Old 08-28-2007 , 08:27   Re: Plugin not working after restart
Reply With Quote #3

I don't want it to auto-restart. I want to be able to turn a plugin on or off, on with 1 and off with 0. When someone type amx_test 1 it will turn on and restart and if someone type amx_test 0 it will turn off and restart.
__________________
Quote:
Originally Posted by Alka View Post
engine ?! 0o... *barf*
mordi is offline
X-Script
BANNED
Join Date: Jul 2007
Location: (#504434)
Old 08-28-2007 , 16:08   Re: Plugin not working after restart
Reply With Quote #4

Use your amxmodx menu.
Console:
amxmodmenu | Number Nine | Number Six.
X-Script is offline
mordi
Senior Member
Join Date: Jul 2007
Location: o rly?
Old 08-28-2007 , 17:07   Re: Plugin not working after restart
Reply With Quote #5

you still dont get the point.
__________________
Quote:
Originally Posted by Alka View Post
engine ?! 0o... *barf*
mordi is offline
X-Script
BANNED
Join Date: Jul 2007
Location: (#504434)
Old 08-28-2007 , 23:40   Re: Plugin not working after restart
Reply With Quote #6

then explain it more wtf...

you can't use a CVAR when trying this.

edit:
What the hell is this:
PHP Code:
public test (id) {
    
strip_user_weapons(id)
    
give_item(id"weapon_hegrenade")

How does that have anything related to what your doing..

Last edited by X-Script; 08-28-2007 at 23:43.
X-Script 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 16:08.


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