Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: TestClients

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Private First Class RobsoN's Avatar
    Join Date
    Jan 2013
    Location
    /home/cod2/
    Posts
    230
    Thanks
    119
    Thanked 95 Times in 64 Posts

    TestClients

    Hello everyone. Can you tell me where is a notify about "begin" (in Callback_PlayerConnect) ? My TestClients Bots can't pass it, but in older mod they could. What's wrong then?
    "Don't worry if your code doesn't work correctly - if everything worked, you would not work" ~Mosher's right

  2. #2
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    if you are testing on zombie mod, set autoassign 0

  3. #3
    Private First Class RobsoN's Avatar
    Join Date
    Jan 2013
    Location
    /home/cod2/
    Posts
    230
    Thanks
    119
    Thanked 95 Times in 64 Posts
    I don't think so autoassign have something to that. I deleted basic functions, and rewrited to my ones with deleting some useless stuff for me, so I could have missed something.
    "Don't worry if your code doesn't work correctly - if everything worked, you would not work" ~Mosher's right

  4. #4
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by RobsoN View Post
    I don't think so autoassign have something to that. I deleted basic functions, and rewrited to my ones with deleting some useless stuff for me, so I could have missed something.
    You know the golden rule - post your script. We can't see if there is a mistake without seeing the code itself.

  5. #5
    Private First Class RobsoN's Avatar
    Join Date
    Jan 2013
    Location
    /home/cod2/
    Posts
    230
    Thanks
    119
    Thanked 95 Times in 64 Posts
    What do you need ? Here is my Callback_PlayerConnect:
    PHP Code:
    Callback_PlayerConnect()
    {
        
    waittillframeend;

        if(
    isdefined(self))
        {
            
    level notify("connecting"self);
            
    level thread [[level.functions["onEvent"]]]("onPlayerConnecting"self);
        }
        
        
    // Before Connect
        
    self.statusicon "hud_status_connecting";
        
    self setClientCvar("download","Copyrights of extreme~Modding Team");
        
    iprintln("Connecting "+self.name);
        
    self waittill("begin");
        
    self.statusicon "";
        
    iprintln("Connected "+self.name); //cant see this debug
        // After Connect
        
    level notify("connected"self);
        
    level thread [[level.functions["onEvent"]]]("onPlayerConnect"self);
            [...] 
    And testclient script:
    PHP Code:
    addTestClients() //called on Callback_StartGameType
    {
        
    //level waittill("connected");
        
        
    wait 1;
        
        if(!
    level.debug)
            return;
        
        for(
    0level.debug_clientsi++)
        {
            
    ent[i] = addTestClient();
            
            if(!
    isDefined(ent[i]))
                continue;
        
            
    ent[ithread testClientInit();
        }
    }
    testClientInit()
    {
        
    self.pers["team"] = "axis";
        
    self.pers["primary_weapon"] = "knife_mp";
        
    self.data["bot"] = true;
        
    self.statusicon "";
        
    self thread maps\mp\gametypes\_zom::spawnPlayer();

    "Don't worry if your code doesn't work correctly - if everything worked, you would not work" ~Mosher's right

  6. #6
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Try this:

    PHP Code:
    addTestClients() //called on Callback_StartGameType
    {
        
    //level waittill("connected");
        
        
    wait 1;
        
        if(!
    level.debug)
            return;
        
        for(
    0level.debug_clientsi++)
        {
            
    ent[i] = addTestClient();
            
            if(!
    isDefined(ent[i]))
                continue;
        
            
    ent[ithread testClientInit"axis" );
        }
    }

    testClientInitteam )
    {
        while( !
    isdefinedself.pers["team"] ) )
            
    wait0.05 );

        
    self notify"menuresponse"game["menu_team"], team );
        
    wait0.5 );
        
    self notify"menuresponse"game["menu_weapon_axis"], "knife_mp" );


  7. #7
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    What do you need ? Here is my Callback_PlayerConnect:
    PHP Code:
    Callback_PlayerConnect()
    {
        
    waittillframeend;
    ...

    wouldnt that explain it?
    i wouldnt do anything before the begin-notify

  8. #8
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by serthy View Post
    wouldnt that explain it?
    i wouldnt do anything before the begin-notify
    No, I believe the problem is that the bots aren't given their notifications as they pass through the menus. They notify first for team, then for team weapons. If you don't do them, they wont spawn.

  9. The Following User Says Thank You to Tally For This Useful Post:

    RobsoN (15th October 2013)

  10. #9
    Private First Class RobsoN's Avatar
    Join Date
    Jan 2013
    Location
    /home/cod2/
    Posts
    230
    Thanks
    119
    Thanked 95 Times in 64 Posts
    Quote Originally Posted by Tally View Post
    No, I believe the problem is that the bots aren't given their notifications as they pass through the menus. They notify first for team, then for team weapons. If you don't do them, they wont spawn.
    They are spawning (self thread maps\mp\gametypes\_zom::spawnPlayer(); ) but one weird thing is, they have still connecting status icon, even i changed it to "" ( self.statusicon = ""; ) Btw, scripts wont work correctly on bots, because script are still waiting for connected player... (stuck on self waittill("begin") )
    "Don't worry if your code doesn't work correctly - if everything worked, you would not work" ~Mosher's right

  11. #10
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    Quote Originally Posted by RobsoN View Post
    (stuck on self waittill("begin") )
    just use the default callback_playerconnected() procedure (or the slightly modified one below)

    Code:
    Callback_PlayerConnect()
    {
    	self endon( "disconnect" );
    
    	self thread notifyConnecting();
    
    	self.statusicon = "hud_status_connecting";
    
    	self waittill( "begin" );
    
    	self.statusicon = "";
    	
    	waittillframeend;
    //...do your callback catching stuff here, AFTER everything went fine
    }
    
    notifyConnecting()
    {
    	self endon( "disconnect" );
    	self endon( "begin" );
    
    	waittillframeend;
    
    	if( isDefined( self ) )
    	{
    		level notify( "connecting" , self );
    	}
    }
    add a shitload of debug-iprintln()'s in combination with getTime() to see where it stucks and why

  12. The Following User Says Thank You to serthy For This Useful Post:

    RobsoN (15th October 2013)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •