Raised This Month: $ Target: $400
 0% 

Serwer start event


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GoGoGo
Senior Member
Join Date: Apr 2008
Old 12-26-2008 , 10:51   Serwer start event
Reply With Quote #1

What event is called when serwer i starting? Not map, for example after crash I'm turning on server (this event).
__________________
Aaaaaa!
GoGoGo is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 12-26-2008 , 10:53   Re: Serwer start event
Reply With Quote #2

There's no such event.

AFAIK this is the first event which is called on AMX Mod X start (that means on every map start) although it's not what you're asking.
Code:
plugin_precache()
__________________
hleV is offline
GoGoGo
Senior Member
Join Date: Apr 2008
Old 12-26-2008 , 11:17   Re: Serwer start event
Reply With Quote #3

No. There isn't any solution?
__________________
Aaaaaa!
GoGoGo is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 12-26-2008 , 11:24   Re: Serwer start event
Reply With Quote #4

Well, server.cfg is executed on server start, maybe you can do something with it.
__________________
hleV is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 12-26-2008 , 11:37   Re: Serwer start event
Reply With Quote #5

Quote:
Originally Posted by GoGoGo View Post
No. There isn't any solution?
There are a couple of ways you can check it. Such as registering a cvar in plugin_init and checking to see if it exists in plugin_precache. If it doesn't, then the server just started up. This should work, but I have never tested it.

Another method is to write something (such as a 1) to vault/nvault/sqlite on plugin_init. Then on plugin_end, change it to a 0. Then, in plugin_precache, check the value of it. If it is still a 1, the server crashed.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
GoGoGo
Senior Member
Join Date: Apr 2008
Old 12-26-2008 , 12:26   Re: Serwer start event
Reply With Quote #6

Can you give me an example using it?
__________________
Aaaaaa!
GoGoGo is offline
|PJ| Shorty
Veteran Member
Join Date: Aug 2005
Location: Bavaria, Germany
Old 12-26-2008 , 21:39   Re: Serwer start event
Reply With Quote #7

iīm using this, small and usefull for me.
PHP Code:
new pcvar
public plugin_init() {
 
register_plugin("PLUGIN""VERSION""AUTHOR")
 
pcvar=register_cvar("server_restart","0")
}
public 
plugin_cfg() { 
 if(!
get_pcvar_num(pcvar)) {
  
log_amx("### server has restarted ###")
  
set_pcvar_num(pcvar,1)
 }

__________________
There are only 10 types of people in the world:
Those who understand binary, and those who donīt.
|PJ| Shorty is offline
Send a message via ICQ to |PJ| Shorty Send a message via AIM to |PJ| Shorty Send a message via MSN to |PJ| Shorty Send a message via Yahoo to |PJ| Shorty Send a message via Skype™ to |PJ| Shorty
GoGoGo
Senior Member
Join Date: Apr 2008
Old 12-27-2008 , 02:45   Re: Serwer start event
Reply With Quote #8

But it is calling in case resrat, I'm talking about server start.
__________________
Aaaaaa!
GoGoGo is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 12-27-2008 , 03:07   Re: Serwer start event
Reply With Quote #9

This should work for you, not tested

PHP Code:
#include <amxmodx>

public plugin_init()
{
    
register_cvar("server_startup""1");
}

public 
plugin_precache()
{
    if (!
cvar_exists("server_startup"))
        
// Server just started

__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
|PJ| Shorty
Veteran Member
Join Date: Aug 2005
Location: Bavaria, Germany
Old 12-27-2008 , 07:56   Re: Serwer start event
Reply With Quote #10

Quote:
Originally Posted by GoGoGo View Post
But it is calling in case resrat, I'm talking about server start.
it works on a server start too. i think there is no difference between start and restart.
__________________
There are only 10 types of people in the world:
Those who understand binary, and those who donīt.
|PJ| Shorty is offline
Send a message via ICQ to |PJ| Shorty Send a message via AIM to |PJ| Shorty Send a message via MSN to |PJ| Shorty Send a message via Yahoo to |PJ| Shorty Send a message via Skype™ to |PJ| Shorty
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 09:08.


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