![]() |
Creating a bot entity...!
Here's my code:
//----------------------------------------------------------------------- edict_t *bot; int modelIndex; char c_skin[32]; char c_name[32] = "Player"; char c_index[3]; char *infobuffer; modelIndex = RANDOM_LONG(0,3); // Assign a random model char dir_name[32]; char filename[128]; char ptr[128]; sprintf(ptr, "Creating bot \"%s\" using model %s with skill=%d\n", c_name, modelIndex); GET_GAME_DIR(dir_name); sprintf(filename, "%s\\models\\player\\%s", dir_name, c_skin); bot = CREATE_FAKE_CLIENT(c_name); // Create the player entity infobuffer = GET_INFOBUFFER( bot ); SET_CLIENT_KEY_VALUE( 1, infobuffer, "model", c_skin ); SET_CLIENT_KEY_VALUE( 1, infobuffer, "index", c_index ); MDLL_ClientConnect (bot, c_name, "127.0.0.1", ptr); MDLL_ClientPutInServer (bot); //----------------------------------------------------------------------- What am I doing wrong ? when I try it it crashes...! How can I create a player entity in COunter-Strike ? what functions do you use ?:excl: |
Re: Creating a bot entity...!
Put your code in code tags next time. Here's my bot creation function (its for Counter-Strike)
Code:
void BotPutInServer (int iTeam, const char *szName) |
Re: Creating a bot entity...!
Sorry, I don't know how to put the code in tags...
BTW: Thanx for answering member's questions...;)! Keep up the good work ! |
Re: Creating a bot entity...!
BTW: I'm making a metamod plugin ! Does it have any difference ?
|
Re: Creating a bot entity...!
My code example is from metamod plugin too. :)
|
Re: Creating a bot entity...!
probably the crash is because the c_skin char array has never been put into anything before it's used.
|
All times are GMT +2. The time now is 02:03. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.