well awhile ago X-Olent made a mod for my request..Invisible man
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
new bool:gModOn = true;
new gMsgSayText;
new gMaxPlayers;
public plugin_init()
{
register_plugin("Invisible Mod", "1.0", "Exolent");
register_concmd("amx_invismod", "cmd_invismod", ADMIN_KICK, "<1|0> -- turns on/off Invisible Mod");
register_clcmd("say /invishelp", "cmd_invishelp");
register_event("ResetHUD", "event_ResetHUD", "be");
register_event("DeathMsg", "event_DeathMsg", "a");
register_forward(FM_PlayerPreThink, "fm_PreThink", 0);
gMsgSayText = get_user_msgid("SayText");
gMaxPlayers = get_maxplayers();
set_task(2.0, "set_cvars");
set_task(10.0, "show_reminder");
}
public set_cvars()
{
server_cmd("mp_limitteams %d", gMaxPlayers);
server_cmd("humans_join_team ct");
server_cmd("mp_autoteambalance 0");
}
public show_reminder()
{
if(gModOn)
green_msg(0, "[INVIS] New to Invisible Mod? Type /invishelp to learn more!");
set_task(180.0, "show_reminder");
}
public cmd_invismod(id, level, cid)
{
if(!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED;
new arg[4], num;
read_argv(1, arg, 3);
num = str_to_num(arg);
if(num > 1 || num < 0)
num = 0;
new message[4];
new bool:change = false;
if(num && !gModOn)
{
gModOn = true;
formatex(message, 3, "on");
change = true;
}
else if(!num && gModOn)
{
gModOn = false;
formatex(message, 3, "off");
change = true;
}
if(change)
{
new name[32];
get_user_name(id, name, 31);
switch(get_cvar_num("amx_show_activity"))
{
case 2: client_print(0, print_chat, "[AMXX] ADMIN %s: turned %s Invisible Mod!", name, message);
case 1: client_print(0, print_chat, "[AMXX] ADMIN: turned %s Invisible Mod!", message);
}
console_print(id, "[AMXX] Turned %s Invisible Mod", message);
}
return PLUGIN_HANDLED;
}
public cmd_invishelp(id)
{
if(gModOn)
{
console_print(id, "[==============[INVISIBLE MOD]==============]");
console_print(id, "Invisible Mod is a game in which there is only one Terrorist.");
console_print(id, "That Terrorist is invisible and only has a knife.");
console_print(id, "All of the other players are placed on Counter-Terrorist and can buy any weapon they choose.");
console_print(id, "To become to invisible Terrorist, you must kill the current one.");
console_print(id, "[===========================================]");
green_msg(id, "[INVIS] Explanation has been printed in your console.");
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
public event_DeathMsg()
{
if(gModOn)
{
new killer = read_data(1);
new victim = read_data(2);
new CsTeams:kteam = cs_get_user_team(killer);
new CsTeams:vteam = cs_get_user_team(victim);
if(kteam == CS_TEAM_CT && vteam == CS_TEAM_T)
{
new kname[32], vname[32];
get_user_name(killer, kname, 31);
get_user_name(victim, vname, 31);
green_msg(0, "[INVIS] %s killed the invisible Terrorist, %s!", kname, vname);
green_msg(0, "[INVIS] %s is now the invisible Terrorist!", kname);
cs_set_user_team(killer, CS_TEAM_T);
cs_set_user_team(victim, CS_TEAM_CT);
}
}
}
public event_ResetHUD(id)
{
if(gModOn)
{
set_task(1.0, "start_cloaking", id);
set_task(2.0, "set_weapons", id);
}
}
public set_weapons(id)
{
fm_strip_weapons(id);
new CsTeams:team = cs_get_user_team(id);
if(team == CS_TEAM_CT)
{
fm_give_item(id, "weapon_knife");
fm_give_item(id, "weapon_usp");
fm_give_item(id, "ammo_45acp");
fm_give_item(id, "ammo_45acp");
switch(random_num(0, 1))
{
case 0:
{
fm_give_item(id, "weapon_ak47");
fm_give_item(id, "ammo_762nato");
fm_give_item(id, "ammo_762nato");
fm_give_item(id, "ammo_762nato");
}
case 1:
{
fm_give_item(id, "weapon_m4a1");
fm_give_item(id, "ammo_556nato");
fm_give_item(id, "ammo_556nato");
fm_give_item(id, "ammo_556nato");
}
}
}
else if(team == CS_TEAM_T)
{
fm_give_item(id, "weapon_knife");
}
}
public fm_PreThink(id)
{
if(gModOn)
{
new CsTeams:team = cs_get_user_team(id);
new clip, ammo;
new weapon = get_user_weapon(id, clip, ammo);
if(team == CS_TEAM_T)
{
if(weapon != CSW_KNIFE)
{
set_weapons(id);
green_msg(id, "[INVIS] You cannot have that weapon during Invisible Mod!");
}
}
else if(team == CS_TEAM_CT)
{
if(weapon != CSW_KNIFE
&& weapon != CSW_SMOKEGRENADE
&& weapon != CSW_HEGRENADE
&& weapon != CSW_FLASHBANG
&& weapon != CSW_AK47
&& weapon != CSW_M4A1
&& weapon != CSW_USP)
{
set_weapons(id);
green_msg(id, "[INVIS] You cannot have that weapon during Invisible Mod!");
}
}
}
}
public start_cloaking(id)
{
if(is_user_alive(id))
{
new array[2];
array[0] = id;
array[1] = 240;
set_task(0.1, "finish_cloaking", 0, array, 2);
}
}
public finish_cloaking(array[])
{
if(is_user_alive(array[0]))
{
set_cloak(array[0], array[1]);
if(array[1] == 0) return;
array[1] -= 24;
set_task(0.1, "finish_cloaking", 0, array, 2);
}
}
public anti_cloak_start(id)
{
if(is_user_alive(id))
{
new array[2];
array[0] = id;
array[1] = 15;
set_task(0.1, "anti_cloak_finish", 0, array, 2);
}
}
public anti_cloak_finish(array[])
{
if(is_user_alive(array[0]))
{
set_cloak(array[0], array[1]);
if(array[1] == 255) return;
array[1] += 24;
set_task(0.1, "anti_cloak_finish", 0, array, 2);
}
}
public set_cloak(id, amount)
{
set_pev(id, pev_rendermode, kRenderTransAlpha);
set_pev(id, pev_renderamt, float(amount));
}
public fm_strip_weapons(id)
{
new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "player_weaponstrip"));
if(pev_valid(ent))
{
dllfunc(DLLFunc_Spawn, ent);
dllfunc(DLLFunc_Use, ent, id);
engfunc(EngFunc_RemoveEntity, ent);
}
}
public fm_give_item(id, const item[])
{
if(!equal(item, "weapon_", 7) && !equal(item, "ammo_", 5) && !equal(item, "item_", 5) && !equal(item, "tf_weapon_", 10))
{
return 0;
}
new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item));
if(!pev_valid(ent))
{
return 0;
}
new Float:origin[3];
pev(id, pev_origin, origin);
set_pev(ent, pev_origin, origin);
set_pev(ent, pev_spawnflags, pev(ent, pev_spawnflags) | SF_NORESPAWN);
dllfunc(DLLFunc_Spawn, ent);
new save = pev(ent, pev_solid);
dllfunc(DLLFunc_Touch, ent, id);
if(pev(ent, pev_solid) != save)
{
return ent;
}
engfunc(EngFunc_RemoveEntity, ent);
return -1;
}
public green_msg(id, const message[], {Float,Sql,Result,_}:...)
{
static msg[192];
msg[0] = 0x04;
vformat(msg[1], 190, message, 3);
if(id > 0 && id <= 32)
{
message_begin(MSG_ONE, gMsgSayText, {0, 0, 0}, id);
write_byte(id);
write_string(msg);
message_end();
}
else if(id == 0)
{
for(new i = 1; i <= gMaxPlayers; i++)
{
if(is_user_connected(i))
{
message_begin(MSG_ONE, gMsgSayText, {0, 0, 0}, i);
write_byte(i);
write_string(msg);
message_end();
}
}
}
}
While you spawn..
Second issue and thats the biggest one so far...
There's supposed to be One invisible man...but Sometimes CT's get invisible too and sometimes none gets invisible..
Someone could probably write this from scratch...