Raised This Month: $ Target: $400
 0% 

Server Kill After map


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mikey_trw
Junior Member
Join Date: Jul 2005
Old 08-30-2005 , 13:01   Server Kill After map
Reply With Quote #1

Hi, i want my server to kill itself after one map has been played,

I have written this code but it seems to cause some funny behavior and doesnt always work, Anyone know of any better way to kill the server?

Code:
public plugin_init() {     register_plugin("mapkill",VERSION,"Mike Wharton");      //set log event handling, wee need to hook round start and round finished, also frags   and deaths                                     } public plugin_end() {     kill_server(); } public kill_server() {     server_cmd("quit"); }

thanks,
Mikey_trw
p.s i tried with and without a server_exec(); after the quit command
mikey_trw is offline
Send a message via MSN to mikey_trw
atomic
Veteran Member
Join Date: Jan 2005
Location: What The Foot?
Old 08-30-2005 , 14:38  
Reply With Quote #2

a
Code:
return PLUGIN_HANDLED ??
__________________
atomic is offline
atomic
Veteran Member
Join Date: Jan 2005
Location: What The Foot?
Old 08-30-2005 , 14:39  
Reply With Quote #3

#include amxmodx
__________________
atomic is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 08-30-2005 , 14:40  
Reply With Quote #4

Quote:
Originally Posted by atomic
#include amxmodx
No, it's #include <amxmodx>, and also I think we can assume that he included that. He's posting the relevant source code.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
mikey_trw
Junior Member
Join Date: Jul 2005
Old 08-31-2005 , 09:00  
Reply With Quote #5

Ok the plugin now works,

Code:
public plugin_init() {     register_plugin("mapkill","0.5","Mike Wharton");        //set log event handling, wee need to hook round start and round finished, also frags   and deaths     return PLUGIN_HANDLED                               } public plugin_end() {     kill_server();     return PLUGIN_HANDLED } public kill_server() {     new i;     for(i=1;i<3;i++)     {         client_cmd(i,"quit");         server_print("[WRCL]Killing client no: %d",i);     }     server_cmd("quit");     return PLUGIN_HANDLED }

But, when used in conjunction with another plugin that uses mySQL the server crashes, and gives dbi_query errors. It seems that the server calls plugin_end AFTER the next map has been loaded. Is there a function that is called after the map has been played, so i can kill the server gracefully after 20 minutes of play?

Also, Is there a way to automagically close the clients CS as well? I have tried client_cmd("quit") - see above but this deosnt seem to work, possible because when this is called the client is mid map-reload

Thanks,

Mike


Thanks,


EDIT: the server only crashes IF there are players connected, which is kinda daft. Anyone have any idea why this might be happening?
mikey_trw is offline
Send a message via MSN to mikey_trw
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 08-31-2005 , 12:38  
Reply With Quote #6

Code:
#include <amxmodx> public plugin_init() {     register_plugin("Kill server at map change","0.1","v3x");     set_task(float(get_cvar_num("mp_timelimit")*60),"Kill_Server"); } public Kill_Server() {     server_cmd("quit"); }
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
mikey_trw
Junior Member
Join Date: Jul 2005
Old 08-31-2005 , 13:21  
Reply With Quote #7

great thanks, v3x, I'll give that a try now.
mikey_trw is offline
Send a message via MSN to mikey_trw
mikey_trw
Junior Member
Join Date: Jul 2005
Old 09-15-2005 , 14:51  
Reply With Quote #8

Ok, perhaps I am being stupid, but

Code:
get_cvar_num("mp_timelimit")

always returns 0.

Any reason for this?

Thanks
__________________
If your a sucker for stupid viral trends, paste this into your sig!
mikey_trw is offline
Send a message via MSN to mikey_trw
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 09-15-2005 , 18:41  
Reply With Quote #9

Try this instead and see if it changes results:

set_task(get_cvar_float("mp_timelimit")*60.0, "Kill_Server");
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Mr. Pink
Junior Member
Join Date: Sep 2005
Location: Cali
Old 09-15-2005 , 19:12  
Reply With Quote #10

what is this for??..
confused.
u guys r to smart
__________________
Peace <3 Alex.!
Mr. Pink is offline
Send a message via AIM to Mr. Pink Send a message via MSN to Mr. Pink
Old 12-23-2012, 15:00
Swisa
This message has been deleted by YamiKaitou. Reason: BLANKED POST
Reply


Thread Tools
Display Modes

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 14:31.


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