Alguém ajeita esse plugin ele não compila '-'
Código:
/*================================================================================
---------------------------------------------------------------------------------
| <= Description => |
| ----------------- |
| |
| This plugin added a colored NightVision into Zombie Infection Mod (Biohazard).|
| Some code taken from Zombie Plague 4.3. Thanks you, MeRcyLeZZ. |
| Official page: < http://amxx.com.ua/bio-colored-nightvision/ > |
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
| <= CVARs => |
| ----------- |
| |
| nvg_radius 80 - Size radius lighting. |
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
| <= Changelog => |
| --------------- |
| |
| * v1.0: (3.9.2010) |
| - First release. |
---------------------------------------------------------------------------------
================================================================================*/
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <biohazard>
#define PLUGIN "[BIO] Colored NightVision"
#define VERSION "1.0"
#define AUTHOR "Slavvkko"
#define OFFSET_TEAM 114
#define OFFSET_NVG 129
new const g_Colors[][3] =
{
// R G B
{150, 0, 0}, // 1
{0, 150, 0}, // 2
{0, 0, 150}, // 3
{0, 150, 150}, // 4
{102, 0, 255}, // 5
{202, 31, 123}, // 6
{255, 255, 0} // 7
};
new g_UserColor[33][3];
new bool:g_Chose[33];
new bool:g_nvision[33];
new bool:g_nvisionenabled[33];
new g_playername[33][32];
new g_maxplayers;
// SaveColor written by type Zombie Plague 4.3
const MAX_STATS_SAVED = 64;
new db_name[MAX_STATS_SAVED][32];
new db_user_nvg_color[MAX_STATS_SAVED][3];
new bool:db_chose[MAX_STATS_SAVED];
new db_slot_i;
new cvar_autonvg, cvar_radius;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_dictionary("bio_colored_nightvision.txt");
register_logevent("logevent_round_end", 2, "1=Round_End");
register_clcmd("say /nvg", "clcmd_nvg");
register_clcmd("say_team /nvg", "clcmd_nvg");
register_clcmd("nightvision", "clcmd_nightvision");
cvar_autonvg = get_cvar_pointer("bh_autonvg");
cvar_radius = register_cvar("nvg_radius", "80");
RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", 1);
RegisterHam(Ham_Killed, "player", "fw_PlayerKilled");
register_forward(FM_ClientUserInfoChanged, "fw_ClientUserInfoChanged");
g_maxplayers = get_maxplayers();
register_message(get_user_msgid("NVGToggle"), "message_NVGToggle");
}
public logevent_round_end()
{
static id;
for (id = 1; id <= g_maxplayers; id++)
SaveColor(id);
}
public fw_PlayerSpawn_Post(id)
{
if (!is_user_alive(id) || !fm_cs_get_user_team(id))
return;
remove_task(id);
g_nvision[id] = false;
}
public fw_PlayerKilled(victim, attacker, shouldgib)
{
g_nvision[victim] = false;
set_task(0.1, "spec_nvision", victim);
}
public fw_ClientUserInfoChanged(id)
{
get_user_name(id, g_playername[id], charsmax(g_playername[]));
}
public client_putinserver(id)
{
get_user_name(id, g_playername[id], charsmax(g_playername[]));
// Set color 2
g_UserColor[id] = g_Colors[1];
g_Chose[id] = false;
LoadColor(id);
}
public client_disconnect(id)
{
SaveColor(id);
remove_task(id);
}
public event_infect(victim, attacker)
{
if (!g_Chose[victim])
ShowMenu(victim);
if (get_pcvar_num(cvar_autonvg))
{
g_nvisionenabled[victim] = true;
remove_task(victim);
set_task(0.1, "set_user_nvision", victim, _, _, "b");
}
g_nvision[victim] = true;
}
public message_NVGToggle()
{
return PLUGIN_HANDLED;
}
public clcmd_nvg(id)
{
ShowMenu(id);
return PLUGIN_HANDLED;
}
public clcmd_nightvision(id)
{
if (g_nvision[id] || fm_get_user_nvg(id))
{
g_nvisionenabled[id] = !(g_nvisionenabled[id]);
remove_task(id);
if (g_nvisionenabled[id])
set_task(0.1, "set_user_nvision", id, _, _, "b");
}
return PLUGIN_HANDLED;
}
ShowMenu(id)
{
static iMenu, szMenu[64], i, Buffer[2];
formatex(szMenu, charsmax(szMenu), "%L", id, "NVG_MENUTITLE");
iMenu = menu_create(szMenu, "handler_nvg");
for (i = 0; i < sizeof(g_Colors); i++)
{
formatex(szMenu, charsmax(szMenu), "NVG_COLOR_%d", i + 1);
format(szMenu, charsmax(szMenu), "%L", id, szMenu);
Buffer[0] = i;
menu_additem(iMenu, szMenu, Buffer);
}
formatex(szMenu, charsmax(szMenu), "%L", id, "NVG_MENUBACK");
menu_setprop(iMenu, MPROP_BACKNAME, szMenu);
formatex(szMenu, charsmax(szMenu), "%L", id, "NVG_MENUNEXT");
menu_setprop(iMenu, MPROP_NEXTNAME, szMenu);
formatex(szMenu, charsmax(szMenu), "%L", id, "NVG_MENUEXIT");
menu_setprop(iMenu, MPROP_EXIT, szMenu);
menu_display(id, iMenu);
}
public handler_nvg(id, iMenu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(iMenu);
return PLUGIN_HANDLED;
}
static Buffer[2], temp, itemid;
menu_item_getinfo(iMenu, item, temp, Buffer, charsmax(Buffer), _, _, temp);
itemid = Buffer[0];
g_UserColor[id] = g_Colors[itemid];
g_Chose[id] = true;
menu_destroy(iMenu);
return PLUGIN_HANDLED;
}
SaveColor(id)
{
if (!g_Chose[id])
return;
if (db_name[id][0] && !equal(g_playername[id], db_name[id]))
{
if (db_slot_i >= sizeof(db_name))
db_slot_i = g_maxplayers + 1;
copy(db_name[db_slot_i], charsmax(db_name[]), db_name[id]);
db_user_nvg_color[db_slot_i] = db_user_nvg_color[id];
db_chose[db_slot_i] = g_Chose[id];
db_slot_i++;
}
copy(db_name[id], charsmax(db_name[]), g_playername[id]);
db_user_nvg_color[id] = g_UserColor[id];
db_chose[id] = g_Chose[id];
}
LoadColor(id)
{
static i;
for (i = 0; i < sizeof(db_name); i++)
{
if (equal(g_playername[id], db_name[i]))
{
g_Chose[id] = db_chose[i];
if (g_Chose[id])
g_UserColor[id] = db_user_nvg_color[i];
return;
}
}
}
public spec_nvision(id)
{
if (!is_user_connected(id) || is_user_alive(id))
return;
g_nvision[id] = true;
g_nvisionenabled[id] = true;
remove_task(id);
set_task(0.1, "set_user_nvision", id, _, _, "b");
}
public set_user_nvision(id)
{
static origin[3];
get_user_origin(id, origin);
message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, id);
write_byte(TE_DLIGHT);
write_coord(origin[0]);
write_coord(origin[1]);
write_coord(origin[2]);
write_byte(get_pcvar_num(cvar_radius));
write_byte(g_UserColor[id][0]);
write_byte(g_UserColor[id][1]);
write_byte(g_UserColor[id][2]);
write_byte(2);
write_byte(0);
message_end();
}
stock fm_cs_get_user_team(id)
{
return get_pdata_int(id, OFFSET_TEAM);
}
stock fm_get_user_nvg(index)
{
return get_pdata_int(index, OFFSET_NVG);
}