#include <amxmodx>
#include <hamsandwich>
#include <engine>
#pragma tabsize 0
#define TASK_HELP 2487300
new g_HelpText[512]
new g_PlayerHelp
new g_PlayerJoin
new g_MaxClients
#define get_bit(%1,%2) ( %1 & 1 << ( %2 & 31 ) )
#define set_bit(%1,%2) %1 |= ( 1 << ( %2 & 31 ) )
#define clear_bit(%1,%2) %1 &= ~( 1 << ( %2 & 31 ) )
enum _hud { _hudsync, Float:_x, Float:_y, Float:_time }
new const g_HudSync[][_hud] =
{
{0, 0.6, 0.2, 2.0},
{0, -1.0, 0.7, 5.0},
{0, 0.1, 0.2, 2.0},
{0, 0.1, 0.3, 2.0},
{0, -1.0, 0.9, 3.0},
{0, 0.6, 0.1, 3.0},
{0, -1.0, 0.6, 3.0},
{0, 0.8, 0.3, 20.0},
{0, -1.0, 0.4, 3.0}
}
public plugin_init()
{
register_plugin("InformatiiModFurien","1.0","D3luxe")
register_clcmd("say /informatii","informatii_utile")
RegisterHam(Ham_Spawn, "player", "player_spawn", 1)
register_dictionary("informatii.txt")
g_MaxClients = get_global_int(GL_maxClients)
for(new i = 0; i < sizeof(g_HudSync); i++)
g_HudSync[i][_hudsync] = CreateHudSyncObj()
formatex(g_HelpText, charsmax(g_HelpText), "%L^n^n%L",
LANG_SERVER, "FURY_HELP_TITLE",
LANG_SERVER, "FURY_HELP_CMDS")
return PLUGIN_CONTINUE
}
public client_putinserver(id)
{
clear_bit(g_PlayerHelp, id)
clear_bit(g_PlayerJoin, id)
}
public informatii_utile(id)
{
new menu = menu_create("Meniu informatii utile :", "info_handler" );
menu_additem(menu, "\rAfiseaza Inforamtii", "1", 0);
menu_additem(menu, "\rNu acum", "2", 0);
menu_display( id, menu, 0);
return PLUGIN_CONTINUE;
}
public info_handler(id, menu, item, client)
{
static data[6], name[64], acs, cllbck, key
menu_item_getinfo(menu, item, acs, data, 5, name, 63, cllbck)
key = str_to_num(data)
switch(key)
{
case 1:
{
cmd_help(id)
}
case 2:
{
ChatColor(id, "!g[Furien] !yDaca te rezgandesti scrie !team/informatii !")
menu_destroy(menu)
return PLUGIN_HANDLED
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
public cmd_help(id)
{
if(id > g_MaxClients)
id -= TASK_HELP
remove_task(TASK_HELP + id)
switch(get_bit(g_PlayerHelp, id))
{
case(0):
{
set_bit(g_PlayerHelp, id)
player_hudmessage(id, 7, 15.0, {230, 100, 10}, "%s", g_HelpText)
set_task(15.0, "cmd_help", TASK_HELP + id)
}
default:
{
clear_bit(g_PlayerHelp, id)
ClearSyncHud(id, g_HudSync[7][_hudsync])
}
}
}
public player_spawn(id)
{
first_join(id)
return HAM_IGNORED
}
//**********************************************************************************STOCK-uri****************************************************************************************************
stock ChatColor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4")
replace_all(msg, 190, "!y", "^1")
replace_all(msg, 190, "!team", "^3")
if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}
stock first_join(id)
{
if(!get_bit(g_PlayerJoin, id))
{
set_bit(g_PlayerJoin, id)
clear_bit(g_PlayerHelp, id)
set_task(5.0, "cmd_help", TASK_HELP + id)
}
}
stock player_hudmessage(id, hudid, Float:time = 0.0, color[3] = {0, 255, 0}, msg[], any:...)
{
static text[512], Float:x, Float:y
x = g_HudSync[hudid][_x]
y = g_HudSync[hudid][_y]
if(time > 0)
set_hudmessage(color[0], color[1], color[2], x, y, 0, 0.00, time, 0.00, 0.00)
else
set_hudmessage(color[0], color[1], color[2], x, y, 0, 0.00, g_HudSync[hudid][_time], 0.00, 0.00)
vformat(text, charsmax(text), msg, 6)
ShowSyncHudMsg(id, g_HudSync[hudid][_hudsync], text)
}