Can You add events OnServerLoaded() and OnMapLoaded() ?
Thx.
Thx.
|
Request Event OnServerLoaded(), On MapLoaded();
|
|
Can You add events OnServerLoaded() and OnMapLoaded() ?
Thx.
04-07-2012, 20:08
04-07-2012, 21:00
I think he means the events after loading the server/map
(08-10-2011, 12:58)Pozzuh Wrote:Se7en Wrote:Stealed, from cod4 mod ...look who's talking [Release] Old School Mod v2.2 [Release] Scroll menu (04-07-2012, 21:00)iAegle Wrote: I think he means the events after loading the server/mapYes I need this because server go crash when Server is no loaded and i whant GetClients from server. (04-07-2012, 21:11)JariZ Wrote: @iAegle Yes. And those are both added already OnServerLoad is not a OnServerLoaded Test Code for unbelievers: Code: using System;
using System.Threading;
using Addon;
namespace Problem
{
public class Problem : CPlugin
{
private int clients;
public override void OnServerLoad()
{
Thread t = new Thread(GetNumOfCLients);
t.Start();
}
private void GetNumOfCLients()
{
while (true)
{
clients = GetClients().Count;
ServerPrint("Clients: " + clients + " on server");
Thread.Sleep(5000);
}
}
}
}Use Thread.Sleep(), for my computer is 15sec to final load server.
Hello,
OnPreMapChange -> executed when map change is scheduled but not started yet OnMapChange -> executed after the map changed OnServerLoad -> executed when the server is loading I recommend you to use a global variable, ex. bool ThreadStarted = false. Then you put OnMapChange Code: If(ThreadStarted==false)
{
Thread t = new Thread(GetNumOfCLients);
t.Start();
ThreadStarted = true;
}Another way is that you put a Thread.Sleep(7000) or something above the while.
|
| Possibly Related Threads… | |||||
| Thread | Author | Replies | Views | Last Post | |
| Hawken Closed Beta Event 3 Keys for PC | [DA]Bad Blood | 1 | 3,682 |
11-20-2012, 23:31 Last Post: SuperNovaAO |
|
|
|
Please add Event | Nerus | 7 | 4,230 |
09-10-2012, 11:52 Last Post: Nerus |
|
|
[Request] Event OnPlayerDisconnect | Nerus | 7 | 4,789 |
04-11-2012, 04:34 Last Post: zhp0083 |
| Event to happen when Player kills someone | StPatrick | 4 | 5,101 |
03-24-2012, 11:02 Last Post: hidra |
|
| [News] XP Event - Zipline Trailer | Tomsen1410 | 4 | 3,793 |
08-25-2011, 01:46 Last Post: skata3000 |
|
| Help level waittill("event" or " this event"); | Puffiamo | 8 | 5,285 |
07-11-2011, 21:34 Last Post: AZUMIKKEL |
|
| Users browsing this thread: |
| 1 Guest(s) |