Addbot


(acQu) #1

Hi,

i try to add a player. He only needs to stand in spawn. But something wrong :confused:

Here code:

void Cmd_NM_Test1( gentity_t *ent ) {

		char userinfo[MAX_INFO_STRING];		
		gentity_t* bot;		
		
		userinfo[0] = '\0';
		bot = &g_entities[1];

		//trap_BotAllocateClient(0);

		Info_SetValueForKey(userinfo, "name", "test");
		Info_SetValueForKey(userinfo, "rate", "25000");
		Info_SetValueForKey(userinfo, "snaps", "20");
		Info_SetValueForKey(userinfo, "ip", "localhost");
		Info_SetValueForKey( userinfo, "team", "red" );
		//Info_SetValueForKey(userinfo, "cl_guid", guid.str().c_str());

		trap_SetUserinfo(1, userinfo);

		ClientConnect(1, qtrue, qfalse);
		ClientBegin( 1 );
		SetTeam( bot, "red", qtrue, -1, -1, qfalse );
}

From several sources, very reduced. Mainly i realized that userinfo stuff, and let him connect and spawn. But he only lays on the ground. I can shoot at him and he dies, but he is not really there it seems. Also got a nice PING 999.

Anybody up for a little help :frowning:


(shagileo) #2

Hm, can’t seem to recall such a code
For what kind of bot is this? Are you sure this is for Wolf:ET ?


(acQu) #3

That is code written in the C language :slight_smile: Yes its for Wolf:ET

That bot should only be standing. I really just only need him to stand. Like a client who is AFK. It doesnt matter if it is a bot or a client to me.

Question i have. Why this crashes my ET. Even when i copy the addbot function of g_bot.c and comment it out it crashes when i try to let him connect with this function here:

ClientConnect(1, qtrue, [B]qtrue[/B]);

That marked tells that it is a bot. With qfalse there is no crash. Why ?