-
Notifications
You must be signed in to change notification settings - Fork 1
/
FM_QUERYBUG_FIX.sma
57 lines (43 loc) · 1004 Bytes
/
FM_QUERYBUG_FIX.sma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "feckinmad/fm_global"
#include <fakemeta>
new const g_sBotName[] = "QueryRefresh"
new g_iBot
public plugin_init()
{
fm_RegisterPlugin()
set_task(5.0, "CreateBot")
}
public CreateBot()
{
if (get_playersnum())
{
return PLUGIN_HANDLED
}
g_iBot = engfunc(EngFunc_CreateFakeClient, g_sBotName)
if(!g_iBot)
{
return PLUGIN_HANDLED
}
// From metamod mutil.cpp: Allow plugins to call the entity functions in the GameDLL.
// In particular, calling "player()" as needed by most Bots
dllfunc(MetaFunc_CallGameEntity, "player", g_iBot)
new sRejectReason[128]
dllfunc(DLLFunc_ClientConnect, g_iBot, g_sBotName, "127.0.0.1", sRejectReason)
dllfunc(DLLFunc_ClientPutInServer, g_iBot)
new iFlags = pev(g_iBot, pev_flags)
set_pev(g_iBot, pev_flags, iFlags |= FL_FAKECLIENT)
set_task(5.0, "KickBot")
return PLUGIN_HANDLED
}
public client_putinserver(id)
{
KickBot()
}
public KickBot()
{
if (g_iBot)
{
server_cmd("kick #%d", get_user_userid(g_iBot))
g_iBot = 0
}
}