I have a problem at pluginu hidenseek_main_ham player from my team to see how transparent that I can do to see normal player?
Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#define DONT_USE_HAMSANDWICH
#if !defined DONT_USE_HAMSANDWICH
#include <hamsandwich>
#endif
/* YAY! No <cstrike> <csx> <fun> or <engine>!! =D */
#define PLUGIN_NAME "HideNSeek"
#define PLUGIN_VERSION "2.3"
#define PLUGIN_AUTHOR "Exolent"
#pragma semicolon 1
/* CONVERT CSTRIKE TO FAKEMETA */
enum CsTeams
{
CS_TEAM_UNASSIGNED = 0,
CS_TEAM_T,
CS_TEAM_CT,
CS_TEAM_SPECTATOR
};
enum CsInternalModel
{
CS_DONTCHANGE = 0,
CS_CT_URBAN,
CS_T_TERROR,
CS_T_LEET,
CS_T_ARCTIC,
CS_CT_GSG9,
CS_CT_GIGN,
CS_CT_SAS,
CS_T_GUERILLA,
CS_CT_VIP,
CZ_T_MILITIA,
CZ_CT_SPETSNAZ
};
enum CsArmorType
{
CS_ARMOR_NONE = 0,
CS_ARMOR_KEVLAR,
CS_ARMOR_VESTHELM
};
#define OFFSET_CLIPAMMO 51
#define OFFSET_ARMORTYPE 112
#define OFFSET_TEAM 114
#define OFFSET_MONEY 115
#define OFFSET_INTERNALMODEL 126
#define OFFSET_AWP_AMMO 377
#define OFFSET_SCOUT_AMMO 378
#define OFFSET_PARA_AMMO 379
#define OFFSET_FAMAS_AMMO 380
#define OFFSET_M3_AMMO 381
#define OFFSET_USP_AMMO 382
#define OFFSET_FIVESEVEN_AMMO 383
#define OFFSET_DEAGLE_AMMO 384
#define OFFSET_P228_AMMO 385
#define OFFSET_GLOCK_AMMO 386
#define OFFSET_FLASHBANG_AMMO 387
#define OFFSET_HEGRENADE_AMMO 388
#define OFFSET_SMOKEGRENADE_AMMO 389
#define OFFSET_C4_AMMO 390
/* END OF CSTRIKE TO FAKEMETA CONVERSION */
#define HIDE_MONEY (1<<5)
new const CsTeams:HNS_TEAM_HIDER = CS_TEAM_T;
new const CsTeams:HNS_TEAM_SEEKER = CS_TEAM_CT;
new const CsInternalModel:HNS_MODEL_HIDER = CS_T_LEET;
new const CsInternalModel:HNS_MODEL_SEEKER = CS_CT_GIGN;
/* save memory */
new const g_sBlank[] = "";
new const g_sA[] = "a";
new const g_sB[] = "b";
new const g_sS[] = "s";
new const g_sKnifeModel_v[] = "models/v_knife.mdl";
new const g_sKnifeModel_w[] = "models/w_knife.mdl";
new const g_sModel[] = "model";
new const g_sLightsNormal[] = "m";
/* end of save memory globals */
new const g_sBuyCommands[][] =
{
"usp", "glock", "deagle", "p228", "elites",
"fn57", "m3", "xm1014", "mp5", "tmp", "p90",
"mac10", "ump45", "ak47", "galil", "famas",
"sg552", "m4a1", "aug", "scout", "awp", "g3sg1",
"sg550", "m249", "vest", "vesthelm", "flash",
"hegren", "sgren", "defuser", "nvgs", "shield",
"primammo", "secammo", "km45", "9x19mm", "nighthawk",
"228compact", "fiveseven", "12gauge", "autoshotgun",
"mp", "c90", "cv47", "defender", "clarion", "krieg552",
"bullpup", "magnum", "d3au1", "krieg550"
};
new const MAX_BUY_COMMANDS = sizeof(g_sBuyCommands);
new const g_sRemoveEntities[][] =
{
"func_bomb_target",
"info_bomb_target",
"hostage_entity",
"monster_scientist",
"func_hostage_rescue",
"info_hostage_rescue",
"info_vip_start",
"func_vip_safetyzone",
"func_escapezone",
"armoury_entity"
};
new const g_sAllModels[CsTeams][][] =
{
{"", "", "", ""},
{"terror", "arctic", "leet", "guerilla"},
{"gign", "gsg9", "sas", "urban"},
{"", "", "", ""}
};
new const g_sDefaultModels[CsTeams][] =
{
"",
"leet",
"gign",
""
};
new const g_sTeamInfo[CsTeams][] =
{
"UNASSIGNED",
"TERRORIST",
"CT",
"SPECTATOR"
};
new const g_sTeamNames[CsTeams][] =
{
"Spectator",
"Terrorist",
"Counter-Terrorist",
"Spectator"
};
enum (+= 1000)
{
TASK_ID_STRIPWEAPONS = 1000,
TASK_ID_GIVEWEAPONS,
TASK_ID_GIVEKNIFE,
TASK_ID_CHECKMODEL,
TASK_ID_HIDETIMER,
TASK_ID_SWAPTEAMS,
TASK_ID_SETLIGHTS,
TASK_ID_SHOWPLUGININFO
};
new const g_PlayerTasks[] =
{
TASK_ID_STRIPWEAPONS,
TASK_ID_GIVEWEAPONS,
TASK_ID_GIVEKNIFE,
TASK_ID_CHECKMODEL,
TASK_ID_SHOWPLUGININFO
};
new const MAX_PLAYER_TASKS = sizeof(g_PlayerTasks);
new bool:g_bConnected[33];
new bool:g_bAlive[33];
new bool:g_bFirstSpawn[33];
new CsTeams:g_Team[33];
new bool:g_bSolid[33];
new bool:g_bRestoreSolid[33];
new bool:g_bWeaponsGiven;
new g_sHelpMotd[43];
new g_sHelpText[2500];
new bool:g_bScrimOn;
new Float:g_fKillMsgDelay[33];
new g_RoundsLost;
new g_RoundsEnded;
new bool:g_bDisableSlash = true;
new g_HideTimer;
new g_OldMoney;
new g_sLights[16];
#if defined DONT_USE_HAMSANDWICH
new bool:g_bNonSpawnEvent[33];
new g_FwdClientCommand_post;
#endif
new hns_pluginon;
new hns_footsteps;
new hns_money;
new hns_nubslash;
new hns_disablebuy;
new hns_hiders_knife;
new hns_grenades[CsTeams];
new hns_grenades_percent[CsTeams];
new hns_flashbangs[CsTeams];
new hns_flashbangs_percent[CsTeams];
new hns_smokegren[CsTeams];
new hns_smokegren_percent[CsTeams];
new hns_armor[CsTeams];
new hns_hidetime;
new hns_timersounds;
new hns_noslowdown;
new hns_teamchange;
new hns_disablekill;
new hns_blindcolors;
new hns_hudcolors;
new hns_hiders_alivefrags;
new hns_lights;
new hns_visiblecommands;
new hns_chooseteam;
new hns_semiclip;
new hns_gametype;
new sv_restart;
new g_msgSayText;
new g_msgHideWeapon;
new g_msgScreenFade;
new g_msgTeamInfo;
new g_msgMoney;
new g_msgArmorType;
new g_MaxPlayers;
new g_MaxEntities;
new g_HostageEnt;
new g_allocPlayerWeaponstrip;
public plugin_precache()
{
register_forward(FM_Spawn, "fwdSpawn", 0);
new allocHostageEntity = engfunc(EngFunc_AllocString, "hostage_entity");
do
{
g_HostageEnt = engfunc(EngFunc_CreateNamedEntity, allocHostageEntity);
}
while( !pev_valid(g_HostageEnt) );
engfunc(EngFunc_SetOrigin, g_HostageEnt, Float:{0.0, 0.0, -55000.0});
engfunc(EngFunc_SetSize, g_HostageEnt, Float:{-1.0, -1.0, -1.0}, Float:{1.0, 1.0, 1.0});
dllfunc(DLLFunc_Spawn, g_HostageEnt);
return PLUGIN_CONTINUE;
}
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
register_cvar(PLUGIN_NAME, PLUGIN_VERSION, FCVAR_SERVER|FCVAR_SPONLY, 0.0);
new sBuyHandle[] = "clcmdBuy";
register_clcmd("buy", sBuyHandle, -1, g_sBlank);
register_clcmd("buyammo1", sBuyHandle, -1, g_sBlank);
register_clcmd("buyammo2", sBuyHandle, -1, g_sBlank);
register_clcmd("buyequip", sBuyHandle, -1, g_sBlank);
register_clcmd("cl_autobuy", sBuyHandle, -1, g_sBlank);
register_clcmd("cl_rebuy", sBuyHandle, -1, g_sBlank);
register_clcmd("cl_setautobuy", sBuyHandle, -1, g_sBlank);
register_clcmd("cl_setrebuy", sBuyHandle, -1, g_sBlank);
register_concmd("hns_status", "concmdHnsStatus", ADMIN_KICK, "<0|1> -- turns [on/off] hns plugin");
register_srvcmd("set_scrim_status", "srvcmdScrimStatus", -1, ""); // this will be used for the scrim mod addon
register_clcmd("say /hnshelp", "clcmdHelp", -1, "");
register_clcmd("say .hnshelp", "clcmdHelp", -1, "");
register_clcmd("say_team /hnshelp", "clcmdHelp", -1, "");
register_clcmd("say_team .hnshelp", "clcmdHelp", -1, "");
register_forward(FM_CmdStart, "fwdCmdStart", 0);
register_forward(FM_SetModel, "fwdSetModel", 0);
register_forward(FM_ClientKill, "fwdClientKill", 0);
register_forward(FM_PlayerPreThink, "fwdPlayerPreThink", 0);
register_forward(FM_PlayerPostThink, "fwdPlayerPostThink", 0);
register_forward(FM_AddToFullPack, "fwdAddToFullPackPost", 1);
register_forward(FM_GetGameDescription, "fwdGetGameDescription", 0);
#if !defined DONT_USE_HAMSANDWICH
RegisterHam(Ham_Spawn, "player", "fwdPlayerSpawn", 1);
#else
register_event("TextMsg", "eventRestartAttempt", g_sA, "2&#Game_w");
register_clcmd("fullupdate", "clcmdFullupdate", -1, "");
#endif
new sHnsPluginOn[] = "hns_pluginon";
hns_pluginon = get_cvar_pointer(sHnsPluginOn);
if( !hns_pluginon )
{
hns_pluginon = register_cvar(sHnsPluginOn, "1", FCVAR_SPONLY, 0.0);
}
hns_footsteps = register_cvar("hns_footsteps", "1", 0, 0.0);
hns_money = register_cvar("hns_money", "0", 0, 0.0);
hns_nubslash = register_cvar("hns_nubslash", "3", 0, 0.0);
hns_disablebuy = register_cvar("hns_disablebuy", "1", 0, 0.0);
hns_hiders_knife = register_cvar("hns_hiders_knife", "1", 0, 0.0);
hns_grenades[HNS_TEAM_HIDER] = register_cvar("hns_hiders_grenades", "1", 0, 0.0);
hns_grenades_percent[HNS_TEAM_HIDER] = register_cvar("hns_hiders_grenades_percent", "100", 0, 0.0);
hns_flashbangs[HNS_TEAM_HIDER] = register_cvar("hns_hiders_flashbangs", "2", 0, 0.0);
hns_flashbangs_percent[HNS_TEAM_HIDER] = register_cvar("hns_hiders_flashbangs_percent", "100", 0, 0.0);
hns_smokegren[HNS_TEAM_HIDER] = register_cvar("hns_hiders_smokegren", "1", 0, 0.0);
hns_smokegren_percent[HNS_TEAM_HIDER] = register_cvar("hns_hiders_smokegren_percent", "100", 0, 0.0);
hns_armor[HNS_TEAM_HIDER] = register_cvar("hns_hiders_armor", "100", 0, 0.0);
hns_grenades[HNS_TEAM_SEEKER] = register_cvar("hns_seekers_grenades", "0", 0, 0.0);
hns_grenades_percent[HNS_TEAM_SEEKER] = register_cvar("hns_seekers_grenades_percent", "0", 0, 0.0);
hns_flashbangs[HNS_TEAM_SEEKER] = register_cvar("hns_seekers_flashbangs", "0", 0, 0.0);
hns_flashbangs_percent[HNS_TEAM_SEEKER] = register_cvar("hns_seekers_flashbangs_percent", "0", 0, 0.0);
hns_smokegren[HNS_TEAM_SEEKER] = register_cvar("hns_seekers_smokegren", "0", 0, 0.0);
hns_smokegren_percent[HNS_TEAM_SEEKER] = register_cvar("hns_seekers_smokegren_percent", "0", 0, 0.0);
hns_armor[HNS_TEAM_SEEKER] = register_cvar("hns_seekers_armor", "100", 0, 0.0);
hns_hidetime = register_cvar("hns_hidetime", "10", 0, 0.0);
hns_timersounds = register_cvar("hns_timersounds", "1", 0, 0.0);
hns_noslowdown = register_cvar("hns_noslowdown", "0", 0, 0.0);
hns_teamchange = register_cvar("hns_teamchange", "0", 0, 0.0);
hns_disablekill = register_cvar("hns_disablekill", "1", 0, 0.0);
hns_blindcolors = register_cvar("hns_blindcolors", "0 0 0 255", 0, 0.0);
hns_hudcolors = register_cvar("hns_hudcolors", "0 255 0", 0, 0.0);
hns_hiders_alivefrags = register_cvar("hns_hiders_alivefrags", "1", 0, 0.0);
hns_lights = register_cvar("hns_lights", g_sLightsNormal, 0, 0.0);
hns_visiblecommands = register_cvar("hns_visiblecommands", "0", 0, 0.0);
hns_chooseteam = register_cvar("hns_chooseteam", "0", 0, 0.0);
hns_semiclip = register_cvar("hns_semiclip", "1", 0, 0.0);
new sHideNSeek[32];
formatex(sHideNSeek, 31, "HideNSeek v%s", PLUGIN_VERSION);
hns_gametype = register_cvar("hns_gametype", sHideNSeek, 0, 0.0);
sv_restart = get_cvar_pointer("sv_restart");
g_msgSayText = get_user_msgid("SayText");
g_msgHideWeapon = get_user_msgid("HideWeapon");
g_msgScreenFade = get_user_msgid("ScreenFade");
g_msgTeamInfo = get_user_msgid("TeamInfo");
g_msgMoney = get_user_msgid("Money");
g_msgArmorType = get_user_msgid("ArmorType");
register_message(g_msgHideWeapon, "messageHideWeapon");
register_event("ResetHUD", "eventResetHUD", g_sB);
register_event("Money", "eventMoney", g_sB);
register_event("HLTV", "eventNewRound", g_sA, "1=0", "2=0");
register_event("SendAudio", "eventTerrWin", g_sA, "2=%!MRAD_terwin");
register_event("TextMsg", "eventRestartRound", g_sA, "2&#Game_C", "2&#Game_w");
register_event("CurWeapon", "eventCurWeapon", g_sB, "1=1");
register_event("DeathMsg", "eventDeathMsg", g_sA, "2!0");
register_logevent("logeventRoundStart", 2, "1=Round_Start");
register_logevent("logeventRoundEnd", 2, "1=Round_End");
g_MaxPlayers = global_get(glb_maxClients);
g_MaxEntities = global_get(glb_maxEntities);
g_allocPlayerWeaponstrip = engfunc(EngFunc_AllocString, "player_weaponstrip");
copy(g_sLights, 15, g_sLightsNormal);
set_task(1.0, "taskSetLights", TASK_ID_SETLIGHTS, g_sBlank, 0, g_sB, 0);
get_configsdir(g_sHelpMotd, 42);
add(g_sHelpMotd, 42, "/hidenseek_help.txt", 0);
new f = fopen(g_sHelpMotd, "r");
new sData[512];
while( !feof(f) )
{
fgets(f, sData, 511);
add(g_sHelpText, 2499, sData, 0);
}
fclose(f);
return PLUGIN_CONTINUE;
}
public client_putinserver(plr)
{
g_bConnected[plr] = true;
g_bAlive[plr] = false;
g_bFirstSpawn[plr] = false;
return PLUGIN_CONTINUE;
}
public client_disconnect(plr)
{
g_bConnected[plr] = false;
for( new i = 0, task; i < MAX_PLAYER_TASKS; i++ )
{
task = g_PlayerTasks[i];
if( task_exists(plr + task, 0) )
{
remove_task(plr + task, 0);
}
}
return PLUGIN_CONTINUE;
}
public client_command(plr)
{
if( !get_pcvar_num(hns_pluginon) || !get_pcvar_num(hns_disablebuy) )
{
return PLUGIN_CONTINUE;
}
new sArg[13];
if( read_argv(0, sArg, 12) > 11 )
{
return PLUGIN_CONTINUE;
}
if( equali(sArg, "chooseteam") && (CS_TEAM_UNASSIGNED < cs_get_user_team(plr) < CS_TEAM_SPECTATOR) )
{
new CsTeams:team = cs_get_user_team(plr);
return (team != HNS_TEAM_HIDER && team != HNS_TEAM_SEEKER || get_pcvar_num(hns_chooseteam)) ? PLUGIN_CONTINUE : PLUGIN_HANDLED;
}
for( new i = 0; i < MAX_BUY_COMMANDS; i++ )
{
if( equali(g_sBuyCommands[i], sArg, 0) )
{
return PLUGIN_HANDLED;
}
}
return PLUGIN_CONTINUE;
}
public clcmdBuy(plr)
{
return (get_pcvar_num(hns_pluginon) && get_pcvar_num(hns_disablebuy)) ? PLUGIN_HANDLED : PLUGIN_CONTINUE;
}
#if defined DONT_USE_HAMSANDWICH
public clcmdFullupdate(plr)
{
g_bNonSpawnEvent[plr] = true;
g_FwdClientCommand_post = register_forward(FM_ClientCommand, "fwdClientCommandPost", 1);
return PLUGIN_CONTINUE;
}
#endif
public concmdHnsStatus(plr, level, cid)
{
if( !cmd_access(plr, level, cid, 2) )
{
return PLUGIN_HANDLED;
}
new sArg[16];
read_argv(1, sArg, 15);
new num = clamp(str_to_num(sArg), 0, 1);
new status = clamp(get_pcvar_num(hns_pluginon), 0, 1);
if( num == status )
{
console_print(plr, "[LaLeaGane] HideNSeek is already o%s!", status ? "n" : "ff");
return PLUGIN_HANDLED;
}
set_pcvar_num(hns_pluginon, num);
set_pcvar_num(sv_restart, 1);
new sName[64]; /* server hostnames can be longer than player names */
get_user_name(plr, sName, 63);
hns_print(0, "^x03%s :^x01 st%sed HideNSeek!", sName, num ? "art" : "opp");
return PLUGIN_HANDLED;
}
public srvcmdScrimStatus()
{
new sArg[4];
read_argv(1, sArg, 3);
g_bScrimOn = bool:str_to_num(sArg);
return PLUGIN_HANDLED;
}
public clcmdHelp(plr)
{
if( get_pcvar_num(hns_pluginon) )
{
if( file_exists(g_sHelpMotd) )
{
new sText[2500];
new sTeamChange[64];
copy(sTeamChange, 63, "The teams will switch ");
new info = get_pcvar_num(hns_teamchange);
if( info > 0 )
{
format(sTeamChange, 63, "%safter %i rounds have ended", sTeamChange, info);
}
else
{
add(sTeamChange, 63, "when Seekers win the round");
}
new sHiderEquipment[512];
if( get_pcvar_num(hns_hiders_knife) == 2 )
{
copy(sHiderEquipment, 511, "Broken knife<br>");
}
info = get_pcvar_num(hns_grenades[HNS_TEAM_HIDER]);
new percent = get_pcvar_num(hns_grenades_percent[HNS_TEAM_HIDER]);
if( info > 0 && percent > 0 )
{
format(sHiderEquipment, 511, "%s%i HE Grenade%s", sHiderEquipment, info, info == 1 ? g_sBlank : g_sS);
if( percent < 100 )
{
format(sHiderEquipment, 511, "%s (%i%% chance per grenade)<br>", sHiderEquipment, percent);
}
else
{
add(sHiderEquipment, 511, "<br>", 0);
}
}
info = get_pcvar_num(hns_flashbangs[HNS_TEAM_HIDER]);
percent = get_pcvar_num(hns_flashbangs_percent[HNS_TEAM_HIDER]);
if( info > 0 && percent > 0 )
{
format(sHiderEquipment, 511, "%s%i Flashbang%s", sHiderEquipment, info, info == 1 ? g_sBlank : g_sS);
if( percent < 100 )
{
format(sHiderEquipment, 511, "%s (%i%% chance per flashbang)<br>", sHiderEquipment, percent);
}
else
{
add(sHiderEquipment, 511, "<br>", 0);
}
}
info = get_pcvar_num(hns_smokegren[HNS_TEAM_HIDER]);
percent = get_pcvar_num(hns_smokegren_percent[HNS_TEAM_HIDER]);
if( info > 0 && percent > 0 )
{
format(sHiderEquipment, 511, "%s%i Smoke Grenade%s", sHiderEquipment, info, info == 1 ? g_sBlank : g_sS);
if( percent < 100 )
{
format(sHiderEquipment, 511, "%s (%i%% chance per smoke grenade)<br>", sHiderEquipment, percent);
}
else
{
add(sHiderEquipment, 511, "<br>", 0);
}
}
info = get_pcvar_num(hns_armor[HNS_TEAM_HIDER]);
format(sHiderEquipment, 511, "%sArmor: %i", sHiderEquipment, info);
new sSeekerEquipment[512];
copy(sSeekerEquipment, 511, "A Knife");
info = get_pcvar_num(hns_grenades[HNS_TEAM_SEEKER]);
percent = get_pcvar_num(hns_grenades_percent[HNS_TEAM_SEEKER]);
if( info > 0 && percent > 0 )
{
format(sSeekerEquipment, 511, "%s<br>%i HE Grenade%s", sSeekerEquipment, info, info == 1 ? g_sBlank : g_sS);
if( percent < 100 )
{
format(sSeekerEquipment, 511, "%s (%i%% chance per grenade)", sSeekerEquipment, percent);
}
}
info = get_pcvar_num(hns_flashbangs[HNS_TEAM_SEEKER]);
percent = get_pcvar_num(hns_flashbangs_percent[HNS_TEAM_SEEKER]);
if( info > 0 && percent > 0 )
{
format(sSeekerEquipment, 511, "%s<br>%i Flashbang%s", sSeekerEquipment, info, info == 1 ? g_sBlank : g_sS);
if( percent < 100 )
{
format(sSeekerEquipment, 511, "%s (%i%% chance per flashbang)", sSeekerEquipment, percent);
}
}
info = get_pcvar_num(hns_smokegren[HNS_TEAM_SEEKER]);
percent = get_pcvar_num(hns_smokegren_percent[HNS_TEAM_SEEKER]);
if( info > 0 && percent > 0 )
{
format(sSeekerEquipment, 511, "%s<br>%i Smoke Grenade%s", sSeekerEquipment, info, info == 1 ? g_sBlank : g_sS);
if( percent < 100 )
{
format(sSeekerEquipment, 511, "%s (%i%% chance per smoke grenade)", sSeekerEquipment, percent);
}
}
info = get_pcvar_num(hns_armor[HNS_TEAM_SEEKER]);
format(sSeekerEquipment, 511, "%s<br>Armor: %i", sSeekerEquipment, info);
formatex(sText, 2499, g_sHelpText, PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR, PLUGIN_NAME, g_sTeamNames[HNS_TEAM_HIDER], g_sTeamNames[HNS_TEAM_SEEKER], sTeamChange, sHiderEquipment, sSeekerEquipment);
show_motd(plr, sText, "HideNSeek Help");
}
else
{
hns_print(plr, "^x03HideNSeek Help^x01 does not exist for this server.");
}
}
return get_pcvar_num(hns_visiblecommands) ? PLUGIN_CONTINUE : PLUGIN_HANDLED;
}
#if defined DONT_USE_HAMSANDWICH
public fwdClientCommandPost(plr)
{
unregister_forward(FM_ClientCommand, g_FwdClientCommand_post, 1);
g_bNonSpawnEvent[plr] = false;
return FMRES_HANDLED;
}
#endif
public fwdSpawn(ent)
{
if( !pev_valid(ent) || ent == g_HostageEnt )
{
return FMRES_IGNORED;
}
new sClass[32];
pev(ent, pev_classname, sClass, 31);
static const total = sizeof(g_sRemoveEntities);
for( new i = 0; i < total; i++ )
{
if( equal(sClass, g_sRemoveEntities[i]) )
{
engfunc(EngFunc_RemoveEntity, ent);
return FMRES_SUPERCEDE;
}
}
return FMRES_IGNORED;
}
public fwdCmdStart(plr, ucHandle, seed)
{
if( !get_pcvar_num(hns_pluginon) )
{
return FMRES_IGNORED;
}
if( g_bAlive[plr] )
{
#if AMXX_VERSION_NUM < 180
static clip, ammo;
new weapon = get_user_weapon(plr, clip, ammo);
#else
new weapon = get_user_weapon(plr);
#endif
if( weapon != CSW_KNIFE )
{
return FMRES_IGNORED;
}
new CsTeams:team = cs_get_user_team(plr);
if( team == HNS_TEAM_SEEKER && g_bDisableSlash )
{
new button = get_uc(ucHandle, UC_Buttons);
if( button&IN_ATTACK )
{
button &= ~IN_ATTACK;
button |= IN_ATTACK2;
}
set_uc(ucHandle, UC_Buttons, button);
return FMRES_SUPERCEDE;
}
if( team == HNS_TEAM_HIDER )
{
new button = get_uc(ucHandle, UC_Buttons);
if( button&IN_ATTACK )
{
button &= ~IN_ATTACK;
}
if( button&IN_ATTACK2 )
{
button &= ~IN_ATTACK2;
}
set_uc(ucHandle, UC_Buttons, button);
return FMRES_SUPERCEDE;
}
}
return FMRES_IGNORED;
}
public fwdSetModel(ent, sModel[])
{
if( !get_pcvar_num(hns_pluginon) )
{
return FMRES_IGNORED;
}
if( !pev_valid(ent) || !equal(sModel, "models/w_", 9) || equal(sModel, "models/w_weaponbox.mdl", 0) )
{
return FMRES_IGNORED;
}
new owner = pev(ent, pev_owner);
if( !(0 < owner <= g_MaxPlayers) )
{
return FMRES_IGNORED;
}
new sClass[32];
pev(ent, pev_classname, sClass, 31);
if( equal(sClass, "weapon_shield", 0) )
{
set_pev(ent, pev_effects, EF_NODRAW);
set_task(0.1, "taskRemoveShield", ent);
return FMRES_IGNORED;
}
if( !equal(sClass, "weaponbox", 0) )
{
return FMRES_IGNORED;
}
for( new i = g_MaxPlayers + 1; i <= g_MaxEntities; i++ )
{
if( !pev_valid(i) )
{
continue;
}
if( pev(i, pev_owner) == ent )
{
dllfunc(DLLFunc_Think, ent);
break;
}
}
return FMRES_IGNORED;
}
public fwdClientKill(plr)
{
if( !get_pcvar_num(hns_pluginon) )
{
return FMRES_IGNORED;
}
if( get_pcvar_num(hns_disablekill) )
{
new Float:fGametime = get_gametime();
if( fGametime >= g_fKillMsgDelay[plr] )
{
g_fKillMsgDelay[plr] = fGametime + 1.0;
hns_print(plr, "You cannot kill yourself during HideNSeek!");
}
return FMRES_SUPERCEDE;
}
return FMRES_IGNORED;
}
public fwdPlayerPreThink(plr)
{
if( !get_pcvar_num(hns_pluginon) )
{
return FMRES_IGNORED;
}
if( g_bAlive[plr] )
{
new CsTeams:team = cs_get_user_team(plr);
if( g_HideTimer > 0 && team == HNS_TEAM_SEEKER )
{
set_pev(plr, pev_maxspeed, -1.0);
}
new footsteps = get_pcvar_num(hns_footsteps);
if( footsteps && (footsteps == 3 || footsteps == _:team) )
{
set_pev(plr, pev_flTimeStepSound, 999);
}
if( get_pcvar_num(hns_noslowdown) )
{
set_pev(plr, pev_fuser2, 0.0);
}
}
static LastThink, i;
if( plr < LastThink ) // player think loop started again
{
for( i = 1; i <= g_MaxPlayers; i++ )
{
if( !g_bConnected[i] || !g_bAlive[i] )
{
g_bSolid[i] = false;
continue;
}
g_Team[i] = cs_get_user_team(i);
g_bSolid[i] = bool:(pev(i, pev_solid) == SOLID_SLIDEBOX);
}
}
LastThink = plr;
if( !g_bSolid[plr] )
{
return FMRES_IGNORED;
}
new semiclip = get_pcvar_num(hns_semiclip);
if( !semiclip )
{
return FMRES_IGNORED;
}
for( i = 1; i <= g_MaxPlayers; i++ )
{
if( !g_bSolid[i] || g_bRestoreSolid[i] || i == plr )
{
continue;
}
if( semiclip == 2 || g_Team[plr] == g_Team[i] )
{
set_pev(i, pev_solid, SOLID_NOT);
g_bRestoreSolid[i] = true;
}
}
return FMRES_IGNORED;
}
public fwdPlayerPostThink(plr)
{
static i;
for( i = 1; i <= g_MaxPlayers; i++ )
{
if( g_bRestoreSolid[i] )
{
set_pev(i, pev_solid, SOLID_SLIDEBOX);
g_bRestoreSolid[i] = false;
}
}
return FMRES_IGNORED;
}
public fwdAddToFullPackPost(es, e, ent, host, hostflags, player, pSet)
{
if( !get_pcvar_num(hns_pluginon) )
{
return FMRES_IGNORED;
}
if( player )
{
if( g_bSolid[host] && g_bSolid[ent] )
{
new semiclip = get_pcvar_num(hns_semiclip);
if( semiclip == 2 || g_Team[host] == g_Team[ent] )
{
set_es(es, ES_Solid, SOLID_NOT);
set_es(es, ES_RenderMode, kRenderTransAlpha);
set_es(es, ES_RenderAmt, 127);
}
}
}
return FMRES_IGNORED;
}
public fwdGetGameDescription()
{
if( !get_pcvar_num(hns_pluginon) )
{
return FMRES_IGNORED;
}
new sGameType[32];
get_pcvar_string(hns_gametype, sGameType, 31);
if( !strlen(sGameType) )
{
formatex(sGameType, 31, "HideNSeek v%s", PLUGIN_VERSION);
}
forward_return(FMV_STRING, sGameType);
return FMRES_SUPERCEDE;
}
public fwdPlayerSpawn(plr)
{
if( is_user_alive(plr) )
{
g_bAlive[plr] = true;
if( get_pcvar_num(hns_pluginon) )
{
new CsTeams:team = cs_get_user_team(plr);
if( team != HNS_TEAM_SEEKER && team != HNS_TEAM_HIDER )
{
new usp = give_item(plr, "weapon_usp");
cs_set_user_bpammo(plr, CSW_USP, 0);
cs_set_weapon_ammo(usp, 0);
give_item(plr, "weapon_knife");
#if defined DONT_USE_HAMSANDWICH
return PLUGIN_CONTINUE;
#else
return HAM_IGNORED;
#endif
}
if( !g_bFirstSpawn[plr] )
{
show_plugin_info(plr);
set_task(360.0, "taskShowPluginInfo", TASK_ID_SHOWPLUGININFO + plr, g_sBlank, 0, g_sB, 0);
g_bFirstSpawn[plr] = true;
}
set_task(0.3, "taskStripWeapons", plr + TASK_ID_STRIPWEAPONS, g_sBlank, 0, g_sBlank, 0);
new param[2];
param[0] = _:team;
set_task(0.6, "taskGiveKnife", plr + TASK_ID_GIVEKNIFE, param, 2, g_sBlank, 0);
set_task(0.9, "taskCheckModel", plr + TASK_ID_CHECKMODEL, param, 2, g_sBlank, 0);
if( g_bWeaponsGiven )
{
set_task(0.6, "taskGiveWeapons", plr + TASK_ID_GIVEWEAPONS, param, 2, g_sBlank, 0);
}
}
}
#if defined DONT_USE_HAMSANDWICH
return PLUGIN_CONTINUE;
#else
return HAM_IGNORED;
#endif
}
public messageHideWeapon(msgid, dest, plr)
{
if( !get_pcvar_num(hns_pluginon) )
{
return PLUGIN_CONTINUE;
}
if( get_pcvar_num(hns_money) == 0 )
{
set_msg_arg_int(1, ARG_BYTE, get_msg_arg_int(1)|HIDE_MONEY);
}
return PLUGIN_CONTINUE;
}
#if defined DONT_USE_HAMSANDWICH
public eventRestartAttempt()
{
new players[32], pnum;
get_players(players, pnum, g_sA);
for( new i = 0; i < pnum; i++ )
{
g_bNonSpawnEvent[players[i]] = true;
}
return PLUGIN_CONTINUE;
}
#endif
public eventResetHUD(plr)
{
if( get_pcvar_num(hns_pluginon) && get_pcvar_num(hns_money) == 0 )
{
make_HideWeapon(plr, HIDE_MONEY);
}
#if defined DONT_USE_HAMSANDWICH
if( is_user_alive(plr) )
{
if( g_bNonSpawnEvent[plr] )
{
g_bNonSpawnEvent[plr] = false;
}
else
{
fwdPlayerSpawn(plr);
}
}
#endif
return PLUGIN_CONTINUE;
}
public eventMoney(plr)
{
if( !get_pcvar_num(hns_pluginon) )
{
return PLUGIN_CONTINUE;
}
new money = get_pcvar_num(hns_money);
money = clamp(money, 0, 16000);
cs_set_user_money(plr, money, 0);
if( money == 0 && g_OldMoney != 0 )
{
make_HideWeapon(plr, HIDE_MONEY);
}
g_OldMoney = money;
return PLUGIN_HANDLED;
}
public eventNewRound()
{
if( !get_pcvar_num(hns_pluginon) )
{
return PLUGIN_CONTINUE;
}
if( g_bDisableSlash )
{
new rounds = get_pcvar_num(hns_nubslash);
if( rounds > 0 && g_RoundsLost >= rounds )
{
hns_print(0, "Echipa^x03 CT ^x01 are voie^x03 CLICK 1 ^x01 pentru ca au pierdut %i runde%!",\
rounds, (rounds == 1) ? g_sBlank : "");
g_bDisableSlash = false;
}
}
return PLUGIN_CONTINUE;
}
public eventTerrWin()
{
if( g_bDisableSlash )
{
g_RoundsLost++;
}
return PLUGIN_CONTINUE;
}
public eventRestartRound()
{
g_RoundsLost = 0;
g_RoundsEnded = 0;
g_bDisableSlash = true;
g_bWeaponsGiven = false;
g_HideTimer = -1;
return PLUGIN_CONTINUE;
}
public eventCurWeapon(plr)
{
if( !get_pcvar_num(hns_pluginon) )
{
return PLUGIN_CONTINUE;
}
new CsTeams:team = cs_get_user_team(plr);
if( team == HNS_TEAM_SEEKER )
{
if( g_HideTimer > 0 )
{
set_pev(plr, pev_maxspeed, -1.0);
}
}
else if( team == HNS_TEAM_HIDER && get_pcvar_num(hns_hiders_knife) == 1 )
{
new sModel[32];
pev(plr, pev_viewmodel2, sModel, 31);
if( equali(sModel, g_sKnifeModel_v, 0) )
{
set_pev(plr, pev_viewmodel2, g_sBlank);
}
pev(plr, pev_weaponmodel2, sModel, 31);
if( equali(sModel, g_sKnifeModel_w, 0) )
{
set_pev(plr, pev_weaponmodel2, g_sBlank);
}
}
return PLUGIN_CONTINUE;
}
public eventDeathMsg()
{
g_bAlive[read_data(2)] = false;
return PLUGIN_CONTINUE;
}
public logeventRoundStart()
{
if( !get_pcvar_num(hns_pluginon) )
{
return PLUGIN_CONTINUE;
}
if( task_exists(TASK_ID_HIDETIMER, 0) )
{
remove_task(TASK_ID_HIDETIMER, 0);
}
g_HideTimer = get_pcvar_num(hns_hidetime);
set_task(0.0, "taskHideTimer", TASK_ID_HIDETIMER, g_sBlank, 0, g_sBlank, 0);
return PLUGIN_CONTINUE;
}
public logeventRoundEnd()
{
if( !get_pcvar_num(hns_pluginon) )
{
return PLUGIN_CONTINUE;
}
if( task_exists(TASK_ID_HIDETIMER, 0) )
{
remove_task(TASK_ID_HIDETIMER, 0);
}
new sMessage[192];
new CsTeams:winner = HNS_TEAM_SEEKER;
new bool:bHider, bool:bSeeker;
static CsTeams:team;
for( new plr = 1; plr <= g_MaxPlayers; plr++ )
{
if( !g_bConnected[plr] )
{
continue;
}
team = cs_get_user_team(plr);
if( team == HNS_TEAM_SEEKER )
{
bSeeker = true;
if( bHider && winner == HNS_TEAM_HIDER )
{
break;
}
}
else if( team == HNS_TEAM_HIDER )
{
bHider = true;
if( g_bAlive[plr] && winner == HNS_TEAM_SEEKER)
{
winner = HNS_TEAM_HIDER;
if( bSeeker )
{
break;
}
}
}
}
static const sTaskSwapTeams[] = "taskSwapTeams";
++g_RoundsEnded;
new teamchange = get_pcvar_num(hns_teamchange);
if( teamchange && teamchange == g_RoundsEnded && !g_bScrimOn )
{
hns_print(0, "%i rounds have ended. Switching teams.", g_RoundsEnded);
set_task(0.5, sTaskSwapTeams, TASK_ID_SWAPTEAMS, g_sBlank, 0, g_sBlank, 0);
}
static red, green, blue;
static const sNoTeamChange[] = "^nNo Team Change";
if( !bSeeker || !bHider )
{
copy(sMessage, 191, "Round Draw");
if( !teamchange )
{
add(sMessage, 191, sNoTeamChange, 0);
}
red = 0;
green = 255;
blue = 0;
}
else if( winner == HNS_TEAM_SEEKER )
{
copy(sMessage, 191, "Seekers Won Round");
if( !teamchange )
{
add(sMessage, 191, "^nSwitching Teams", 0);
set_task(0.5, sTaskSwapTeams, TASK_ID_SWAPTEAMS, g_sBlank, 0, g_sBlank, 0);
}
red = 0;
green = 127;
blue = 255;
}
else if( winner == HNS_TEAM_HIDER )
{
copy(sMessage, 191, "Hiders Won Round");
new frags = get_pcvar_num(hns_hiders_alivefrags);
static Float:fFrags;
for( new plr = 1; plr <= g_MaxPlayers; plr++ )
{
if( g_bConnected[plr] && g_bAlive[plr] && cs_get_user_team(plr) == HNS_TEAM_HIDER )
{
if( frags )
{
pev(plr, pev_frags, fFrags);
set_pev(plr, pev_frags, fFrags + float(frags));
hns_print(plr, "You earned %i frag%s for surviving the round!",\
frags, (frags == 1) ? g_sBlank : g_sS);
}
}
}
if( !teamchange )
{
add(sMessage, 191, sNoTeamChange, 0);
}
red = 255;
green = 0;
blue = 0;
}
set_hudmessage(red, green, blue, -1.0, -1.0, 0, 0.0, 5.0, 0.1, 0.2, 1);
show_hudmessage(0, "%s", sMessage);
g_bWeaponsGiven = false;
return PLUGIN_CONTINUE;
}
public taskRemoveShield(ent)
{
dllfunc(DLLFunc_Think, ent);
return PLUGIN_CONTINUE;
}
public taskHideTimer()
{
static const sTaskHideTimer[] = "taskHideTimer";
if( g_HideTimer > 0 )
{
static CsTeams:team;
new sounds = get_pcvar_num(hns_timersounds);
new sSound[16];
num_to_word(g_HideTimer, sSound, 15);
static blind_red, blind_green, blind_blue, blind_alpha;
get_blind_colors(blind_red, blind_green, blind_blue, blind_alpha);
static hud_red, hud_green, hud_blue;
get_hud_colors(hud_red, hud_green, hud_blue);
for( new plr = 1; plr <= g_MaxPlayers; plr++ )
{
if( !g_bConnected[plr] )
{
continue;
}
team = cs_get_user_team(plr);
if( team == HNS_TEAM_SEEKER || team == HNS_TEAM_HIDER )
{
if( team == HNS_TEAM_SEEKER && g_bAlive[plr] )
{
make_ScreenFade(plr, 1.5, 1.5, blind_red, blind_green, blind_blue, blind_alpha);
set_pev(plr, pev_maxspeed, -1.0);
}
set_hudmessage(hud_red, hud_green, hud_blue, -1.0, -1.0, 0, 0.0, 1.1, 0.1, 0.1, 1);
show_hudmessage(plr, "Fugari au %i secunde sa se ascunda!", g_HideTimer);
if( sounds )
{
client_cmd(plr, "spk vox/%s.wav", sSound);
}
}
}
g_HideTimer--;
set_task(1.0, sTaskHideTimer, TASK_ID_HIDETIMER, g_sBlank, 0, g_sBlank, 0);
}
else if( g_HideTimer == 0 )
{
static hud_red, hud_green, hud_blue;
get_hud_colors(hud_red, hud_green, hud_blue);
static CsTeams:team, param[2];
for( new plr = 1; plr <= g_MaxPlayers; plr++ )
{
if( !g_bConnected[plr] )
{
continue;
}
team = cs_get_user_team(plr);
if( team == HNS_TEAM_SEEKER || team == HNS_TEAM_HIDER )
{
if( team == HNS_TEAM_SEEKER && g_bAlive[plr] )
{
make_ScreenFade(plr, 0.0, 0.0, 0, 0, 0, 255);
cs_reset_user_maxspeed(plr);
}
set_hudmessage(hud_red, hud_green, hud_blue, -1.0, -1.0, 0, 0.0, 2.3, 0.1, 0.1, 1);
show_hudmessage(plr, "CINE NU E GATA IL IAU CU LOPATA!");
param[0] = _:team;
taskGiveWeapons(param, plr + TASK_ID_GIVEWEAPONS);
}
}
g_bWeaponsGiven = true;
g_HideTimer--;
set_task(1.0, sTaskHideTimer, TASK_ID_HIDETIMER, g_sBlank, 0, g_sBlank, 0);
}
else
{
for( new plr = 1; plr <= g_MaxPlayers; plr++ )
{
if( !g_bConnected[plr] )
{
continue;
}
if( cs_get_user_team(plr) == HNS_TEAM_SEEKER )
{
make_ScreenFade(plr, 0.0, 0.0, 0, 0, 0, 255);
cs_reset_user_maxspeed(plr);
}
}
}
return PLUGIN_CONTINUE;
}
public taskStripWeapons(plr)
{
plr -= TASK_ID_STRIPWEAPONS;
strip_user_weapons(plr);
return PLUGIN_CONTINUE;
}
public taskGiveKnife(param[], plr)
{
plr -= TASK_ID_GIVEKNIFE;
new CsTeams:team = CsTeams:param[0];
if( team == HNS_TEAM_SEEKER || get_pcvar_num(hns_hiders_knife))
{
give_item(plr, "weapon_knife");
}
return PLUGIN_CONTINUE;
}
public taskGiveWeapons(param[], plr)
{
plr -= TASK_ID_GIVEWEAPONS;
new CsTeams:team = CsTeams:param[0];
if( team != HNS_TEAM_HIDER && team != HNS_TEAM_SEEKER )
{
return PLUGIN_CONTINUE;
}
chance(plr, get_pcvar_num(hns_grenades[team]), get_pcvar_num(hns_grenades_percent[team]),"weapon_hegrenade", CSW_HEGRENADE, "HE Grenade");
chance(plr, get_pcvar_num(hns_flashbangs[team]), get_pcvar_num(hns_flashbangs_percent[team]), "weapon_flashbang", CSW_FLASHBANG, "Flashbang");
chance(plr, get_pcvar_num(hns_smokegren[team]), get_pcvar_num(hns_smokegren_percent[team]), "weapon_smokegrenade", CSW_SMOKEGRENADE, "Smoke Grenade");
new num = get_pcvar_num(hns_armor[team]);
num = clamp(num, 0, 100);
switch( num )
{
case 0:
{
cs_set_user_armor(plr, 0, CS_ARMOR_NONE);
}
case 1..99:
{
cs_set_user_armor(plr, num, CS_ARMOR_KEVLAR);
}
case 100:
{
cs_set_user_armor(plr, num, CS_ARMOR_VESTHELM);
}
}
return PLUGIN_CONTINUE;
}
public taskCheckModel(param[], plr)
{
plr -= TASK_ID_CHECKMODEL;
new CsTeams:team = CsTeams:param[0];
if( team == HNS_TEAM_SEEKER || team == HNS_TEAM_HIDER )
{
new CsTeams:otherteam = (team == HNS_TEAM_HIDER) ? HNS_TEAM_SEEKER : HNS_TEAM_HIDER;
new sModel[32];
cs_get_user_model(plr, sModel, 31);
for( new i = 0; i < 4; i++ )
{
if( equal(sModel, g_sAllModels[otherteam][i], 0) )
{
cs_set_user_model(plr, g_sDefaultModels[team]);
break;
}
}
}
return PLUGIN_CONTINUE;
}
public taskSwapTeams(taskid)
{
static CsTeams:team;
for( new plr = 1; plr <= g_MaxPlayers; plr++ )
{
if( !g_bConnected[plr] )
{
continue;
}
team = cs_get_user_team(plr);
if( team == HNS_TEAM_HIDER )
{
cs_set_user_team(plr, HNS_TEAM_SEEKER, HNS_MODEL_SEEKER);
emake_TeamInfo(plr, g_sTeamInfo[HNS_TEAM_SEEKER]); /* let other plugins know that the player changed teams */
}
else if( team == HNS_TEAM_SEEKER )
{
cs_set_user_team(plr, HNS_TEAM_HIDER, HNS_MODEL_HIDER);
emake_TeamInfo(plr, g_sTeamInfo[HNS_TEAM_HIDER]); /* let other plugins know that the player changed teams */
}
}
g_RoundsLost = 0;
g_RoundsEnded = 0;
g_bDisableSlash = true;
return 1;
}
public taskSetLights()
{
if( !get_pcvar_num(hns_pluginon) )
{
if( !equali(g_sLights, g_sLightsNormal) )
{
set_lights(g_sLightsNormal);
}
}
else
{
new sLights[16];
get_pcvar_string(hns_lights, sLights, 15);
if( !equali(g_sLights, sLights) )
{
if( !strlen(sLights) )
{
set_lights(g_sLightsNormal);
set_pcvar_string(hns_lights, g_sLightsNormal);
}
else
{
set_lights(sLights);
}
}
}
return PLUGIN_CONTINUE;
}
public taskShowPluginInfo(plr)
{
if( get_pcvar_num(hns_pluginon) )
{
show_plugin_info(plr - TASK_ID_SHOWPLUGININFO);
}
return PLUGIN_CONTINUE;
}
show_plugin_info(plr)
{
hns_print(plr, "Serveru ruleaza^x03 Hide-N-Seek ^x01 by^x03 Exolent", PLUGIN_VERSION);
return 1;
}
cs_reset_user_maxspeed(plr)
{
static Float:fMaxSpeed;
#if AMXX_VERSION_NUM < 180
static clip, ammo;
switch( get_user_weapon(plr, clip, ammo) )
#else
switch( get_user_weapon(plr) )
#endif
{
case CSW_SG550, CSW_AWP, CSW_G3SG1:
{
fMaxSpeed = 210.0;
}
case CSW_M249:
{
fMaxSpeed = 220.0;
}
case CSW_AK47:
{
fMaxSpeed = 221.0;
}
case CSW_M3, CSW_M4A1:
{
fMaxSpeed = 230.0;
}
case CSW_SG552:
{
fMaxSpeed = 235.0;
}
case CSW_XM1014, CSW_AUG, CSW_GALIL, CSW_FAMAS:
{
fMaxSpeed = 240.0;
}
case CSW_P90:
{
fMaxSpeed = 245.0;
}
case CSW_SCOUT:
{
fMaxSpeed = 260.0;
}
default:
{
fMaxSpeed = 250.0;
}
}
engfunc(EngFunc_SetClientMaxspeed, plr, fMaxSpeed);
set_pev(plr, pev_maxspeed, fMaxSpeed);
return 1;
}
chance(plr, maxcount, percent, sClass[], CSW_type=0, sName[]="")
{
if( !maxcount || !percent )
{
return 0;
}
new count;
for( new i = 0; i < maxcount; i++ )
{
if( random_num(1, 100) <= percent )
{
if( count == 0 )
{
give_item(plr, sClass);
}
count++;
}
}
if( count && CSW_type )
{
if( percent < 100 )
{
hns_print(plr, "You received %i %s%s! (%i%% chance)", count, sName, (count == 1) ? g_sBlank : g_sS, percent);
}
cs_set_user_bpammo(plr, CSW_type, count);
}
return 1;
}
get_blind_colors(&red, &green, &blue, &alpha)
{
new sColors[20];
get_pcvar_string(hns_blindcolors, sColors, 19);
static sRed[5], sGreen[5], sBlue[5], sAlpha[5];
parse(sColors, sRed, 4, sGreen, 4, sBlue, 4, sAlpha, 4);
red = clamp(str_to_num(sRed), 0, 255);
green = clamp(str_to_num(sGreen), 0, 255);
blue = clamp(str_to_num(sBlue), 0, 255);
alpha = clamp(str_to_num(sAlpha), 0, 255);
return 1;
}
get_hud_colors(&red, &green, &blue)
{
new sColors[20];
get_pcvar_string(hns_hudcolors, sColors, 19);
static sRed[5], sGreen[5], sBlue[5];
parse(sColors, sRed, 4, sGreen, 4, sBlue, 4);
red = clamp(str_to_num(sRed), 0, 255);
green = clamp(str_to_num(sGreen), 0, 255);
blue = clamp(str_to_num(sBlue), 0, 255);
return 1;
}
set_lights(const sLights[])
{
engfunc(EngFunc_LightStyle, 0, sLights);
copy(g_sLights, 16, sLights);
return 1;
}
make_HideWeapon(plr, flags)
{
static i; i = plr ? plr : get_player();
if( !i )
{
return 0;
}
message_begin(plr ? MSG_ONE : MSG_ALL, g_msgHideWeapon, {0, 0, 0}, plr);
write_byte(flags);
message_end();
return 1;
}
make_ScreenFade(plr, Float:fDuration, Float:fHoldtime, red, green, blue, alpha)
{
static i; i = plr ? plr : get_player();
if( !i )
{
return 0;
}
message_begin(plr ? MSG_ONE : MSG_ALL, g_msgScreenFade, {0, 0, 0}, plr);
write_short(floatround(4096.0 * fDuration, floatround_round));
write_short(floatround(4096.0 * fHoldtime, floatround_round));
write_short(4096);
write_byte(red);
write_byte(green);
write_byte(blue);
write_byte(alpha);
message_end();
return 1;
}
emake_TeamInfo(plr, sTeam[])
{
if( !plr )
{
return 0;
}
emessage_begin(MSG_ALL, g_msgTeamInfo, {0, 0, 0}, 0);
ewrite_byte(plr);
ewrite_string(sTeam);
emessage_end();
return 1;
}
make_TeamInfo(plr, sTeam[])
{
if( !plr )
{
return 0;
}
message_begin(MSG_ALL, g_msgTeamInfo, {0, 0, 0}, 0);
write_byte(plr);
write_string(sTeam);
message_end();
return 1;
}
make_Money(plr, money, flash)
{
if( !plr )
{
return 0;
}
message_begin(MSG_ONE, g_msgMoney, {0, 0, 0}, plr);
write_long(money);
write_byte(flash ? 1 : 0);
message_end();
return 1;
}
make_ArmorType(plr, helmet)
{
if( !plr )
{
return 0;
}
message_begin(MSG_ONE, g_msgArmorType, {0, 0, 0}, plr);
write_byte(helmet);
message_end();
return 1;
}
make_SayText(receiver, sender, sMessage[])
{
if( !sender )
{
return 0;
}
message_begin(receiver ? MSG_ONE : MSG_ALL, g_msgSayText, {0, 0, 0}, receiver);
write_byte(sender);
write_string(sMessage);
message_end();
return 1;
}
hns_print(plr, const sFormat[], any:...)
{
static i; i = plr ? plr : get_player();
if( !i )
{
return 0;
}
new sMessage[256];
new len = copy(sMessage, 255, "^x04[LaLeaGane]^x01 ");
vformat(sMessage[len], 255-len, sFormat, 3);
sMessage[192] = '^0';
make_SayText(plr, i, sMessage);
return 1;
}
get_player()
{
for( new plr = 1; plr <= g_MaxPlayers; plr++ )
{
if( g_bConnected[plr] )
{
return plr;
}
}
return 0;
}
/* fun -> fakemeta stocks */
give_item(plr, const sItem[])
{
if( !equal(sItem, "weapon_", 7) && !equal(sItem, "ammo_", 5) && !equal(sItem, "item_", 5) && !equal(sItem, "tf_weapon_", 10) )
{
return 0;
}
static ent;
ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, sItem));
if( !pev_valid(ent) )
{
return 0;
}
static Float:vOrigin[3];
pev(plr, pev_origin, vOrigin);
set_pev(ent, pev_origin, vOrigin);
set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags)|SF_NORESPAWN);
dllfunc(DLLFunc_Spawn, ent);
static solid;
solid = pev(ent, pev_solid);
dllfunc(DLLFunc_Touch, ent, plr);
if( pev(ent, pev_solid) != solid )
{
return ent;
}
engfunc(EngFunc_RemoveEntity, ent);
return -1;
}
strip_user_weapons(plr)
{
static ent;
ent = engfunc(EngFunc_CreateNamedEntity, g_allocPlayerWeaponstrip);
if( !pev_valid(ent) )
{
return 0;
}
dllfunc(DLLFunc_Spawn, ent);
dllfunc(DLLFunc_Use, ent, plr);
engfunc(EngFunc_RemoveEntity, ent);
return 1;
}
/* cstrike -> fakemeta stocks */
cs_set_weapon_ammo(ent, ammo)
{
return set_pdata_int(ent, OFFSET_CLIPAMMO, ammo, __get_linux_offset());
}
cs_set_user_bpammo(plr, weapon, ammo)
{
return set_pdata_int(plr, __get_ammo_offset(weapon), ammo);
}
cs_set_user_model(plr, const sModel[])
{
return engfunc(EngFunc_SetClientKeyValue, plr, engfunc(EngFunc_GetInfoKeyBuffer, plr), g_sModel, sModel);
}
cs_get_user_model(plr, sModel[], len)
{
return engfunc(EngFunc_InfoKeyValue, engfunc(EngFunc_GetInfoKeyBuffer, plr), g_sModel, sModel, len);
}
CsTeams:cs_get_user_team(plr, &{CsInternalModel,_}:model=CS_DONTCHANGE)
{
model = CsInternalModel:get_pdata_int(plr, OFFSET_INTERNALMODEL);
return CsTeams:get_pdata_int(plr, OFFSET_TEAM);
}
cs_set_user_team(plr, {CsTeams,_}:team, {CsInternalModel,_}:model=CS_DONTCHANGE)
{
set_pdata_int(plr, OFFSET_TEAM, _:team);
if( model )
{
set_pdata_int(plr, OFFSET_INTERNALMODEL, _:model);
}
dllfunc(DLLFunc_ClientUserInfoChanged, plr);
make_TeamInfo(plr, g_sTeamInfo[team]);
return 1;
}
cs_set_user_money(plr, money, flash=1)
{
set_pdata_int(plr, OFFSET_MONEY, money);
make_Money(plr, money, flash);
return 1;
}
cs_set_user_armor(plr, amount, CsArmorType:type)
{
set_pdata_int(plr, OFFSET_ARMORTYPE, _:type);
set_pev(plr, pev_armorvalue, float(amount));
if( type != CS_ARMOR_NONE )
{
make_ArmorType(plr, (type == CS_ARMOR_VESTHELM) ? 1 : 0);
}
return 1;
}
__get_ammo_offset(weapon)
{
static offset;
switch( weapon )
{
case CSW_AWP:
{
offset = OFFSET_AWP_AMMO;
}
case CSW_SCOUT, CSW_AK47, CSW_G3SG1:
{
offset = OFFSET_SCOUT_AMMO;
}
case CSW_FAMAS, CSW_M4A1, CSW_AUG, CSW_SG550, CSW_GALIL, CSW_SG552:
{
offset = OFFSET_FAMAS_AMMO;
}
case CSW_M3, CSW_XM1014:
{
offset = OFFSET_M3_AMMO;
}
case CSW_USP, CSW_UMP45, CSW_MAC10:
{
offset = OFFSET_USP_AMMO;
}
case CSW_FIVESEVEN, CSW_P90:
{
offset = OFFSET_FIVESEVEN_AMMO;
}
case CSW_DEAGLE:
{
offset = OFFSET_DEAGLE_AMMO;
}
case CSW_P228:
{
offset = OFFSET_P228_AMMO;
}
case CSW_GLOCK18, CSW_MP5NAVY, CSW_TMP, CSW_ELITE:
{
offset = OFFSET_GLOCK_AMMO;
}
case CSW_FLASHBANG:
{
offset = OFFSET_FLASHBANG_AMMO;
}
case CSW_HEGRENADE:
{
offset = OFFSET_HEGRENADE_AMMO;
}
case CSW_SMOKEGRENADE:
{
offset = OFFSET_SMOKEGRENADE_AMMO;
}
case CSW_C4:
{
offset = OFFSET_C4_AMMO;
}
default:
{
return 0;
}
}
return offset;
}
__get_linux_offset()
{
static offset, i;
if(i != 1)
{
offset = is_linux_server() ? 4 : 0;
i = 1;
}
return offset;
}