All pastes #112695 Raw Edit

Hawk552

public c v1 · immutable
·published 2006-08-03 03:40 UTC
rendered paste body
/*Surf Tools - Extras by Hawk552Description: 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- Makes it impossible for people to be killed by other players, but still	get killed by hitting the bottom of a map	See base plugin for more details (usually named "surftools.sma/amxx")Credits:Thanks to Freecode for a section that has een removed (asically 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									** 1.4 - Fixed a lot of code, fixed button remover							** 1.5 - Removed spawn HP, added godmode, added respawn rather than dying				** 1.6 - Removed godmode, changed button remover to always work, changed semiclip to almost always work	** 1.7 - Cleaned up code, fixed a few things that were stupid, ported entirely to fakemeta		*********************************************************************************************************/#include <amxmodx>#include <amxmisc>#include <fakemeta>#include <engine_const>#define PLUGIN "Surf Management / Tools - Extras"#define VERSION "1.7"#define AUTHOR "Hawk552"new bool:g_SurfMapnew p_Onnew p_RemoveDroppednew p_RemoveButtonnew p_NoGunsnew p_SpawnDistnew p_Semiclippublic plugin_init(){	register_plugin(PLUGIN,VERSION,AUTHOR)	register_cvar("surf_extras_version",VERSION,FCVAR_SERVER)		// no, this will not override the base	register_cvar("surf_on","1")	// for some reason if it's already registered, it won't work	p_On = get_cvar_pointer("surf_on")		p_RemoveDropped = register_cvar("surf_remove_dropped","1")	p_RemoveButton = register_cvar("surf_remove_button","1")	p_NoGuns = register_cvar("surf_noguns","0")	p_SpawnDist = register_cvar("surf_spawn_dist","500")	p_Semiclip = register_cvar("surf_semiclip","0")		register_forward(FM_SetModel,"ForwardSetModel")		CheckSurf()	CheckButton()}CheckButton()	if(get_pcvar_num(p_RemoveButton) && get_pcvar_num(p_On) && g_SurfMap)	{		new Ent,Value[] = "classname",ClassName[] = "env_explosion"		while((Ent = engfunc(EngFunc_FindEntityByString,Ent,Value,ClassName)) != 0)			if(pev_valid(Ent))				set_pev(Ent,pev_flags,pev(Ent,pev_flags)|FL_KILLME)	}CheckSurf(){	new MapName[32]	get_mapname(MapName,31)	if(containi(MapName,"surf") != -1 || containi(MapName,"wurf") != -1 || equali(MapName,"tentical"))		g_SurfMap = true}public client_PreThink(id){	if(!is_user_alive(id) || !get_pcvar_num(p_On) || !g_SurfMap)		return			new NoGuns = get_pcvar_num(p_NoGuns)		if(NoGuns == 1)	{		new SpawnDistance = get_pcvar_num(p_SpawnDist)				static Float:vOrigin[3]		pev(id,pev_origin,vOrigin)			new DeathMatch = engfunc(EngFunc_FindEntityByString,-1,"classname","info_player_deathmatch")		new PlayerStart = engfunc(EngFunc_FindEntityByString,-1,"classname","info_player_start")				if(!DeathMatch || !PlayerStart)			return			static Float:vDeathMatch_Origin[3]		pev(DeathMatch,pev_origin,vDeathMatch_Origin)		static Float:vPlayerStart_Origin[3]		pev(PlayerStart,pev_origin,vPlayerStart_Origin)			new Float:DeathMatch_Distance = get_distance_f(vOrigin,vDeathMatch_Origin)		new Float:PlayerStart_Distance = get_distance_f(vOrigin,vPlayerStart_Origin)			new Clip, Ammo, Weapon = get_user_weapon(id,Clip,Ammo)				if(DeathMatch_Distance < SpawnDistance || PlayerStart_Distance < SpawnDistance)		{			if(Weapon != CSW_KNIFE && Weapon != CSW_C4 && Weapon != CSW_HEGRENADE && Weapon != CSW_FLASHBANG && Weapon != CSW_SMOKEGRENADE)				client_cmd(id,"drop")		} // Argh, stupid thing doesn't understand this if I don't add the brackets.		else if(DeathMatch_Distance > SpawnDistance || PlayerStart_Distance > SpawnDistance)			if(!user_has_weapon(id,CSW_SCOUT))				fm_give_item(id,"weapon_scout")	}	else if(NoGuns == 2)	{				new Clip, Ammo, Weapon = get_user_weapon(id,Clip,Ammo)					if(Weapon != CSW_KNIFE && Weapon != CSW_C4 && Weapon != CSW_HEGRENADE && Weapon != CSW_FLASHBANG && Weapon != CSW_SMOKEGRENADE)			client_cmd(id,"drop")	}	else if(NoGuns == 3)	{		new Clip, Ammo, Weapon = get_user_weapon(id,Clip,Ammo)					if(Weapon != CSW_KNIFE && Weapon != CSW_C4)		{			fm_strip_user_weapons(id)			fm_give_item(id,"weapon_knife")		}	}		if(get_pcvar_num(p_Semiclip))	{		new Ent,Float:Radius = 200.0,Float:vOrigin[3],Flag				pev(id,pev_origin,vOrigin)				while((Ent = engfunc(EngFunc_FindEntityInSphere,Ent,vOrigin,Radius)) != 0)		{			static ClassName[33]			pev(Ent,pev_classname,ClassName,32)						if(equali(ClassName,"trigger_teleport") || equali(ClassName,"trigger_hurt"))			{				set_pev(id,pev_solid,SOLID_BSP)				Flag = true				break			}		}				if(!Flag)			set_pev(id,pev_solid,SOLID_NOT)	}}public ForwardSetModel(id,Model[]){	if(!pev_valid(id) || !strlen(Model) || !get_pcvar_num(p_RemoveDropped) || !g_SurfMap)		return			static ClassName[33]	pev(id,pev_classname,ClassName,32)		if(equali(ClassName,"weaponbox"))				engfunc(EngFunc_RemoveEntity,id)}// no, VEN did not write this, I did (although I found out later that he wrote something like it)fm_give_item(id,Item[]){	if(containi(Item,"item_") == -1 && containi(Item,"weapon_") == -1 && containi(Item,"ammo_") == -1 && containi(Item,"tf_weapon_") == -1)		return		new Ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, Item)),Float:vOrigin[3]		if(!pev_valid(Ent))		return			pev(id,pev_origin,vOrigin)	set_pev(Ent,pev_origin,vOrigin)		set_pev(Ent,pev_spawnflags,pev(Ent,pev_spawnflags)|(1<<30))		dllfunc(DLLFunc_Spawn,Ent)		new Solid = pev(Ent,pev_solid)		dllfunc(DLLFunc_Touch,Ent,id)		if(pev(Ent,pev_solid) == Solid)		engfunc(EngFunc_RemoveEntity,Ent)}// thanks to VEN for this stock from Fakemeta Utilitiesfm_strip_user_weapons(index) {	new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "player_weaponstrip"))	if (!pev_valid(ent))		return 0	dllfunc(DLLFunc_Spawn, ent)	dllfunc(DLLFunc_Use, ent, index)		engfunc(EngFunc_RemoveEntity, ent)	return 1}