Skip to content

Commit 4ce4844

Browse files
committed
Added TF2-specific player score property
1 parent 1fd5cb7 commit 4ce4844

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed
125 Bytes
Binary file not shown.

game/addons/sourcemod/scripting/SourceChatter.sp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ int g_iUserId[MAXPLAYERS+1];
9696
bool g_bNewName[MAXPLAYERS+1] = {false, ...};
9797
bool g_bTalking[MAXPLAYERS+1] = {false, ...};
9898

99+
/* Mod-specific stuff */
100+
char g_sPropScore[32] = "m_iScore";
101+
99102

100103
public Plugin myinfo = {
101104
name = "SourceChatter",
@@ -129,6 +132,7 @@ public APLRes AskPluginLoad2(Handle hMyself, bool bLate, char[] sError, int iErr
129132

130133
public void OnPluginStart(){
131134
LoadTranslations("common.phrases");
135+
SetupModSpecificStuff();
132136
RegisterCvars();
133137
Database.Connect(Callback_OnConnect, "source_chatter");
134138
RegisterCommands();
@@ -145,6 +149,15 @@ public void OnLibraryAdded(const char[] sLibName){
145149
Updater_AddPlugin(UPDATE_URL);
146150
}
147151

152+
/* this function sets up engine-specific properties */
153+
void SetupModSpecificStuff(){
154+
EngineVersion iVersion = GetEngineVersion();
155+
switch(iVersion){
156+
case Engine_TF2:
157+
strcopy(g_sPropScore, sizeof(g_sPropScore), "m_iTotalScore");
158+
}
159+
}
160+
148161
void RegisterCvars(){
149162
CreateConVar("sm_sourcechatter_version", PLUGIN_VERSION, "Current Source Chatter version", FCVAR_NOTIFY|FCVAR_DONTRECORD|FCVAR_SPONLY);
150163

@@ -1021,7 +1034,7 @@ int GetClass(int client){
10211034

10221035
int GetScore(int client){
10231036
if(g_iResource == -1) return 0;
1024-
return GetEntProp(g_iResource, Prop_Send, "m_iTotalScore", _, client);
1037+
return GetEntProp(g_iResource, Prop_Send, g_sPropScore, _, client);
10251038
}
10261039

10271040
int GetPing(int client){

0 commit comments

Comments
 (0)