AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   map change event ? (https://forums.alliedmods.net/showthread.php?t=206220)

hypheni 01-19-2013 22:51

map change event ?
 
What I'm trying to do is print admin name while he joins the server. If I put the method in client_putinserver or client_connect it will print even when map changes and all admin names will be printed in a quick sequence.

I need to show status if admin is connected while map is live not changed to a new map. Any ideas ?

fysiks 01-19-2013 22:57

Re: map change event ?
 
You probably have to store all the admins that are currently on the server at the time the map changes and then when the map starts, check to see if they are in that list. If they are, don't print their name.

A less reliable but easier alternative is to not display any names within the first X seconds of the map start. This means that the majority of the time, the admins that were already on the server at the end of the last map will not get displayed. Only the admins that join after X seconds after map start will be displayed.

hypheni 01-19-2013 23:28

Re: map change event ?
 
2nd method seems to be easy one but not realtime. Anyways how to trap map change event ?.

fysiks 01-20-2013 13:45

Re: map change event ?
 
Quote:

Originally Posted by hypheni (Post 1876627)
2nd method seems to be easy one but not realtime. Anyways how to trap map change event ?.

Before: plugin_end()
After: plugin_init()

hypheni 01-21-2013 01:07

Re: map change event ?
 
Couldn't get you, if possible show an example

YamiKaitou 01-21-2013 01:40

Re: map change event ?
 
plugin_init is called when the map starts
plugin_end is called when the map ends

hypheni 01-21-2013 01:55

Re: map change event ?
 
But each time map changes the plugin loaded to game memory from beginning, is it possible to increment a global counter to detect map change event ?

hypheni 01-21-2013 01:58

Re: map change event ?
 
I guess the way suggested by fysiks is better.

set a task from plugin_init which will execute few seconds later from plugin initialization and setting a global value true. then depending on that check execute proper code from client_connect/client_putinserver.

Correct ?

fysiks 01-21-2013 03:55

Re: map change event ?
 
Quote:

Originally Posted by hypheni (Post 1877275)

set a task from plugin_init which will execute few seconds later from plugin initialization and setting a global value true. then depending on that check execute proper code from client_connect/client_putinserver.

Correct ?

Yes. That is the second [less reliable] method that I described before.


All times are GMT -4. The time now is 13:39.

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