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?
Printable View
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?
if you are testing on zombie mod, set autoassign 0
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.
What do you need ? Here is my Callback_PlayerConnect:And testclient script: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);
[...]
PHP Code:
addTestClients() //called on Callback_StartGameType
{
//level waittill("connected");
wait 1;
if(!level.debug)
return;
for(i = 0; i < level.debug_clients; i++)
{
ent[i] = addTestClient();
if(!isDefined(ent[i]))
continue;
ent[i] thread 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();
}
Try this:
PHP Code:
addTestClients() //called on Callback_StartGameType
{
//level waittill("connected");
wait 1;
if(!level.debug)
return;
for(i = 0; i < level.debug_clients; i++)
{
ent[i] = addTestClient();
if(!isDefined(ent[i]))
continue;
ent[i] thread testClientInit( "axis" );
}
}
testClientInit( team )
{
while( !isdefined( self.pers["team"] ) )
wait( 0.05 );
self notify( "menuresponse", game["menu_team"], team );
wait( 0.5 );
self notify( "menuresponse", game["menu_weapon_axis"], "knife_mp" );
}
wouldnt that explain it?Quote:
What do you need ? Here is my Callback_PlayerConnect:PHP Code:
Callback_PlayerConnect()
{
waittillframeend;
...
}
i wouldnt do anything before the begin-notify
CoD2 is really sensitive with waittillframeend; when it comes to spawnplayer() function. Try adding waittillframeend; or just a plain wait .05 before doing anything with your bot (that includes setting the .pers["team"])
Thanks for the quick reply, I tried your ideas, but nothing has changed.
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") )
just use the default callback_playerconnected() procedure (or the slightly modified one below)
add a shitload of debug-iprintln()'s in combination with getTime() to see where it stucks and whyCode: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 );
}
}
Wow, really respect dude. It's working well now. Thank you so much! :)
What about on map change?
I tried adding test clients using addTestClient() (which, I think, is a stock function). The bot connects, gets to the spectators team, has a 999 ping, no problem there, since I have the rest of the functions to spawn it and make it play the game.
On map change, they just have the connecting status (with -1 ping). I can kick them, but they won't join, and I can't access them (they are not included in the list of players anymore). Can I do something here to access them? I'm thinking about kicking and re-adding them on every map start if there's no better solution.
Map change is done (in bot-mods without libcod) tis way:
- kick all player, but let them /reconnect automatically after a few seconds (execClientCommand()-hack)
- kill the server (removes the bots)
- retsart the server with your new map
- now the players start to reconnect
you can have a peek on cod2/cod4 bot mods for this
iirc here is likely a thread abut this already
Or use the kickbot libcod function?
Appending to serthys answer, write logPrint("QUIT"); and let B3 register this and send "quit" via rcon, while the server.sh start script is in an infinite loop.
But I don't know if that is what you want, guiismiti, since two years ago we had same topic (even started by you :D).
http://killtube.org/showthread.php?1...Command-Adding!
http://killtube.org/showthread.php?1...ot-%28CoD-2%29
Yea, the kill method worked well.
Without libcod, I had to give a player rcon access to execute the kill.cfg (doesn't look exploitable).
Now I'm thinking about
- writing a file with the number of the name of the bots;
- changing the map without killing;
- kicking the spectator bots.
The advantage is, players won't need to reconnect.
Kick bots before you change map so you still know which players are the bots.
I don't know what I missed last time I dealed with bots....
I just used the kick command while they were connected, and they got kicked successfully... I remember having a lot of trouble last time (over a year ago).
You tried this? http://killtube.org/showthread.php?1940-Kicking-bots
BTW the vbulletin default search is totally useless, I just find this stuff with google ^^Quote:
entnum = players[i] getentitynumber();
kick(entnum);
free_slot(entnum);
No, and I just noticed that what I did didn't work, and I remembered why.
Yea I saw, but at the moment I am, once again, writing it libcod free. I'm gonna adjust it if at least one of the brazilian providers agree to use it.