Участник
Пользователь
- Сообщения
- 93
- Реакции
- 12
- Ошибка
-
// D:\disk c\scripting\adms_onl.sma(82) : error 029: invalid expression, assumed zero
// D:\disk c\scripting\adms_onl.sma(88) : error 029: invalid expression, assumed zero
- Компилятор
- Локальный
- Amx Mod X
- 1.9.0
- Исходный код
-
#include <amxmodx>
#include <engine>
#define PLUGIN "Show Admins Online"
#define AUTHOR "2010"
#define VERSION "1.0"
new bool:g_bAdminNick
new bool:is_admin_connected[33]
new g_msg[512]
new g_admin_enable
new g_online_color
new g_offline_color
new g_msg_xypos
//new g_SyncAdmin
//new g_iAdminCount
new admin
//new g_iMaxPlayers
new g_ClassName[] = "admin_msg"
public plugin_init()
{
register_plugin( PLUGIN, VERSION, AUTHOR )
register_think(g_ClassName,"ForwardThink")
g_admin_enable = register_cvar("plugin_on","1")
g_online_color = register_cvar("online_color","103 253 3")
g_offline_color = register_cvar("ffline_color","255 0 0")
g_msg_xypos = register_cvar("msg_xypos","0.21 0.01")
//g_SyncAdmin = CreateHudSyncObj()
new iEnt = create_entity("info_target")
entity_set_string(iEnt, EV_SZ_classname, g_ClassName)
entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 2.0)
}
public client_putinserver(id)
{
if(get_user_flags(id) & ADMIN_KICK)
{
is_admin_connected[id] = true
admin++
set_admin_msg()
}
if(admin == 0)
set_admin_msg()
}
public client_disconnected(id)
{
if(is_admin_connected[id])
{
is_admin_connected[id] = false
admin--
set_admin_msg()
}
}
public set_admin_msg()
{
static pos
pos = 0
pos += formatex(g_msg[pos], 511-pos, "Admins Online: %d", admin)
}
public admins_online()
{
if(get_pcvar_num(g_admin_enable))
{
static r, g, b, Float:x,Float:y
HudMsgPos(x,y)
if (admin > 0)
{
HudMsgColor(g_online_color, r, g, b)
set_dhudmessage(r, g, b, x, y, 0,)
show_dhudmessage(0, "%s", g_msg)
}
else
{
HudMsgColor(g_offline_color, r, g, b)
set_dhudmessage(r, g, b, x, y, 0,)
show_dhudmessage(0, "%s", g_msg)
}
}
return PLUGIN_HANDLED
}
public ForwardThink(iEnt)
{
admins_online()
if(g_bAdminNick)
{
set_admin_msg()
g_bAdminNick = false
}
entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 2.0)
}
public client_infochanged(id)
{
if(is_admin_connected[id])
{
static NewName[32], OldName[32]
get_user_info(id, "name", NewName, 31)
get_user_name(id, OldName, 31)
if(!equal(OldName, NewName))
{
g_bAdminNick = true
}
}
}
public HudMsgColor(cvar, &r, &g, &b)
{
static color[16], piece[5]
get_pcvar_string(cvar, color, 15)
argbreak( color, piece, 4, color, 15)
r = str_to_num(piece)
argbreak( color, piece, 4, color, 15)
g = str_to_num(piece)
b = str_to_num(color)
}
public HudMsgPos(&Float:x, &Float:y)
{
static coords[16], piece[10]
get_pcvar_string(g_msg_xypos, coords, 15)
argbreak(coords, piece, 9, coords, 15)
x = str_to_float(piece)
y = str_to_float(coords)
}
Всем привет ребят помогите )
В этой теме было размещено решение! Перейти к решению.