Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Request Event OnServerLoaded(), On MapLoaded();
#1
Can You add events OnServerLoaded() and OnMapLoaded() ?
Thx.
Reply

#2
[Image: 09wpZ.jpg]


http://cod6hmod.itshax.com/mw3_addon/doc/#svonload
http://cod6hmod.itshax.com/mw3_addon/doc/#svonmapchange
Reply

#3
already added
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Reply

#4
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

Reply

#5
@iAegle Yes. And those are both added already
Reply

#6
(04-07-2012, 21:00)iAegle Wrote: I think he means the events after loading the server/map
Yes 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.
Reply

#7
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
CSHARP Code
  1. If(ThreadStarted==false)
  2. {
  3. Thread t = new Thread(GetNumOfCLients);
  4. t.Start();
  5. ThreadStarted = true;
  6. }


Another way is that you put a Thread.Sleep(7000) or something above the while.
[Image: azuw.jpg]
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Hawken Closed Beta Event 3 Keys for PC [DA]Bad Blood 1 2,714 11-20-2012, 23:31
Last Post: SuperNovaAO
Question Please add Event Nerus 7 3,092 09-10-2012, 11:52
Last Post: Nerus
Question [Request] Event OnPlayerDisconnect Nerus 7 3,423 04-11-2012, 04:34
Last Post: zhp0083
  Event to happen when Player kills someone StPatrick 4 3,599 03-24-2012, 11:02
Last Post: hidra
  [News] XP Event - Zipline Trailer Tomsen1410 4 2,690 08-25-2011, 01:46
Last Post: skata3000
  Help level waittill("event" or " this event"); Puffiamo 8 3,949 07-11-2011, 21:34
Last Post: AZUMIKKEL

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.