|
Junior Member
Join Date: Jul 2010
Location: Morgantown, WV
|

09-16-2010
, 09:07
Re: GunGame
|
#11
|
Quote:
Originally Posted by altex
The most severe changes between 1.0.9.0 (2010-02-20) and 1.0.9.4 (2010-07-11) is the new css release with OB engine.
here is the diff, almost nothing critical changed
Code:
Index: doc/CHANGELOG.txt
===================================================================
--- doc/CHANGELOG.txt (revision 4763)
+++ doc/CHANGELOG.txt (revision 5001)
@@ -1,5 +1,21 @@
Changelog
---------
+ 1.0.9.4:
+ * Added cssdm 2.1.1 support.
+
+ 1.0.9.3:
+ * Fixed: handicap does not work for new players who has never win yet.
+ * Update: gungame.games.txt updated for CSS OB version. Thanks to psychonic.
+
+ 1.0.9.2:
+ + Feature: Added config variable "HandicapTopRank" to define what is the lowest rank
+ which is not allowing players to get handicap if "TopRankHandicap" "0".
+ * Config variable "Top10Handicap" renamed to "TopRankHandicap".
+
+ 1.0.9.1:
+ * Improvement: Handicap is now been gived on first team join, not on connect.
+ + Added motd example file "tools/gungame_winner.php".
+
1.0.9.0:
+ Feature: Added config variable "EnableFriendlyFireLevel" to enable friendly fire on defined level.
+ Feature: Added config variable "DisableRtvLevel" to disable rtv if leader is on defined level.
Index: cfg/gungame/gungame.config.txt
===================================================================
--- cfg/gungame/gungame.config.txt (revision 4763)
+++ cfg/gungame/gungame.config.txt (revision 5001)
@@ -173,10 +173,15 @@
"HandicapMode" "2"
/**
- * Allow players in the top10 to receive a handicap with the rest of the players.
+ * Allow players in the top rank to receive a handicap with the rest of the players.
+ *
* Handicap must also be turned on above for this to work.
+ * See also "HandicapTopRank" to set rank limit for tp rank.
+ *
+ * 0 - Do not give handicap to the top rank players.
+ * 1 - Give handicap to all players.
*/
- "Top10Handicap" "1"
+ "TopRankHandicap" "1"
/**
* Gives handicap level automaticaly every defined number of seconds.
@@ -198,6 +203,16 @@
*/
"HandicapTimesPerMap" "0"
+ /**
+ * Do not give handicap to the top rank players.
+ *
+ * See also "TopRankHandicap" to allow all players to receive handicap.
+ *
+ * 0 - Give handicap to all players.
+ * N - Do not give handicap for the first N players.
+ */
+ "HandicapTopRank" "10"
+
/* ----- [equip] ----- */
/* Auto reload current level weapon on kill */
Index: tools/gungame_winner.php
===================================================================
--- tools/gungame_winner.php (revision 0)
+++ tools/gungame_winner.php (revision 5001)
@@ -0,0 +1,32 @@
+<?php
+
+// This is gungame winner motd file that is been shown
+// by gungame_display_winner plugin.
+
+header("Content-type: text/html; charset=utf-8");
+
+function show($varName)
+{
+ if ( isset($_GET[$varName]) )
+ {
+ echo mb_convert_encoding($_GET[$varName],"HTML-ENTITIES","UTF-8");
+ }
+}
+
+?>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>GunGame Winner</title>
+ </head>
+<body>
+ <b><?php show("winnerName"); ?></b> Won!<hr><br />
+ <b><?php show("winnerName"); ?></b> won the game
+ by killing <b><?php show("loserName"); ?></b><br /><br />
+ <b>Stats:</b><br />
+ Wins: <b><?php show("wins"); ?></b><br />
+ Place: <b><?php show("place"); ?></b>
+ of <b><?php show("totalPlaces"); ?></b>
+</body>
+</html>
+
Index: addons/sourcemod/scripting/gungame_stats/ranks.sp
===================================================================
--- addons/sourcemod/scripting/gungame_stats/ranks.sp (revision 4763)
+++ addons/sourcemod/scripting/gungame_stats/ranks.sp (revision 5001)
@@ -1,15 +1,3 @@
-public GG_OnWinner(client, const String:Weapon[])
-{
- if ( IsClientInGame(client) && !IsFakeClient(client) )
- {
- ++PlayerWinsData[client];
- SavePlayerData(client);
- #if !defined SQL_SUPPORT
- CheckRank(client);
- #endif
- }
-}
-
GetPlayerPlaceInTop10(const String:Auth[])
{
for(new i = 0; i < MAX_RANK; i++)
@@ -23,7 +11,6 @@
return -1;
}
-#if !defined SQL_SUPPORT
CheckRank(client)
{
new Wins = PlayerWinsData[client];
@@ -97,5 +84,4 @@
GetClientName(client, PlayerName[RankToReplace], sizeof(PlayerName[]));
PlayerAuthid[RankToReplace] = Auth;
}
-#endif
Index: addons/sourcemod/scripting/gungame_stats/sql.sp
===================================================================
--- addons/sourcemod/scripting/gungame_stats/sql.sp (revision 4763)
+++ addons/sourcemod/scripting/gungame_stats/sql.sp (revision 5001)
@@ -129,7 +129,7 @@
return;
}
- // Reload top10 data after winner has beed updated in the database
+ // Reload top rank data after winner has beed updated in the database
LoadRank();
}
@@ -184,6 +184,16 @@
{
if ( auth[0] == 'B' )
{
+ g_PlayerWinsLoaded[client] = true;
+ PlayerWinsData[client] = 0;
+
+ #if defined SQL_DEBUG
+ LogError("[DEBUG-SQL] FORWARD PLAYER WINS LOADED client=%i is BOT", client);
+ #endif
+
+ Call_StartForward(FwdLoadPlayerWins);
+ Call_PushCell(client);
+ Call_Finish();
return;
}
decl String:query[1024];
@@ -206,6 +216,7 @@
LogError("Failed to retrieve player by auth (error: %s)", error);
return;
}
+ g_PlayerWinsLoaded[client] = true;
if ( SQL_FetchRow(result) )
{
new id = SQL_FetchInt(result, 0);
@@ -219,7 +230,17 @@
#endif
SQL_TQuery(g_DbConnection, T_FastQueryResult, query);
}
+ else
+ {
+ PlayerWinsData[client] = 0;
}
+ #if defined SQL_DEBUG
+ LogError("[DEBUG-SQL] FORWARD PLAYER WINS LOADED client=%i, wins=%i", client, PlayerWinsData[client]);
+ #endif
+ Call_StartForward(FwdLoadPlayerWins);
+ Call_PushCell(client);
+ Call_Finish();
+}
public T_FastQueryResult(Handle:owner, Handle:result, const String:error[], any:data)
{
@@ -367,7 +388,7 @@
}
}
- ReplyToCommand(client, "[GunGame] Import of es player data completed. Please run gg_rebuild to update the top10.");
+ ReplyToCommand(client, "[GunGame] Import of es player data completed. Please run gg_rebuild to update the top rank.");
return Plugin_Handled;
}
@@ -478,7 +499,7 @@
}
}
- ReplyToCommand(client, "[GunGame] Import of player data completed. Please run gg_rebuild to update the top10.");
+ ReplyToCommand(client, "[GunGame] Import of player data completed. Please run gg_rebuild to update the top rank.");
return Plugin_Handled;
}
@@ -487,7 +508,7 @@
public Action:_CmdRebuild(client, args)
{
LoadRank();
- ReplyToCommand(client, "[GunGame] Top10 has been rebuilt");
+ ReplyToCommand(client, "[GunGame] Top rank has been rebuilt");
return Plugin_Handled;
}
@@ -557,10 +578,7 @@
// reset top 10 data
TotalWinners = 0;
- for (new i = 0; i < MAX_RANK; i++)
- {
- PlayerWins[i] = 0;
- }
+ g_cfgHandicapTopWins = 0;
return Plugin_Handled;
}
@@ -570,10 +588,7 @@
{
// reset top 10 data
TotalWinners = 0;
- for ( new i = 0; i < MAX_RANK; i++ )
- {
- PlayerWins[i] = 0;
- }
+ g_cfgHandicapTopWins = 0;
for ( new i = 1; i <= MAXPLAYERS; i++ )
{
PlayerPlaceData[i] = 0;
@@ -604,37 +619,71 @@
count = SQL_FetchInt(result, 0);
}
TotalWinners = count;
+ #if defined SQL_DEBUG
+ LogError("[DEBUG-SQL] Found %i winners in the rank table", TotalWinners);
+ #endif
- LoadTop10Data();
+ LoadTopRankData();
}
// threaded
-LoadTop10Data()
+LoadTopRankData()
{
+ if ( !g_cfgHandicapTopRank )
+ {
+ g_cfgHandicapTopWins = 0;
+ #if defined SQL_DEBUG
+ LogError("[DEBUG-SQL] Handicap top wins = 0 (handicap top rank disabled)");
+ #endif
+ Call_StartForward(FwdLoadRank);
+ Call_Finish();
+ return;
+ }
+
+ if ( g_cfgHandicapTopRank >= TotalWinners )
+ {
+ g_cfgHandicapTopWins = 1;
+ #if defined SQL_DEBUG
+ LogError("[DEBUG-SQL] Handicap top wins = 1 (handicap top rank more then total winners)");
+ #endif
+ Call_StartForward(FwdLoadRank);
+ Call_Finish();
+ return;
+ }
+
decl String:query[1024];
- Format(query, sizeof(query), g_sql_getTopPlayers, 10, 0);
+ Format(query, sizeof(query), g_sql_getTopPlayers, 1, g_cfgHandicapTopRank - 1);
#if defined SQL_DEBUG
LogError("[DEBUG-SQL] %s", query);
#endif
- SQL_TQuery(g_DbConnection, T_LoadTop10Data, query);
+ SQL_TQuery(g_DbConnection, T_LoadTopRankData, query);
}
-public T_LoadTop10Data(Handle:owner, Handle:result, const String:error[], any:data)
+public T_LoadTopRankData(Handle:owner, Handle:result, const String:error[], any:data)
{
if ( result == INVALID_HANDLE )
{
LogError("Failed to load rank data (error: %s)", error);
+ g_cfgHandicapTopWins = 0;
+ Call_StartForward(FwdLoadRank);
+ Call_Finish();
return;
}
- new i = 0;
- while ( SQL_FetchRow(result) )
+ if ( SQL_FetchRow(result) )
{
- PlayerWins[i] = SQL_FetchInt(result, 1);
- SQL_FetchString(result, 2, PlayerName[i], sizeof(PlayerName[]));
- SQL_FetchString(result, 3, PlayerAuthid[i], sizeof(PlayerAuthid[]));
- i++;
+ g_cfgHandicapTopWins = SQL_FetchInt(result, 1);
+ #if defined SQL_DEBUG
+ LogError("[DEBUG-SQL] Handicap top wins = %i", g_cfgHandicapTopWins);
+ #endif
}
+ else
+ {
+ g_cfgHandicapTopWins = 0;
+ #if defined SQL_DEBUG
+ LogError("[DEBUG-SQL] Handicap top wins = 0 (cant fetch rows from sql)");
+ #endif
+ }
Call_StartForward(FwdLoadRank);
Call_Finish();
@@ -700,3 +749,29 @@
}
}
+
+bool:IsPlayerInTopRank(client)
+{
+ #if defined SQL_DEBUG
+ LogError("[DEBUG-SQL] IsPlayerInTopRank client=%i", client);
+ #endif
+ if ( !g_cfgHandicapTopWins )
+ {
+ #if defined SQL_DEBUG
+ LogError("[DEBUG-SQL] ... false (top rank handicap wins not loaded)");
+ #endif
+ return false;
+ }
+ if ( PlayerWinsData[client] < g_cfgHandicapTopWins )
+ {
+ #if defined SQL_DEBUG
+ LogError("[DEBUG-SQL] ... false (player wins less then top rank handicap wins)");
+ #endif
+ return false;
+ }
+ #if defined SQL_DEBUG
+ LogError("[DEBUG-SQL] ... true (player wins more or equal to top rank handicap wins)");
+ #endif
+ return true;
+}
+
Index: addons/sourcemod/scripting/gungame_stats/ranks.h
===================================================================
--- addons/sourcemod/scripting/gungame_stats/ranks.h (revision 4763)
+++ addons/sourcemod/scripting/gungame_stats/ranks.h (revision 5001)
@@ -1,11 +1,13 @@
-#define MAX_RANK 10 /* DO NOT CHANGE THE DEFINE MAX_RANK */
+/**
+ * Max rank for stats.
+ */
+#define MAX_RANK 10
-#if !defined SQL_SUPPORT
new bool:RankChange;
new bool:HasRank;
-#endif
+new String:PlayerName[MAX_RANK][MAX_NAME_SIZE];
+new PlayerWins[MAX_RANK];
/* Top10 ranks */
new String:PlayerAuthid[MAX_RANK][64];
-new String:PlayerName[MAX_RANK][MAX_NAME_SIZE];
-new PlayerWins[MAX_RANK];
+
Index: addons/sourcemod/scripting/gungame_stats/config.sp
===================================================================
--- addons/sourcemod/scripting/gungame_stats/config.sp (revision 4763)
+++ addons/sourcemod/scripting/gungame_stats/config.sp (revision 5001)
@@ -12,6 +12,8 @@
{
if ( strcmp(Key, "Prune", false) == 0 ) {
Prune = StringToInt(Value);
+ } else if ( strcmp(Key, "HandicapTopRank", false) == 0 ) {
+ g_cfgHandicapTopRank = StringToInt(Value);
}
}
}
Index: addons/sourcemod/scripting/gungame_stats/gungame_stats.h
===================================================================
--- addons/sourcemod/scripting/gungame_stats/gungame_stats.h (revision 4763)
+++ addons/sourcemod/scripting/gungame_stats/gungame_stats.h (revision 5001)
@@ -1,5 +1,5 @@
/**
- * Top10 and player data will sync after map change.
+ * Top rank and player data will sync after map change.
*/
new bool:SaveProcess;
@@ -13,5 +13,11 @@
new TotalWinners = 0;
#endif
+#if defined SQL_SUPPORT
new Handle:FwdLoadRank = INVALID_HANDLE;
+ new Handle:FwdLoadPlayerWins = INVALID_HANDLE;
+ new g_cfgHandicapTopWins = 0;
+#endif
+new bool:g_PlayerWinsLoaded[MAXPLAYERS + 1] = {false, ...};
+
Index: addons/sourcemod/scripting/gungame_stats/keyvalues.sp
===================================================================
--- addons/sourcemod/scripting/gungame_stats/keyvalues.sp (revision 4763)
+++ addons/sourcemod/scripting/gungame_stats/keyvalues.sp (revision 5001)
@@ -96,6 +96,7 @@
{
if ( auth[0] == 'B' )
{
+ g_PlayerWinsLoaded[client] = true;
return;
}
if(PlayerOpen)
@@ -113,6 +114,8 @@
/* Update timestamp */
KvSetNum(KvPlayer, "TimeStamp", GetTime());
}
+
+ g_PlayerWinsLoaded[client] = true;
}
}
Index: addons/sourcemod/scripting/gungame_stats/natives.sp
===================================================================
--- addons/sourcemod/scripting/gungame_stats/natives.sp (revision 4763)
+++ addons/sourcemod/scripting/gungame_stats/natives.sp (revision 5001)
@@ -4,7 +4,8 @@
CreateNative("GG_GetClientWins", __GetPlayerWins);
CreateNative("GG_CountPlayersInStat", __CountPlayersInStat);
CreateNative("GG_GetPlayerPlaceInStat", __GetPlayerPlaceInStat);
- CreateNative("GG_GetPlayerPlaceInTop10", __GetPlayerPlaceInTop10);
+ CreateNative("GG_IsPlayerInTopRank", __IsPlayerInTopRank);
+ CreateNative("GG_IsPlayerWinsLoaded", __IsPlayerWinsLoaded);
CreateNative("GG_ShowRank", __ShowRank);
}
@@ -71,9 +72,37 @@
return PlayerWinsData[client];
}
-public __GetPlayerPlaceInTop10(Handle:plugin, numParams)
+public __IsPlayerInTopRank(Handle:plugin, numParams)
{
- new String:auth[64];
- GetNativeString(1, auth, sizeof(auth));
- return GetPlayerPlaceInTop10(auth);
+ new client = GetNativeCell(1);
+
+ if(client < 1 || client > MaxClients)
+ {
+ return ThrowNativeError(SP_ERROR_NATIVE, "Invalid client index [%d]", client);
+ } else if(!IsClientInGame(client)) {
+ return ThrowNativeError(SP_ERROR_NATIVE, "Client is not currently ingame [%d]", client);
}
+
+ #if defined SQL_SUPPORT
+ return IsPlayerInTopRank(client);
+ #else
+ decl String:Authid[64];
+ GetClientAuthString(client, Authid, sizeof(Authid));
+ return GetPlayerPlaceInTop10(Authid) != -1;
+ #endif
+}
+
+public __IsPlayerWinsLoaded(Handle:plugin, numParams)
+{
+ new client = GetNativeCell(1);
+
+ if(client < 1 || client > MaxClients)
+ {
+ return ThrowNativeError(SP_ERROR_NATIVE, "Invalid client index [%d]", client);
+ } else if(!IsClientInGame(client)) {
+ return ThrowNativeError(SP_ERROR_NATIVE, "Client is not currently ingame [%d]", client);
+ }
+
+ return g_PlayerWinsLoaded[client];
+}
+
Index: addons/sourcemod/scripting/gungame_stats/config.h
===================================================================
--- addons/sourcemod/scripting/gungame_stats/config.h (revision 4763)
+++ addons/sourcemod/scripting/gungame_stats/config.h (revision 5001)
@@ -1,3 +1,4 @@
new State:ConfigState = CONFIG_STATE_NONE;
new Prune = 30;
+new g_cfgHandicapTopRank = 10;
Index: addons/sourcemod/scripting/gungame_stats.sp
===================================================================
--- addons/sourcemod/scripting/gungame_stats.sp (revision 4763)
+++ addons/sourcemod/scripting/gungame_stats.sp (revision 5001)
@@ -11,18 +11,19 @@
#include "gungame_stats/gungame_stats.h"
#include "gungame_stats/config.h"
#include "gungame_stats/menu.h"
-#include "gungame_stats/ranks.h"
#if defined SQL_SUPPORT
#include "gungame_stats/sql.h"
#include "gungame_stats/sql.sp"
#endif
+
#if !defined SQL_SUPPORT
+ #include "gungame_stats/ranks.h"
+ #include "gungame_stats/ranks.sp"
#include "gungame_stats/keyvalues.h"
#include "gungame_stats/keyvalues.sp"
#endif
-#include "gungame_stats/ranks.sp"
#include "gungame_stats/menu.sp"
#include "gungame_stats/config.sp"
#include "gungame_stats/natives.sp"
@@ -43,8 +44,8 @@
OnCreateNatives();
return APLRes_Success;
}
-#endif
+#else
// deprecated in 1.3.1
public bool:AskPluginLoad(Handle:myself, bool:late, String:error[], err_max)
{
@@ -52,10 +53,15 @@
OnCreateNatives();
return true;
}
+#endif
public OnPluginStart()
{
+ #if defined SQL_SUPPORT
FwdLoadRank = CreateGlobalForward("GG_OnLoadRank", ET_Ignore);
+ FwdLoadPlayerWins = CreateGlobalForward("GG_OnLoadPlayerWins", ET_Ignore, Param_Cell);
+ #endif
+
LoadTranslations("gungame_stats");
OnCreateKeyValues();
@@ -64,7 +70,7 @@
#if defined SQL_SUPPORT
RegConsoleCmd("rank", _CmdRank);
#endif
- RegAdminCmd("gg_rebuild", _CmdRebuild, GUNGAME_ADMINFLAG, "Rebuilds the top10 rank from the player data information");
+ RegAdminCmd("gg_rebuild", _CmdRebuild, GUNGAME_ADMINFLAG, "Rebuilds the top rank from the player data information");
RegAdminCmd("gg_import", _CmdImport, GUNGAME_ADMINFLAG, "Imports the winners file from es gungame.");
#if defined SQL_SUPPORT
RegAdminCmd("gg_reset", _CmdReset, GUNGAME_ADMINFLAG, "Reset all gungame stats.");
@@ -129,6 +135,7 @@
public OnClientDisconnect(client)
{
+ g_PlayerWinsLoaded[client] = false;
PlayerWinsData[client] = 0;
#if defined SQL_SUPPORT
PlayerPlaceData[client] = 0;
@@ -169,3 +176,16 @@
#endif
SavePlayerDataInfo();
}
+
+public GG_OnWinner(client, const String:Weapon[])
+{
+ if ( IsClientInGame(client) && !IsFakeClient(client) )
+ {
+ ++PlayerWinsData[client];
+ SavePlayerData(client);
+ #if !defined SQL_SUPPORT
+ CheckRank(client);
+ #endif
+ }
+}
+
Index: addons/sourcemod/scripting/gungame/menu.sp
===================================================================
--- addons/sourcemod/scripting/gungame/menu.sp (revision 4763)
+++ addons/sourcemod/scripting/gungame/menu.sp (revision 5001)
@@ -14,7 +14,7 @@
ShowWeaponLevelPanel(client);
case 3: /* !score */
ShowPlayerLevelMenu(client);
- case 4: /* !top10 */
+ case 4: /* !top */
{
if ( StatsEnabled )
{
@@ -50,7 +50,7 @@
{
switch(param2)
{
- case 2: /* !top10 */
+ case 2: /* !top */
{
if ( StatsEnabled )
{
Index: addons/sourcemod/scripting/gungame/config.sp
===================================================================
--- addons/sourcemod/scripting/gungame/config.sp (revision 4763)
+++ addons/sourcemod/scripting/gungame/config.sp (revision 5001)
@@ -193,8 +193,8 @@
CommitSuicide = StringToInt(value);
} else if(strcmp("HandicapMode", key, false) == 0) {
HandicapMode = StringToInt(value);
- } else if(strcmp("Top10Handicap", key, false) == 0) {
- Top10Handicap = bool:StringToInt(value);
+ } else if(strcmp("TopRankHandicap", key, false) == 0) {
+ TopRankHandicap = bool:StringToInt(value);
}
}
Index: addons/sourcemod/scripting/gungame/natives.sp
===================================================================
--- addons/sourcemod/scripting/gungame/natives.sp (revision 4763)
+++ addons/sourcemod/scripting/gungame/natives.sp (revision 5001)
@@ -85,17 +85,15 @@
return 0;
}
- decl String:steamid[64];
- GetClientAuthString(client, steamid, sizeof(steamid));
-
- if ( g_Cfg_HandicapSkipBots && steamid[0] == 'B' ) {
+ if ( g_Cfg_HandicapSkipBots && IsFakeClient(client) ) {
return 0;
}
- if ( steamid[0] != 'B'
- && !Top10Handicap
+ if ( !IsFakeClient(client)
+ && !TopRankHandicap
&& StatsEnabled
- && ( GG_GetPlayerPlaceInTop10(steamid) == -1 ) /* HINT: gungame_stats */
+ && ( !GG_IsPlayerWinsLoaded(client) /* HINT: gungame_stats */
+ || GG_IsPlayerInTopRank(client) ) /* HINT: gungame_stats */
)
{
return 0;
@@ -106,6 +104,7 @@
{
PlayerLevel[client] = level;
CurrentKillsPerWeap[client] = 0;
+ UTIL_UpdatePlayerScoreLevel(client);
return 1;
}
@@ -249,17 +248,9 @@
return PlayerLevel[client] + 1;
}
+
public __GetMaxLevel(Handle:plugin, numParams)
{
- new client = GetNativeCell(1);
-
- if(client < 1 || client > MaxClients)
- {
- return ThrowNativeError(SP_ERROR_NATIVE, "Invalid client index [%d]", client);
- } else if(!IsClientInGame(client)) {
- return ThrowNativeError(SP_ERROR_NATIVE, "Client is not currently ingame [%d]", client);
- }
-
return WeaponOrderCount;
}
Index: addons/sourcemod/scripting/gungame/config.h
===================================================================
--- addons/sourcemod/scripting/gungame/config.h (revision 4763)
+++ addons/sourcemod/scripting/gungame/config.h (revision 5001)
@@ -47,7 +47,7 @@
new bool:RestoreLevelOnReconnect;
new bool:TripleLevelBonusGodMode;
new HandicapMode;
-new bool:Top10Handicap;
+new bool:TopRankHandicap;
new bool:StatsEnabled;
new WarmupRandomWeaponMode = 0;
new WarmupRandomWeaponLevel = 0;
Index: addons/sourcemod/scripting/gungame/util.sp
===================================================================
--- addons/sourcemod/scripting/gungame/util.sp (revision 4763)
+++ addons/sourcemod/scripting/gungame/util.sp (revision 5001)
@@ -1153,3 +1153,26 @@
return level;
}
+bool:UTIL_SetHandicapForClient(client)
+{
+ if ( g_Cfg_HandicapTimesPerMap )
+ {
+ decl String:auth[64];
+ GetClientAuthString(client, auth, sizeof(auth));
+
+ new times = 0;
+ if ( !GetTrieValue(PlayerHandicapTimes, auth, times) ) {
+ times = 0;
+ }
+
+ if ( times >= g_Cfg_HandicapTimesPerMap ) {
+ return false;
+ }
+
+ times++;
+ SetTrieValue(PlayerHandicapTimes, auth, times);
+ }
+
+ return bool:GG_GiveHandicapLevel(client);
+}
+
Index: addons/sourcemod/scripting/gungame/event.sp
===================================================================
--- addons/sourcemod/scripting/gungame/event.sp (revision 4763)
+++ addons/sourcemod/scripting/gungame/event.sp (revision 5001)
@@ -503,7 +503,12 @@
ShowJoinMsgPanel(client);
}
}
+
+ if ( !StatsEnabled || GG_IsPlayerWinsLoaded(client) ) /* HINT: gungame_stats */
+ {
+ UTIL_SetHandicapForClient(client);
}
+ }
if ( g_Cfg_ArmorKevlar )
{
Index: addons/sourcemod/scripting/gungame/hacks.sp
===================================================================
--- addons/sourcemod/scripting/gungame/hacks.sp (revision 4763)
+++ addons/sourcemod/scripting/gungame/hacks.sp (revision 5001)
@@ -84,6 +84,20 @@
PrepSDKCall_AddParameter(SDKType_Bool, SDKPass_Plain);
CSWeaponDrop = EndPrepSDKCall();
+ if ( CSWeaponDrop == INVALID_HANDLE ) {
+ new Handle:CssdmConf;
+ CssdmConf = LoadGameConfigFile("cssdm.games");
+ if ( CssdmConf != INVALID_HANDLE ) {
+ StartPrepSDKCall(SDKCall_Entity);
+ PrepSDKCall_SetFromConf(CssdmConf, SDKConf_Virtual, "CSWeaponDropPatch");
+ PrepSDKCall_AddParameter(SDKType_CBaseEntity, SDKPass_Pointer);
+ PrepSDKCall_AddParameter(SDKType_Bool, SDKPass_Plain);
+ PrepSDKCall_AddParameter(SDKType_Bool, SDKPass_Plain);
+ CSWeaponDrop = EndPrepSDKCall();
+ CloseHandle(CssdmConf);
+ }
+ }
+
if(CSWeaponDrop == INVALID_HANDLE)
{
SetFailState("Signature CSSPlayer::CSWeaponDrop Failed. Please contact the author.");
Index: addons/sourcemod/scripting/include/gungame_const.inc
===================================================================
--- addons/sourcemod/scripting/include/gungame_const.inc (revision 4763)
+++ addons/sourcemod/scripting/include/gungame_const.inc (revision 5001)
@@ -13,13 +13,13 @@
* Uncomment if sm version >= 1.3.0.
* Default is disabled.
*/
-// #define URANDOM_SUPPORT
+#define URANDOM_SUPPORT
/**
* Uncomment if sm version >= 1.3.1.
* Default is disabled.
*/
-// #define ASK_PLUGIN_LOAD2_SUPPORT
+#define ASK_PLUGIN_LOAD2_SUPPORT
/**
* Enable debug code for sql in stats plugin.
@@ -54,7 +54,7 @@
stock const String:GUNGAME_AUTHOR[] = "teame06-hat, Liam, Otstrel.ru Team";
stock const String:GUNGAME_URL[] = "http://www.hat-city.net, http://otstrel.ru";
-stock const String:GUNGAME_VERSION[] = "1.0.9.0";
+stock const String:GUNGAME_VERSION[] = "1.0.9.4";
stock const String:BLANK[] = "";
stock const String:BLANK_SPACE[] = " ";
Index: addons/sourcemod/scripting/include/gungame_stats.inc
===================================================================
--- addons/sourcemod/scripting/include/gungame_stats.inc (revision 4763)
+++ addons/sourcemod/scripting/include/gungame_stats.inc (revision 5001)
@@ -47,14 +47,22 @@
native GG_GetClientWins(client); /* HINT: gungame_stats */
/**
- * Get player's place in top 10.
+ * Check if player in top rank.
*
- * @param auth Steam id.
- * @return Player place in top 10 (from 0 to 9), -1 if not found.
+ * @param client Player index.
+ * @return True if player is in top rank, false if he is not.
*/
-native GG_GetPlayerPlaceInTop10(const String:auth[]); /* HINT: gungame_stats */
+native bool:GG_IsPlayerInTopRank(client); /* HINT: gungame_stats */
/**
+ * Check if player wins is loaded.
+ *
+ * @param client Player index.
+ * @return True if player wins is loaded, false if it is not.
+ */
+native bool:GG_IsPlayerWinsLoaded(client); /* HINT: gungame_stats */
+
+/**
* Called when rank loaded.
*
* @noparam
@@ -62,6 +70,15 @@
*/
forward GG_OnLoadRank();
+/**
+ * Called when player wins is loaded.
+ *
+ * @param client Player index.
+ * @noreturn
+ */
+forward GG_OnLoadPlayerWins(client);
+
+
/* Do not edit the code below. */
public SharedPlugin:__pl_gungame_st =
{
@@ -81,5 +98,7 @@
MarkNativeAsOptional("GG_GetPlayerPlaceInStat");
MarkNativeAsOptional("GG_CountPlayersInStat");
MarkNativeAsOptional("GG_GetClientWins");
- MarkNativeAsOptional("GG_GetPlayerPlaceInTop10");
+ MarkNativeAsOptional("GG_IsPlayerInTopRank");
+ MarkNativeAsOptional("GG_IsPlayerWinsLoaded");
}
+
Index: addons/sourcemod/scripting/include/gungame.inc
===================================================================
--- addons/sourcemod/scripting/include/gungame.inc (revision 4763)
+++ addons/sourcemod/scripting/include/gungame.inc (revision 5001)
@@ -120,12 +120,11 @@
native GG_GetClientLevel(client);
/**
- * Retrieves the client max level.
+ * Retrieves the max level.
*
- * @param client Player index.
- * @param return The client max level (starting from 1).
+ * @param return The max level (starting from 1).
*/
-native GG_GetClientMaxLevel(client);
+native GG_GetMaxLevel();
/**
* Add a level to the player current level.
Index: addons/sourcemod/scripting/gungame.sp
===================================================================
--- addons/sourcemod/scripting/gungame.sp (revision 4763)
+++ addons/sourcemod/scripting/gungame.sp (revision 5001)
@@ -51,8 +51,8 @@
OnCreateNatives();
return APLRes_Success;
}
-#endif
+#else
// deprecated in 1.3.1
public bool:AskPluginLoad(Handle:myself, bool:late, String:error[], err_max)
{
@@ -60,6 +60,7 @@
OnCreateNatives();
return true;
}
+#endif
public OnLibraryAdded(const String:name[])
{
@@ -136,21 +137,6 @@
}
}
- new times = 0;
- if ( g_Cfg_HandicapTimesPerMap )
- {
- if ( !GetTrieValue(PlayerHandicapTimes, auth, times) ) {
- times = 0;
- }
- times++;
- SetTrieValue(PlayerHandicapTimes, auth, times);
- }
-
- if ( !g_Cfg_HandicapTimesPerMap || g_Cfg_HandicapTimesPerMap >= times )
- {
- GG_GiveHandicapLevel(client);
- }
-
UTIL_UpdatePlayerScoreLevel(client);
}
@@ -522,19 +508,18 @@
return Plugin_Continue;
}
- decl String:steamid[64];
for ( new i = 1; i <= MaxClients; i++ )
{
if ( IsClientInGame(i) && (PlayerLevel[i] == minimum) )
{
- GetClientAuthString(i, steamid, sizeof(steamid));
- if ( g_Cfg_HandicapSkipBots && steamid[0] == 'B' ) {
+ if ( g_Cfg_HandicapSkipBots && IsFakeClient(i) ) {
continue;
}
- if ( steamid[0] != 'B'
- && !Top10Handicap
+ if ( !IsFakeClient(i)
+ && !TopRankHandicap
&& StatsEnabled
- && ( GG_GetPlayerPlaceInTop10(steamid) == -1 ) /* HINT: gungame_stats */
+ && ( !GG_IsPlayerWinsLoaded(i) /* HINT: gungame_stats */
+ || GG_IsPlayerInTopRank(i) ) /* HINT: gungame_stats */
)
{
continue;
@@ -553,6 +538,19 @@
return Plugin_Continue;
}
+public GG_OnLoadPlayerWins(client)
+{
+ if ( !(PlayerState[client] & FIRST_JOIN) )
+ {
+ return;
+ }
+ if ( UTIL_SetHandicapForClient(client) && IsPlayerAlive(client) )
+ {
+ UTIL_GiveNextWeapon(client, PlayerLevel[client]);
+ }
+}
+
+
/**
* KillCam event message should probably should block in DeathMatch Style.
* BarTime probably used to show how long left till respawn.
Index: addons/sourcemod/scripting/gungame_config.sp
===================================================================
--- addons/sourcemod/scripting/gungame_config.sp (revision 4763)
+++ addons/sourcemod/scripting/gungame_config.sp (revision 5001)
@@ -44,14 +44,15 @@
RegPluginLibrary("gungame_cfg");
return APLRes_Success;
}
-#endif
+#else
// deprecated in 1.3.1
public bool:AskPluginLoad(Handle:myself, bool:late, String:error[], err_max)
{
RegPluginLibrary("gungame_cfg");
return true;
}
+#endif
public OnPluginStart()
{
Index: addons/sourcemod/gamedata/gungame.games.txt
===================================================================
--- addons/sourcemod/gamedata/gungame.games.txt (revision 4763)
+++ addons/sourcemod/gamedata/gungame.games.txt (revision 5001)
@@ -1,31 +1,26 @@
/* Do not edit this file if you do not know what your doing. */
"Games"
{
- "#default"
+ "cstrike"
{
- "#supported"
- {
- "game" "cstrike"
- }
-
"Offsets"
{
"EndMultiplayerGame"
{
- "windows" "102"
- "linux" "103"
+ "windows" "118"
+ "linux" "119"
}
"GetPrimaryAmmoType"
{
- "windows" "289"
- "linux" "290"
+ "windows" "322"
+ "linux" "323"
}
"GetSlot"
{
- "windows" "280"
- "linux" "281"
+ "windows" "313"
+ "linux" "314"
}
}
@@ -34,21 +29,21 @@
"CSWeaponDrop"
{
"library" "server"
- "windows" "\x2A\x2A\x2A\x2A\x2A\x2A\x53\x55\x56\x57\x8B\xBC\x24\x40\x01\x00\x00\x32\xDB\x85\xFF\x8B\xF1\x0F"
+ "windows" "\x81\xEC\x2A\x2A\x2A\x2A\x53\x55\x56\x57\x8B\xBC\x2A\x2A\x2A\x2A\x2A\x32\xDB\x85\xFF\x8B\xF1\x0F"
"linux" "@_ZN9CCSPlayer12CSWeaponDropEP17CBaseCombatWeaponbb"
}
"RemoveAmmo"
{
"library" "server"
- "windows" "\x53\x8B\x5C\x24\x08\x85\xDB\x57\x8B\xF9\x7E\x54\x56\x8B\x74\x24\x14\x56\xE8\x2A\x2A\x2A\x2A\x8B\xC8\xE8\x2A\x2A\x2A\x2A\x83\xF8\xFE\x74\x3C\x8B\x84\xB7\x2A\x2A\x2A\x2A\x8B\x8C\xB7\x2A\x2A\x2A\x2A"
+ "windows" "\x53\x8B\x2A\x2A\x2A\x85\xDB\x56\x8B\xF1\x7E\x2A\x57\x8B\x2A\x2A\x2A\x57\xE8\x2A\x2A\x2A\x2A\x8B\xC8\xE8"
"linux" "@_ZN20CBaseCombatCharacter10RemoveAmmoEii"
}
"UTIL_Remove"
{
"library" "server"
- "windows" "\x8B\x44\x24\x04\x85\xC0\x74\x2A\x05\x2A\x2A\x00\x00\x89\x44\x24\x04\xE9\x2A\xFF\xFF\xFF"
+ "windows" "\x8B\x44\x24\x04\x85\xC0\x74\x2A\x83\x2A\x2A\x89\x2A\x2A\x2A\xE9\x2A\xFF\xFF\xFF"
"linux" "@_Z11UTIL_RemoveP11CBaseEntity"
}
}
|
Given that we didn't switch from GG5 to SM:GG until the new CS version was live, we must have been using 1.0.9.3 -- and the only update we did was to 1.0.9.4. Skimming your diffs, it looks like we might have done this update for the GG_OnWinner event.
So that's a single update that seems to have introduced the issue... we were using SM:GG for plenty of time before updating to 1.0.9.4 for me to say it definitely didn't exist before then. I would blame it on buylevel (the only other thing we changed when adding 1.0.9.4) but many others in this thread aren't using it.
__________________
|
|