add weapon cleanup (#67)

This commit is contained in:
shavitush 2016-07-09 20:27:24 +03:00
parent 2be3af740e
commit b0e19b541d
6 changed files with 58 additions and 6 deletions

View File

@ -13,11 +13,11 @@ a bhop server should be simple
# Requirements:
* [SourceMod 1.8 and above](http://www.sourcemod.net/downloads.php)
* `clientprefs` plugin/extension. Comes built-in with SourceMod.
* [The RTLer](https://forums.alliedmods.net/showthread.php?p=1649882) is required to *compile* `shavit-chat`.
* [The RTLer](https://forums.alliedmods.net/showthread.php?p=1649882) is required to *compile* `shavit-chat` and you don't need Simple Chat Processor as listed in Ther RTLer's requirements.
# Optional requirements:
* [DHooks](http://users.alliedmods.net/~drifter/builds/dhooks/2.0/) - required for static 250 prestrafe (bhoptimer 1.2b and above)
* [The RTLer](https://forums.alliedmods.net/showthread.php?p=1649882) - required for properly formatted RTL text within `shavit-chat``
* [The RTLer](https://forums.alliedmods.net/showthread.php?p=1649882) - required for properly formatted RTL text within `shavit-chat`.
# Installation:
1. Add a database entry in addons/sourcemod/configs/databases.cfg, call it "shavit"

View File

@ -1,3 +1,5 @@
// code by Dr!fter https://forums.alliedmods.net/showthread.php?t=180114
#if defined _dhooks_included
#endinput
#endif

View File

@ -0,0 +1,35 @@
// code by alongub https://github.com/alongubkin/
#if defined _rtler_included
#endinput
#endif
#define _rtler_included
#pragma semicolon 1
/**
* Converts a string that contains words in RTL languages to be displayed correctly in-game.
*
* @param dest Destination string buffer to copy the RTL-ed string to.
* @param destLen Destination buffer length (includes null terminator).
* @param original Original non-rtled string.
*
* @return The amount of words that needed RTLifying.
*/
native int RTLify(char[] dest, int destLen, const char[] original);
public SharedPlugin __pl_rtler =
{
name = "rtler",
file = "rtler.smx",
#if defined REQUIRE_PLUGIN
required = 1,
#else
required = 0,
#endif
};
public void __pl_rtler_SetNTVOptional()
{
MarkNativeAsOptional("RTLify");
}

View File

@ -227,7 +227,9 @@ public void FormatChat(int client, const char[] sMessage, bool bAlive, int iTeam
}
}
FormatEx(buffer, maxlen, " \x03%s%s %N :\x01 %s", (bAlive || iTeam == CS_TEAM_SPECTATOR)? "":"*DEAD*", sTeam, client, bUseFormattedText? sFormattedText:sMessage);
// int iRank = Shavit_GetRank(client);
FormatEx(buffer, maxlen, "%s\x03%s%s %N :\x01 %s", gSG_Type == Game_CSGO? " ":"", (bAlive || iTeam == CS_TEAM_SPECTATOR)? "":"*DEAD*", sTeam, client, bUseFormattedText? sFormattedText:sMessage);
}
public void ChatMessage(int from, int[] clients, int count, const char[] sMessage)

View File

@ -48,6 +48,7 @@ ConVar gCV_StartOnSpawn = null;
ConVar gCV_PrespeedLimit = null;
ConVar gCV_HideRadar = null;
ConVar gCV_TeleportCommands = null;
ConVar gCV_NoWeaponDrops = null;
// dhooks
Handle gH_GetMaxPlayerSpeed = null;
@ -107,6 +108,7 @@ public void OnPluginStart()
gCV_PrespeedLimit = CreateConVar("shavit_misc_prespeedlimit", "280.00", "Prespeed limitation in startzone.", 0, true, 10.0, false);
gCV_HideRadar = CreateConVar("shavit_misc_hideradar", "1", "Should the plugin hide the in-game radar?", 0, true, 0.0, true, 1.0);
gCV_TeleportCommands = CreateConVar("shavit_misc_tpcmds", "1", "Enable teleport-related commands? (sm_goto/sm_tpto)\n0 - Disabled\n1 - Enabled", 0, true, 0.0, true, 1.0);
gCV_NoWeaponDrops = CreateConVar("shavit_misc_noweapondrops", "1", "Remove every dropped weapon.\n0 - Disabled\n1 - Enabled", 0, true, 0.0, true, 1.0);
AutoExecConfig();
@ -281,8 +283,11 @@ public void OnClientPutInServer(int client)
{
gB_Hide[client] = false;
SDKHook(client, SDKHook_SetTransmit, OnSetTransmit);
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
SDKHook(client, SDKHook_SetTransmit, OnSetTransmit);
SDKHook(client, SDKHook_WeaponDrop, OnWeaponDrop);
/*gCV_NoWeaponDrops*/
if(gH_GetMaxPlayerSpeed != null)
{
@ -326,6 +331,14 @@ public Action OnTakeDamage(int victim, int attacker)
return Plugin_Continue;
}
public void OnWeaponDrop(int client, int entity)
{
if(gCV_NoWeaponDrops.BoolValue && IsValidEntity(entity))
{
AcceptEntityInput(entity, "Kill");
}
}
// hide
public Action OnSetTransmit(int entity, int client)
{

View File

@ -313,7 +313,7 @@ public void ShowMaps(int client)
{
if(gB_Rankings)
{
FormatEx(sQuery, 256, "SELECT pt.map, pt.time, pt.jumps, pt.id, pp.points FROM %splayertimes pt JOIN %splayerpoints pp ON pt.id = pp.recordid WHERE auth = '%s' AND style = %d ORDER BY map;", gS_MySQLPrefix, gS_MySQLPrefix, sAuth, view_as<int>(gBS_Style[client]));
FormatEx(sQuery, 256, "SELECT pt.map, pt.time, pt.jumps, pt.id, pp.points FROM %splayertimes pt JOIN %splayerpoints pp ON pt.id = pp.recordid WHERE auth = '%s' AND style = %d ORDER BY points DESC;", gS_MySQLPrefix, gS_MySQLPrefix, sAuth, view_as<int>(gBS_Style[client]));
}
else