Bot in kz_dajrokan
Hi. I have a problem with bot in dajrokan plugin... He should disconnect when players = 2 but he won't... Help!
There are a parts of code about bot:
PHP Code:
public client_putinserver(id) {
climber_time[id] = 0
climber_status[id] = STATUS_NONE
climber_no_block[id] = kz_no_block ? true : false
climber_rgb[id] = GLOW_DEF
climber_hud[id] = 1
climber_teleports[id] = 0
climber_checkpoints[id] = 0
climber_stuck[id] = STUCK_COUNT
climber_scout[id] = -1
climber_meter[id] = origo
climber_render[id] = true
climber_lock[id] = true
climber_action[id] = false
climber_autotp[id] = true
if (kz_bot) {
new players[32], inum
get_players(players, inum)
if (inum == 1)
mi_bot_connect()
}
return PLUGIN_CONTINUE
}
public client_disconnect(id) {
if (kz_bot)
if (get_playersnum(1) == 2)
mi_bot_disconnect()
return PLUGIN_CONTINUE
}
PHP Code:
public mi_bot_connect() {
if (!bot_id) {
bot_id = engfunc(EngFunc_CreateFakeClient, BOT_NAME)
new ptr[128]
dllfunc(DLLFunc_ClientConnect, bot_id, BOT_NAME, "127.0.0.1", ptr)
dllfunc(DLLFunc_ClientPutInServer, bot_id)
cs_set_user_team(bot_id, CS_TEAM_CT, CS_CT_URBAN)
dllfunc(DLLFunc_Spawn, bot_id)
set_pev(bot_id, pev_effects, (pev(bot_id, pev_effects) | 128))
set_pev(bot_id, pev_solid, 0)
bot_userid = get_user_userid(bot_id)
set_user_origin(bot_id, origo)
}
return PLUGIN_CONTINUE
}
public mi_bot_disconnect() {
if (bot_id) {
bot_id = 0
server_cmd("kick #%d", bot_userid)
}
return PLUGIN_CONTINUE
}
|