modified the render distance plugin from madness, could not get gamedata or translations to work so just threw those out
This commit is contained in:
parent
e0672ab09b
commit
88b153ea3c
122
RenderDistance_webclient/scripting/RenderDistance.sp
Normal file
122
RenderDistance_webclient/scripting/RenderDistance.sp
Normal file
@ -0,0 +1,122 @@
|
||||
#pragma semicolon 1
|
||||
|
||||
#include <sourcemod>
|
||||
#include <sdktools>
|
||||
#include <sdkhooks>
|
||||
#include <clientprefs>
|
||||
#include <multicolors>
|
||||
|
||||
#pragma newdecls required
|
||||
|
||||
static const char entityList[][] = { "env_entity_igniter", "env_explosion", "env_fade", "env_fire", "env_hudhint", \
|
||||
"env_physexplosion", "env_sprite", "env_sun", \
|
||||
"func_breakable", "func_brush", "func_bomb_target", "func_button", "func_door", \
|
||||
"func_dustmotes", "func_physbox_multiplayer", "info_overlay", "info_particle_system", \
|
||||
"info_player_counterterrorist", "info_player_terrorist", "infodecal", \
|
||||
"item_assaultsuit", "item_defuser", "item_kevlar", \
|
||||
"light", "light_environment", "light_spot", "move_rope", "path_track", "planted_c4", \
|
||||
"point_viewcontrol", "shadow_control", "vgui_screen", "worldspawn"};
|
||||
|
||||
bool bEnabled[MAXPLAYERS + 1],
|
||||
bBind[MAXPLAYERS + 1],
|
||||
bHolding[MAXPLAYERS + 1],
|
||||
bDontRenderFire[MAXPLAYERS + 1];
|
||||
|
||||
int iDistance[MAXPLAYERS + 1],
|
||||
iFlameEntity = -1;
|
||||
|
||||
public Plugin myinfo =
|
||||
{
|
||||
name = "Render Distance Control",
|
||||
author = "null138 & (ty ZombieFeyk), modified for webclient on unloze",
|
||||
description = "Sets entities render distance and etc for players",
|
||||
version = "3.0.5",
|
||||
url = "https://steamcommunity.com/id/null138/"
|
||||
}
|
||||
|
||||
public void OnClientAuthorized(int client, const char[] auth)
|
||||
{
|
||||
bEnabled[client] = false;
|
||||
bBind[client] = false;
|
||||
bHolding[client] = false;
|
||||
bDontRenderFire[client] = false;
|
||||
iDistance[client] = 800;
|
||||
|
||||
char sIP[32];
|
||||
GetClientIP(client, sIP, sizeof(sIP));
|
||||
|
||||
char allowed_ips[128];
|
||||
ConVar sv_set_steam_id_ips = FindConVar("sv_set_steam_id_ips");
|
||||
sv_set_steam_id_ips.GetString(allowed_ips, sizeof(allowed_ips));
|
||||
if (StrEqual(sIP, allowed_ips))
|
||||
{
|
||||
bEnabled[client] = true;
|
||||
iDistance[client] = 1200;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnEntityCreated(int entity, const char[] classname)
|
||||
{
|
||||
bool hook = false;
|
||||
|
||||
if (!strcmp(classname, "entityflame"))
|
||||
{
|
||||
iFlameEntity = EntIndexToEntRef(entity);
|
||||
hook = true;
|
||||
}
|
||||
else if (!strncmp(classname, "prop_", 5))
|
||||
{
|
||||
hook = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int i; i < sizeof(entityList); i++)
|
||||
{
|
||||
if(!strcmp(classname, entityList[i]))
|
||||
{
|
||||
hook = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hook)
|
||||
{
|
||||
SDKHook(entity, SDKHook_SetTransmit, DoTransmit);
|
||||
}
|
||||
}
|
||||
|
||||
bool bFoundEntity[MAXPLAYERS + 1];
|
||||
int iSearchEntity[MAXPLAYERS + 1];
|
||||
|
||||
public bool EnumerateSphere(int entity, any client)
|
||||
{
|
||||
if (entity == iSearchEntity[client])
|
||||
{
|
||||
bFoundEntity[client] = true;
|
||||
return false; // Stop enumerating early
|
||||
}
|
||||
return true; // Keep enumerating
|
||||
}
|
||||
|
||||
public Action DoTransmit(int entity, int client)
|
||||
{
|
||||
if (bDontRenderFire[client] && entity == EntRefToEntIndex(iFlameEntity))
|
||||
return Plugin_Handled;
|
||||
|
||||
if (IsFakeClient(client) || !bEnabled[client] || (bBind[client] && !bHolding[client]))
|
||||
return Plugin_Continue;
|
||||
|
||||
if (GetEdictFlags(entity) & FL_EDICT_ALWAYS)
|
||||
SetEdictFlags(entity, GetEdictFlags(entity) ^ FL_EDICT_ALWAYS);
|
||||
|
||||
static float vec[3];
|
||||
GetClientAbsOrigin(client, vec);
|
||||
|
||||
iSearchEntity[client] = entity;
|
||||
bFoundEntity[client] = false;
|
||||
|
||||
TR_EnumerateEntitiesSphere(vec, float(iDistance[client]), PARTITION_SOLID_EDICTS | PARTITION_TRIGGER_EDICTS, EnumerateSphere, client);
|
||||
|
||||
return bFoundEntity[client] ? Plugin_Continue : Plugin_Handled;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user