mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-06 05:13:21 +00:00
Minor tweaks
This commit is contained in:
parent
9b49ec33f3
commit
bbdeae14ef
4 changed files with 122 additions and 2 deletions
|
@ -46,7 +46,7 @@ enum L4DModelId {
|
|||
}
|
||||
|
||||
static ArrayList LasersUsed;
|
||||
static ConVar hLaserNotice, hFinaleTimer, hFFNotice, hMPGamemode, hPingDropThres, hForceSurvivorSet, hPlayerLimit, hSVMaxPlayers;
|
||||
static ConVar hLaserNotice, hFinaleTimer, hFFNotice, hMPGamemode, hPingDropThres, hForceSurvivorSet, hPlayerLimit, hSVMaxPlayers, hHideMotd;
|
||||
static int iFinaleStartTime, botDropMeleeWeapon[MAXPLAYERS+1], iHighPingCount[MAXPLAYERS+1];
|
||||
ReserveMode reserveMode;
|
||||
static bool isHighPingIdle[MAXPLAYERS+1], isL4D1Survivors;
|
||||
|
@ -95,6 +95,7 @@ public void OnPluginStart() {
|
|||
hFFNotice = CreateConVar("sm_ff_notice", "0.0", "Notify players if a FF occurs. 0 -> Disabled, 1 -> In chat, 2 -> In Hint text", FCVAR_NONE, true, 0.0, true, 2.0);
|
||||
hPingDropThres = CreateConVar("sm_autoidle_ping_max", "0.0", "The highest ping a player can have until they will automatically go idle.\n0=OFF, Min is 30", FCVAR_NONE, true, 0.0, true, 1000.0);
|
||||
hForceSurvivorSet = FindConVar("l4d_force_survivorset");
|
||||
hHideMotd = CreateConVar("sm_hidemotd", "1", "Hide the MOTD when the server is running", FCVAR_NONE, true, 0.0, true, 1.0);
|
||||
|
||||
hSVMaxPlayers = FindConVar("sv_maxplayers");
|
||||
if(hSVMaxPlayers != null) {
|
||||
|
@ -636,6 +637,7 @@ public Action Cmd_SetSurvivor(int client, int args) {
|
|||
|
||||
// Hide MOTD
|
||||
public Action VGUIMenu(UserMsg msg_id, Handle bf, const int[] players, int playersNum, bool reliable, bool init) {
|
||||
if(!hHideMotd.BoolValue) return Plugin_Continue;
|
||||
static char buffer[5];
|
||||
BfReadString(bf, buffer, sizeof(buffer));
|
||||
return strcmp(buffer, "info") == 0 ? Plugin_Handled : Plugin_Continue;
|
||||
|
|
|
@ -123,7 +123,7 @@ public Action Command_InstaSpecialFace(int client, int args) {
|
|||
}
|
||||
}
|
||||
if(successes > 0)
|
||||
CShowActivityEx(client, "[FTT] ", "spawned {green}Insta-%s™{default} on {green}%s", arg2, target_name);
|
||||
CShowActivityEx(client, "[FTT] ", "spawned {olive}Insta-%s™{default} on {olive}%s", arg2, target_name);
|
||||
}
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
|
|
@ -266,6 +266,27 @@ stock int CreateParticle(const char[] sParticle, const float vPos[3], const floa
|
|||
return 0;
|
||||
}
|
||||
|
||||
stock void CreateDecal(const char[] texture, const float vPos[3]) {
|
||||
int index = PrecacheDecal("decals/checkpointarrow01_black.vmt");
|
||||
TE_Start("World Decal");
|
||||
TE_WriteVector("m_vecOrigin", vPos);
|
||||
TE_WriteNum("m_nIndex", index);
|
||||
TE_SendToAll();
|
||||
|
||||
TE_Start("BSP Decal");
|
||||
TE_WriteVector("m_vecOrigin", vPos);
|
||||
TE_WriteNum("m_nIndex", index);
|
||||
TE_SendToAll();
|
||||
// int entity = CreateEntityByName("infodecal");
|
||||
// if( entity != -1 ) {
|
||||
// DispatchKeyValue(entity, "texture", "decals/checkpointarrow01_black.vmt");
|
||||
// DispatchKeyValue(entity, "targetname", ENT_ENV_NAME);
|
||||
// TeleportEntity(entity, vPos, NULL_VECTOR, NULL_VECTOR);
|
||||
// DispatchSpawn(entity);
|
||||
// ActivateEntity(entity);
|
||||
// }
|
||||
}
|
||||
|
||||
// From l4d_anomaly
|
||||
stock void PrecacheParticle(const char[] sEffectName)
|
||||
{
|
||||
|
|
|
@ -31,6 +31,12 @@ stock void GetHorizontalPositionFromClient(int client, float units, float finalP
|
|||
pos[0] += units * Cosine(theta);
|
||||
pos[1] += units * Sine(theta);
|
||||
finalPosition = pos;
|
||||
}
|
||||
stock void GetOffsetPosition(float pos[3], const float ang[3], float forwardBack, float leftRight, float upDown) {
|
||||
float theta = DegToRad(ang[1]);
|
||||
pos[0] = forwardBack * Cosine(theta) + pos[0];
|
||||
pos[1] = forwardBack * Sine(theta) + pos[1];
|
||||
pos[2] = pos[2] + upDown;
|
||||
}
|
||||
// Gets velocity of an entity (ent) toward new origin with speed (fSpeed) - thanks Ryan
|
||||
stock bool GetVelocityToOrigin(int entity, const float destination[3], const float fSpeed, float outVelocity[3]) {
|
||||
|
@ -757,6 +763,10 @@ bool Filter_IgnorePlayer(int entity, int mask, int data) {
|
|||
return entity > 0 && entity != data;
|
||||
}
|
||||
|
||||
bool Filter_World(int entity, int mask, int data) {
|
||||
return entity == 0;
|
||||
}
|
||||
|
||||
// Gets a position from where the cursor is upto distance away (basically <= distance, going against walls)
|
||||
stock bool GetCursorLimited(int client, float distance, float endPos[3], TraceEntityFilter filter)
|
||||
{
|
||||
|
@ -786,3 +796,90 @@ stock void SetWeaponDelay(int client, float delay) {
|
|||
SetEntPropFloat(pWeapon, Prop_Send, "m_flNextSecondaryAttack", GetGameTime() + delay);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Sends client a menu selecting a player, see COMMAND_FILTER_* for flags, idPrefix is appended to menu item's id
|
||||
stock void QueryPlayer(int client, MenuHandler handler, int flags = COMMAND_FILTER_NO_IMMUNITY, const char[] title = "Select a player", const char[] idPrefix = "", int time = 0) {
|
||||
Menu menu = new Menu(handler);
|
||||
menu.SetTitle(title, client);
|
||||
char id[32], display[32];
|
||||
for(int i = 1; i <= MaxClients; i++) {
|
||||
if(IsClientConnected(i) && (IsClientInGame(i) || flags & COMMAND_FILTER_CONNECTED)) {
|
||||
if(flags & COMMAND_FILTER_NO_BOTS && IsFakeClient(i)) continue;
|
||||
if(flags & COMMAND_FILTER_ALIVE && !IsPlayerAlive(i)) continue;
|
||||
if(flags & COMMAND_FILTER_DEAD && IsPlayerAlive(i)) continue;
|
||||
if(~flags & COMMAND_FILTER_NO_IMMUNITY && !CanUserTarget(client, i)) continue;
|
||||
|
||||
Format(id, sizeof(id), "%s%d", idPrefix, GetClientUserId(i));
|
||||
if(IsFakeClient(i)) {
|
||||
int realPlayer = GetRealClient(i);
|
||||
if(realPlayer > 0) {
|
||||
if(IsPlayerAlive(i)) {
|
||||
Format(display, sizeof(display), "%N (Idle)", realPlayer);
|
||||
} else {
|
||||
Format(display, sizeof(display), "%N (Idle)(Dead)", realPlayer);
|
||||
}
|
||||
} else if(IsPlayerAlive(i)) {
|
||||
Format(display, sizeof(display), "%N", i);
|
||||
} else {
|
||||
Format(display, sizeof(display), "%N (dead)", i);
|
||||
}
|
||||
} else if(IsPlayerAlive(i)) {
|
||||
Format(display, sizeof(display), "%N", i);
|
||||
} else {
|
||||
Format(display, sizeof(display), "%N (dead)", i);
|
||||
}
|
||||
|
||||
menu.AddItem(id, display);
|
||||
}
|
||||
}
|
||||
|
||||
menu.Display(client, time);
|
||||
}
|
||||
stock bool IsNearGround(int ref, float distFromGround = 15.0) {
|
||||
static float sPos[3], ePos[3];
|
||||
GetEntPropVector(ref, Prop_Send, "m_vecOrigin", sPos);
|
||||
ePos[0] = sPos[0];
|
||||
ePos[1] = sPos[1];
|
||||
ePos[2] = sPos[2] -= 15.0;
|
||||
TR_TraceRayFilter(sPos, ePos, MASK_SOLID, RayType_EndPoint, Filter_IgnorePlayer, ref);
|
||||
if(TR_DidHit()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
stock bool IsAreaClear(const float pos[3], const float ang[3], const float minBound[3], const float maxBound[3]) {
|
||||
|
||||
TR_TraceHullFilter(pos, pos, minBound, maxBound, MASK_SOLID, Filter_World);
|
||||
if(TR_DidHit()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
stock Action Timer_KillEntity(Handle h, int entity) {
|
||||
RemoveEntity(entity);
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
stock int GetSinglePlayer(int client, const char[] input, int flags = 0) {
|
||||
flags |= COMMAND_FILTER_NO_MULTI;
|
||||
char buf[2];
|
||||
int target_list[1], target_count;
|
||||
bool tn_is_ml;
|
||||
if ((target_count = ProcessTargetString(
|
||||
input,
|
||||
client,
|
||||
target_list,
|
||||
1,
|
||||
flags,
|
||||
buf,
|
||||
2,
|
||||
tn_is_ml)) <= 0
|
||||
) {
|
||||
ReplyToTargetError(client, target_count);
|
||||
return -1;
|
||||
}
|
||||
return target_list[0];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue