Permalink
Browse files

Add TTT_GetCommitsCount

  • Loading branch information...
Bara committed Nov 19, 2018
1 parent 8093e1d commit 35ec653b039b5fe873e58e5559df1131ef54305f
Showing with 367 additions and 9 deletions.
  1. +75 −0 addons/sourcemod/scripting/include/ttt.inc
  2. +0 −1 addons/sourcemod/scripting/ttt/core/config.sp
  3. +1 −1 addons/sourcemod/scripting/ttt/core/globals.sp
  4. +6 −1 addons/sourcemod/scripting/ttt/core/natives.sp
  5. +8 −0 addons/sourcemod/scripting/ttt/core/version.sp
  6. +2 −5 addons/sourcemod/scripting/ttt/ttt.sp
  7. +5 −0 addons/sourcemod/scripting/ttt/ttt_blackout.sp
  8. +5 −0 addons/sourcemod/scripting/ttt/ttt_bullets.sp
  9. +5 −0 addons/sourcemod/scripting/ttt/ttt_buyRoles.sp
  10. +5 −0 addons/sourcemod/scripting/ttt/ttt_c4_jihad.sp
  11. +5 −0 addons/sourcemod/scripting/ttt/ttt_crashcatcher.sp
  12. +5 −0 addons/sourcemod/scripting/ttt/ttt_decoy_body.sp
  13. +5 −0 addons/sourcemod/scripting/ttt/ttt_decoy_teleport.sp
  14. +5 −0 addons/sourcemod/scripting/ttt/ttt_dnascanner.sp
  15. +5 −0 addons/sourcemod/scripting/ttt/ttt_dronescameras.sp
  16. +5 −0 addons/sourcemod/scripting/ttt/ttt_dropWeapons.sp
  17. +5 −0 addons/sourcemod/scripting/ttt/ttt_fakebody.sp
  18. +5 −0 addons/sourcemod/scripting/ttt/ttt_fakename.sp
  19. +5 −0 addons/sourcemod/scripting/ttt/ttt_futuristicgrenades.sp
  20. +5 −0 addons/sourcemod/scripting/ttt/ttt_glow.sp
  21. +5 −0 addons/sourcemod/scripting/ttt/ttt_grabbermod.sp
  22. +5 −0 addons/sourcemod/scripting/ttt/ttt_healthshot.sp
  23. +5 −0 addons/sourcemod/scripting/ttt/ttt_hide_radar.sp
  24. +5 −0 addons/sourcemod/scripting/ttt/ttt_hurtshot.sp
  25. +5 −0 addons/sourcemod/scripting/ttt/ttt_iceknife.sp
  26. +5 −0 addons/sourcemod/scripting/ttt/ttt_icon.sp
  27. +5 −0 addons/sourcemod/scripting/ttt/ttt_id.sp
  28. +5 −0 addons/sourcemod/scripting/ttt/ttt_knockout.sp
  29. +5 −1 addons/sourcemod/scripting/ttt/ttt_martydom.sp
  30. +5 −0 addons/sourcemod/scripting/ttt/ttt_missiles.sp
  31. +5 −0 addons/sourcemod/scripting/ttt/ttt_models.sp
  32. +5 −0 addons/sourcemod/scripting/ttt/ttt_nightvision.sp
  33. +5 −0 addons/sourcemod/scripting/ttt/ttt_overlay.sp
  34. +5 −0 addons/sourcemod/scripting/ttt/ttt_parachute.sp
  35. +5 −0 addons/sourcemod/scripting/ttt/ttt_playerhud.sp
  36. +5 −0 addons/sourcemod/scripting/ttt/ttt_poison_smoke.sp
  37. +5 −0 addons/sourcemod/scripting/ttt/ttt_radar.sp
  38. +5 −0 addons/sourcemod/scripting/ttt/ttt_radio.sp
  39. +5 −0 addons/sourcemod/scripting/ttt/ttt_random_teleport.sp
  40. +5 −0 addons/sourcemod/scripting/ttt/ttt_res.sp
  41. +5 −0 addons/sourcemod/scripting/ttt/ttt_revive.sp
  42. +5 −0 addons/sourcemod/scripting/ttt/ttt_revolver.sp
  43. +5 −0 addons/sourcemod/scripting/ttt/ttt_shop.sp
  44. +5 −0 addons/sourcemod/scripting/ttt/ttt_shop_discount.sp
  45. +5 −0 addons/sourcemod/scripting/ttt/ttt_silent_awp.sp
  46. +5 −0 addons/sourcemod/scripting/ttt/ttt_spec_menu.sp
  47. +5 −0 addons/sourcemod/scripting/ttt/ttt_sprint.sp
  48. +5 −0 addons/sourcemod/scripting/ttt/ttt_sql.sp
  49. +5 −0 addons/sourcemod/scripting/ttt/ttt_stations.sp
  50. +5 −0 addons/sourcemod/scripting/ttt/ttt_tactical_shield.sp
  51. +5 −0 addons/sourcemod/scripting/ttt/ttt_tagrenade.sp
  52. +5 −0 addons/sourcemod/scripting/ttt/ttt_talk_override.sp
  53. +5 −0 addons/sourcemod/scripting/ttt/ttt_taser.sp
  54. +5 −0 addons/sourcemod/scripting/ttt/ttt_teleporter.sp
  55. +6 −0 addons/sourcemod/scripting/ttt/ttt_tracer.sp
  56. +5 −0 addons/sourcemod/scripting/ttt/ttt_traitor_buttons.sp
  57. +4 −0 addons/sourcemod/scripting/ttt/ttt_traitordoors.sp
  58. +5 −0 addons/sourcemod/scripting/ttt/ttt_tripmines.sp
  59. +5 −0 addons/sourcemod/scripting/ttt/ttt_turret.sp
  60. +5 −0 addons/sourcemod/scripting/ttt/ttt_wallhack.sp
  61. +5 −0 addons/sourcemod/scripting/ttt/ttt_weapons.sp
@@ -481,6 +481,12 @@ native void TTT_TerminateRound(float delay, CSRoundEndReason reason);
*/
native bool TTT_GetLatestVersion(const char[] version, int length);
/**
* Returns latest git commit count.
*
*/
native int TTT_GetCommitsCount();
/**
* Disable the next TTT round. It has no effect if it's already set.
* If you want to close the disabled round:
@@ -1095,3 +1101,72 @@ stock bool TTT_LoadTranslations()
LoadTranslations("ttt.phrases");
}
stock bool TTT_CheckVersion(const char[] version, int git)
{
int iGit = -1;
char sSplit[2][12];
ExplodeString(version, ".", sSplit, sizeof(sSplit), sizeof(sSplit[]));
if (IsStringNumeric(sSplit[1]))
{
iGit = StringToInt(sSplit[1]);
}
LogMessage("Version: %s, git: %d, iGit: %d", version, git, iGit);
if (StrEqual(version, "<VERSION>", false))
{
return true;
}
if (git != -1 && git != iGit)
{
SetFailState("This plugin use a different version as ttt.smx");
return false;
}
return true;
}
stock bool IsStringNumeric(const char[] str)
{
int x=0;
int dotsFound=0;
int numbersFound=0;
if (str[x] == '+' || str[x] == '-')
{
x++;
}
while (str[x] != '\0') {
if (IsCharNumeric(str[x]))
{
numbersFound++;
}
else if (str[x] == '.')
{
dotsFound++;
if (dotsFound > 1)
{
return false;
}
}
else
{
return false;
}
x++;
}
if (!numbersFound)
{
return false;
}
return true;
}
@@ -141,7 +141,6 @@ void SetupConfig()
g_cRespawnAccess = AutoExecConfig_CreateConVar("ttt_respawn_admin_access", "b", "Admin flags to access respawn command.");
g_cPlayerHUDMessage = AutoExecConfig_CreateConVar("ttt_players_remaining_hud_message", "1", "Show hud \"We Are / Players Remaining\" message during non active rounds?", _, true, 0.0, true, 1.0);
g_cShowURL = AutoExecConfig_CreateConVar("ttt_show_url", "1", "Show the URL when a player wants to read the rules? Valve removed the MOTD and Popup-function, so that could be useful", _, true, 0.0, true, 1.0);
g_cVersionCheck = AutoExecConfig_CreateConVar("ttt_version_check", "1", "Enable version check?", _, true, 0.0, true, 1.0);
g_cVersionMessage = AutoExecConfig_CreateConVar("ttt_version_message", "1", "This prints a version message to all players on every spawn", _, true, 0.0, true, 1.0);
g_cSendServerData = AutoExecConfig_CreateConVar("ttt_send_server_data", "1", "Send the Server Port to csgottt.com, server will be listed on csgottt.com", _, true, 0.0, true, 1.0);
g_cDisableRounds = AutoExecConfig_CreateConVar("ttt_disable_rounds", "0", "Disable TTT Rounds? This will require an map change, server restart or plugin that can execute TTT_TerminateRound.", _, true, 0.0, true, 1.0);
@@ -299,7 +299,6 @@ ConVar g_cFlashlightOption = null;
ConVar g_cRespawnAccess = null;
ConVar g_cPlayerHUDMessage = null;
ConVar g_cShowURL = null;
ConVar g_cVersionCheck = null;
ConVar g_cVersionMessage = null;
ConVar g_cSendServerData = null;
ConVar g_cDisableRounds = null;
@@ -321,5 +320,6 @@ Handle g_hWeAreSync = null;
Handle g_hRemainingSync = null;
char g_sLatestVersion[64];
int g_iGit = -1;
RoundStatus g_iStatus = Round_Inactive;
@@ -51,6 +51,7 @@ void InitNatives()
CreateNative("TTT_RespawnPlayer", Native_RespawnPlayer);
CreateNative("TTT_TerminateRound", Native_TerminateRound);
CreateNative("TTT_GetLatestVersion", Native_GetLatestVersion);
CreateNative("TTT_GetCommitsCount", Native_GetCommitsCount);
CreateNative("TTT_DisableRounds", Native_DisableRounds);
CreateNative("TTT_GetRoundStatus", Native_GetRoundStatus);
}
@@ -592,7 +593,6 @@ public int Native_TerminateRound(Handle plugin, int numParams)
CS_TerminateRound(fDelay, rReason, true);
}
public int Native_GetLatestVersion(Handle plugin, int numParams)
{
if (strlen(g_sLatestVersion) < 1)
@@ -605,6 +605,11 @@ public int Native_GetLatestVersion(Handle plugin, int numParams)
return true;
}
public int Native_GetCommitsCount(Handle plugin, int numParams)
{
return g_iGit;
}
public int Native_DisableRounds(Handle plugin, int numParams)
{
g_bDisabled = view_as<bool>(GetNativeCell(1));
@@ -98,6 +98,14 @@ public void OnHTTPCallback(Handle hRequest, bool bFailure, bool bRequestSuccessf
strcopy(g_sLatestVersion, sizeof(g_sLatestVersion), sVersion[3]);
}
char sSplit[2][12];
ExplodeString(g_sLatestVersion, ".", sSplit, sizeof(sSplit), sizeof(sSplit[]));
if (IsStringNumeric(sSplit[1]))
{
g_iGit = StringToInt(sSplit[1]);
}
Call_StartForward(g_hOnVersionCheck);
Call_PushString(g_sLatestVersion);
Call_Finish();
@@ -220,10 +220,7 @@ public void OnConfigsExecuted()
HookEntityOutput("func_button", "OnPressed", OnButtonPressed);
}
if (g_cVersionCheck.BoolValue)
{
GetLatestVersion();
}
GetLatestVersion();
}
public void TTT_OnSQLConnect(Database db)
@@ -1532,7 +1529,7 @@ public Action Event_PlayerSpawn_Pre(Event event, const char[] name, bool dontBro
{
int client = GetClientOfUserId(event.GetInt("userid"));
if (g_cVersionCheck.BoolValue && g_cVersionMessage.BoolValue && strlen(g_sLatestVersion) > 1)
if (g_cVersionMessage.BoolValue && strlen(g_sLatestVersion) > 1)
{
if (StrEqual(TTT_PLUGIN_VERSION, g_sLatestVersion, false))
{
@@ -55,6 +55,11 @@ public void OnPluginStart()
HookEvent("round_end", Event_RoundEnd);
}
public void TTT_OnLatestVersion(const char[] version)
{
TTT_CheckVersion(TTT_PLUGIN_VERSION, TTT_GetCommitsCount());
}
public void TTT_OnShopReady()
{
RegisterItem();
@@ -97,6 +97,11 @@ public void OnPluginStart()
}
}
public void TTT_OnLatestVersion(const char[] version)
{
TTT_CheckVersion(TTT_PLUGIN_VERSION, TTT_GetCommitsCount());
}
public void OnConfigsExecuted()
{
g_cPluginTag = FindConVar("ttt_plugin_tag");
@@ -58,6 +58,11 @@ public void OnPluginStart()
TTT_EndConfig();
}
public void TTT_OnLatestVersion(const char[] version)
{
TTT_CheckVersion(TTT_PLUGIN_VERSION, TTT_GetCommitsCount());
}
public void TTT_OnShopReady()
{
RegisterItem();
@@ -111,6 +111,11 @@ public void OnPluginStart()
TTT_LoadTranslations();
}
public void TTT_OnLatestVersion(const char[] version)
{
TTT_CheckVersion(TTT_PLUGIN_VERSION, TTT_GetCommitsCount());
}
public void OnMapStart()
{
PrecacheSoundAny(SND_BLIP, true);
@@ -29,6 +29,11 @@ public void OnPluginStart()
CreateConVar("ttt2_crashcatcher_version", TTT_PLUGIN_VERSION, TTT_PLUGIN_DESCRIPTION, FCVAR_NOTIFY | FCVAR_DONTRECORD | FCVAR_REPLICATED);
}
public void TTT_OnLatestVersion(const char[] version)
{
TTT_CheckVersion(TTT_PLUGIN_VERSION, TTT_GetCommitsCount());
}
public void OnEntityCreated(int entity, const char[] classname)
{
if (StrEqual(classname, "prop_ragdoll"))
@@ -74,6 +74,11 @@ public void OnPluginStart()
HookEvent("player_spawn", Event_PlayerSpawn);
}
public void TTT_OnLatestVersion(const char[] version)
{
TTT_CheckVersion(TTT_PLUGIN_VERSION, TTT_GetCommitsCount());
}
public void OnMapStart()
{
PrecacheSoundAny(EXPLODE_SOUND1, true);
@@ -61,6 +61,11 @@ public void OnPluginStart()
HookEvent("decoy_started", Event_DecoyStarted, EventHookMode_Pre);
}
public void TTT_OnLatestVersion(const char[] version)
{
TTT_CheckVersion(TTT_PLUGIN_VERSION, TTT_GetCommitsCount());
}
public void OnClientDisconnect(int client)
{
ResetDecoyCount(client);
@@ -54,6 +54,11 @@ public void OnPluginStart()
HookEvent("player_spawn", Event_PlayerSpawn);
}
public void TTT_OnLatestVersion(const char[] version)
{
TTT_CheckVersion(TTT_PLUGIN_VERSION, TTT_GetCommitsCount());
}
public void OnConfigsExecuted()
{
g_cPluginTag = FindConVar("ttt_plugin_tag");
@@ -47,6 +47,11 @@ public void OnPluginStart()
HookEvent("player_spawn", Event_PlayerSpawn);
}
public void TTT_OnLatestVersion(const char[] version)
{
TTT_CheckVersion(TTT_PLUGIN_VERSION, TTT_GetCommitsCount());
}
public void OnAllPluginsLoaded()
{
char sFile[] = "cameras-and-drones.smx";
@@ -63,6 +63,11 @@ public void OnPluginStart()
HookEvent("player_spawn", Event_PlayerSpawn);
}
public void TTT_OnLatestVersion(const char[] version)
{
TTT_CheckVersion(TTT_PLUGIN_VERSION, TTT_GetCommitsCount());
}
public void OnMapStart()
{
g_iBeamSprite = PrecacheModel("materials/sprites/laserbeam.vmt");
@@ -55,6 +55,11 @@ public void OnPluginStart()
HookEvent("player_spawn", Event_PlayerSpawn);
}
public void TTT_OnLatestVersion(const char[] version)
{
TTT_CheckVersion(TTT_PLUGIN_VERSION, TTT_GetCommitsCount());
}
public void OnClientDisconnect(int client)
{
ResetFB(client);
@@ -74,6 +74,11 @@ public void OnPluginStart()
HookEvent("player_death", Event_Player);
}
public void TTT_OnLatestVersion(const char[] version)
{
TTT_CheckVersion(TTT_PLUGIN_VERSION, TTT_GetCommitsCount());
}
public void OnConfigsExecuted()
{
CheckPlayerID();
@@ -126,6 +126,11 @@ public void OnPluginStart()
HookEvent("player_spawn", Event_PlayerSpawn);
}
public void TTT_OnLatestVersion(const char[] version)
{
TTT_CheckVersion(TTT_PLUGIN_VERSION, TTT_GetCommitsCount());
}
public void OnAllPluginsLoaded()
{
char sFile[] = "futuristicgrenades.smx";
@@ -51,6 +51,11 @@ public void OnPluginStart()
g_bCPS = LibraryExists("CustomPlayerSkins");
}
public void TTT_OnLatestVersion(const char[] version)
{
TTT_CheckVersion(TTT_PLUGIN_VERSION, TTT_GetCommitsCount());
}
public void OnPluginEnd()
{
LoopValidClients(i)
@@ -103,6 +103,11 @@ public void OnPluginStart()
g_aBlocklist = new ArrayList();
}
public void TTT_OnLatestVersion(const char[] version)
{
TTT_CheckVersion(TTT_PLUGIN_VERSION, TTT_GetCommitsCount());
}
public void OnMapStart()
{
g_iSprite = PrecacheModel("materials/sprites/laserbeam.vmt");
@@ -61,6 +61,11 @@ public void OnPluginStart()
HookEvent("player_spawn", Event_PlayerSpawn);
}
public void TTT_OnLatestVersion(const char[] version)
{
TTT_CheckVersion(TTT_PLUGIN_VERSION, TTT_GetCommitsCount());
}
public void OnClientDisconnect(int client)
{
ResetHealthshot(client);
@@ -25,6 +25,11 @@ public void OnPluginStart()
HookEvent("player_blind", Event_PlayerBlind, EventHookMode_Post);
}
public void TTT_OnLatestVersion(const char[] version)
{
TTT_CheckVersion(TTT_PLUGIN_VERSION, TTT_GetCommitsCount());
}
public Action Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast)
{
CreateTimer(0.0, Timer_RemoveRadar, event.GetInt("userid"));
@@ -60,6 +60,11 @@ public void OnPluginStart()
}
}
public void TTT_OnLatestVersion(const char[] version)
{
TTT_CheckVersion(TTT_PLUGIN_VERSION, TTT_GetCommitsCount());
}
public void OnConfigsExecuted()
{
g_cPluginTag = FindConVar("ttt_plugin_tag");
Oops, something went wrong.

0 comments on commit 35ec653

Please sign in to comment.