I did it here somewhere, just don't steal it and release this as your own plugin or something.
Code:
/*
Surf Tools - Extras by Hawk552
Description:
More features to go along with the original surf tools plugin.
Features:
- Removing the "BOOM" button in surf maps
- Removing weapons from spawn, and not allowing sniping from spawn point
- Removing all weapons entirely
Credits:
Thanks to Freecode for a section that has been removed (basically thanks for him trying)
Designed to work with Surf Management / Tools - Base, although it can work on its own.
*/
/**************************************************************************
Changelog:
1.0 - Original Release
1.1 - Fixed button remover, abandoned passthrough
1.2 - Removed gun being useless, added gun removal, as well as HP setter
1.3 - Fixed spawn HP, added semiclip
**************************************************************************/
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <engine>
#define PLUGIN "Surf Management / Tools - Extras"
#define VERSION "1.3"
#define AUTHOR "Hawk552"
public plugin_init()
{
checksurf();
register_plugin(PLUGIN,VERSION,AUTHOR);
register_cvar("surf_version_extras",VERSION,FCVAR_SERVER);
register_cvar("surf_rembutton","1");
register_cvar("surf_noguns","2");
register_cvar("surf_spawn_dist","500");
register_cvar("surf_hp","1124");
register_cvar("surf_semiclip","1");
register_event("ResetHUD","check_hp","be");
register_event("Damage","check_hp","b");
if(!cvar_exists("surf_on"))
{
register_cvar("surf_on","1");
}
//Uncomment this if the button re-appears after the first round.
//register_event("RoundTime", "check_button", "bc")
check_button();
}
public check_button()
{
if(get_cvar_num("surf_rembutton") && get_cvar_num("surf_on"))
{
new ent;
while((ent = find_ent_by_class(ent,"func_button"))!=0)
{
remove_entity(ent);
}
while((ent = find_ent_by_class(ent,"func_rot_button"))!=0)
{
remove_entity(ent);
}
}
return 0;
}
public pfn_touch(ptr,ptd)
{
if(!get_cvar_num("surf_on") || !ptr || !ptd)
{
return 0;
}
new pToucherClassname[64];
new pTouchedClassname[64];
entity_get_string(ptr,EV_SZ_classname,pToucherClassname,63);
entity_get_string(ptd,EV_SZ_classname,pTouchedClassname,63);
if(equali(pToucherClassname,"trigger_hurt") || equali(pTouchedClassname,"trigger_hurt") && get_cvar_num("surf_hp"))
{
if(is_user_alive(ptr) && !is_user_bot(ptr))
{
user_kill(ptr,0);
}
else if(is_user_alive(ptd) && !is_user_bot(ptd))
{
user_kill(ptd,0);
}
}
return 0;
}
public checksurf()
{
new mapname[64];
get_mapname(mapname,63);
if(!(containi(mapname,"surf") != -1 || containi(mapname,"wurf_") != -1 || equali(mapname,"tentical")))
{
// Yeah I tried to make it plugin independant, oh well
set_cvar_num("surf_on",0);
}
return 0;
}
public client_PreThink(id)
{
if(!is_user_alive(id) || !get_cvar_num("surf_on"))
{
return 0;
}
if(get_cvar_num("surf_noguns") == 1)
{
new spawndist = get_cvar_num("surf_spawn_dist");
new Float:origin[3];
entity_get_vector(id,EV_VEC_origin,origin);
new dm_id = find_ent_by_class(-1,"info_player_deathmatch");
new st_id = find_ent_by_class(-1,"info_player_start");
new Float:dm_origin[3];
entity_get_vector(dm_id,EV_VEC_origin,dm_origin);
new Float:st_origin[3];
entity_get_vector(st_id,EV_VEC_origin,st_origin);
new Float:dm_dist = get_distance_f(origin,dm_origin);
new Float:st_dist = get_distance_f(origin,st_origin);
new clip, ammo;
new weap = get_user_weapon(id,clip,ammo);
if(dm_dist < spawndist || st_dist < spawndist)
{
if(weap != CSW_KNIFE && weap != CSW_C4 && weap != CSW_HEGRENADE && weap != CSW_FLASHBANG && weap != CSW_SMOKEGRENADE)
{
client_cmd(id,"drop");
}
}
else if(dm_dist > spawndist || st_dist > spawndist)
{
if(weap == CSW_KNIFE)
{
give_item(id,"weapon_scout");
}
}
}
else if(get_cvar_num("surf_noguns") == 2)
{
new clip, ammo;
new weap = get_user_weapon(id,clip,ammo);
if(weap != CSW_KNIFE && weap != CSW_C4 && weap != CSW_HEGRENADE && weap != CSW_FLASHBANG && weap != CSW_SMOKEGRENADE)
{
client_cmd(id,"drop");
}
}
else if(get_cvar_num("surf_noguns") == 3)
{
new clip, ammo;
new weap = get_user_weapon(id,clip,ammo);
if(weap != CSW_KNIFE && weap != CSW_C4)
{
strip_user_weapons(id);
give_item(id,"weapon_knife");
}
}
if(get_cvar_num("surf_semiclip"))
{
new Float:porigin[3], ent, bool:entflag, Float:radius = 150.0;
entity_get_vector(id,EV_VEC_origin,porigin);
while((ent = find_ent_in_sphere(ent,porigin,radius)) != 0)
{
if(!is_user_alive(ent) || ent == id)
{
continue;
}
entflag = true;
break;
}
if(!entflag)
{
entity_set_int(id,EV_INT_solid,2);
}
else if(entflag)
{
entity_set_int(id,EV_INT_solid,0);
}
}
return 0;
}
public check_hp(id)
{
if(!get_cvar_num("surf_on"))
{
return 0;
}
new cvar_hp = get_cvar_num("surf_hp");
if(cvar_hp == 0 || !is_user_alive(id))
{
return 0;
}
new damage = read_data(2), attacker = get_user_attacker(id);
new atk_class[32];
entity_get_string(attacker,EV_SZ_classname,atk_class,31);
if(equali(atk_class,"player") && get_user_health(id) < cvar_hp)
{
set_user_health(id,cvar_hp);
}
else if(damage > 100)
{
user_kill(id,0);
}
return 0;
}