Raised This Month: $ Target: $400
 0% 

Detect "restart" command


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
grankee
Member
Join Date: Jun 2008
Old 05-17-2009 , 09:42   Detect "restart" command
Reply With Quote #1

How to detect command "restart" typed in server console(or player by rcon/hlsw by rcon)?
grankee is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 05-17-2009 , 09:47   Re: Detect "restart" command
Reply With Quote #2

the "restart" command or "sv_restart" / "sv_restartround" ?

for "restart", you just register it...

PHP Code:
plugin_init()
{
      
register_srvcmd("restart""cmd_restart")
}
 
public 
cmd_restart()
{
      
server_print("The command ^"restart^" used!")
 
      return 
PLUGIN_CONTINUE // use PLUGIN_HANDLED if you want to block the command

And I think it works also for sv_restart[round]
__________________
Hunter-Digital is offline
grankee
Member
Join Date: Jun 2008
Old 05-17-2009 , 09:51   Re: Detect "restart" command
Reply With Quote #3

Doesn't work
grankee is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 05-17-2009 , 09:56   Re: Detect "restart" command
Reply With Quote #4

Does this helps you?

PHP Code:

public plugin_init()
{    
    
register_forward(FM_ServerDeactivate,"serverDeactivate");
}

public 
serverDeactivate()
{
    

__________________
joaquimandrade is offline
grankee
Member
Join Date: Jun 2008
Old 05-17-2009 , 10:06   Re: Detect "restart" command
Reply With Quote #5

register_srvcmd("restart","cmd_restart")

if function cmd_restart doesn't exist then console show error
if function exist then not work




FM_ServerDeactivate works:
- when restart is typed?
- when server reserved?


Last edited by grankee; 05-17-2009 at 10:17.
grankee is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 05-17-2009 , 12:10   Re: Detect "restart" command
Reply With Quote #6

Quote:
Originally Posted by grankee View Post

FM_ServerDeactivate works:
- when restart is typed?
- when server reserved?

I guess it happens on restart, map change. The question is: what exactly do you want to happen?
__________________
joaquimandrade is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 05-17-2009 , 14:36   Re: Detect "restart" command
Reply With Quote #7

Well, you can detect restart this way:
PHP Code:
#include <amxmodx>

public plugin_init()
      
register_logevent("event_restart"2"1&Restart_Round")

public 
event_restart()
{
      
server_print("Game is restarting...")

__________________
Hunter-Digital is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 05-17-2009 , 18:43   Re: Detect "restart" command
Reply With Quote #8

Quote:
Originally Posted by Hunter-Digital View Post
Well, you can detect restart this way:
PHP Code:
#include <amxmodx>

public plugin_init()
      
register_logevent("event_restart"2"1&Restart_Round")

public 
event_restart()
{
      
server_print("Game is restarting...")

That's not "restart". That's "sv_restart".
__________________
joaquimandrade is offline
Old 05-17-2009, 21:01
Hunter-Digital
This message has been deleted by Hunter-Digital. Reason: nvm
-=hunter=-
Senior Member
Join Date: Jul 2008
Old 05-18-2009 , 06:26   Re: Detect "restart" command
Reply With Quote #10

grankee
What for you need it? When you write "restart" then all plugins stop, and then renew work at map loading.
-=hunter=- is offline
Send a message via ICQ to -=hunter=- Send a message via Skype™ to -=hunter=-
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 01:30.


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