Added support for CS:GO to cstrike extension (bug 5299, r=asherkin).
1.1 --- a/extensions/cstrike/AMBuilder Sun May 27 16:51:29 2012 -0400
1.2 +++ b/extensions/cstrike/AMBuilder Sat May 26 18:31:23 2012 -0400
1.3 @@ -1,25 +1,28 @@
1.4 # vim: set ts=2 sw=2 tw=99 noet ft=python:
1.5 import os
1.6
1.7 -sdk = SM.sdkInfo['ep2v']
1.8 +sdks = ['ep2v', 'csgo']
1.9
1.10 -if AMBuild.target['platform'] in sdk['platform']:
1.11 - compiler = SM.DefaultHL2Compiler('extensions/cstrike', 'ep2v')
1.12 +for i in sdks:
1.13 + sdk = SM.sdkInfo[i]
1.14 + if AMBuild.target['platform'] in sdk['platform']:
1.15 + compiler = SM.DefaultHL2Compiler('extensions/cstrike', i)
1.16
1.17 - name = 'game.cstrike.ext.' + sdk['ext']
1.18 - extension = AMBuild.AddJob(name)
1.19 - binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler)
1.20 - SM.PreSetupHL2Job(extension, binary, 'ep2v')
1.21 - binary.AddSourceFiles('extensions/cstrike', [
1.22 - 'extension.cpp',
1.23 - 'natives.cpp',
1.24 - 'RegNatives.cpp',
1.25 - 'timeleft.cpp',
1.26 - 'forwards.cpp',
1.27 - 'sdk/smsdk_ext.cpp',
1.28 - 'CDetour/detours.cpp',
1.29 - 'asm/asm.c'
1.30 - ])
1.31 - SM.PostSetupHL2Job(extension, binary, 'ep2v')
1.32 - SM.AutoVersion('extensions/cstrike', binary)
1.33 - binary.SendToJob()
1.34 \ No newline at end of file
1.35 + name = 'game.cstrike.ext.' + sdk['ext']
1.36 + extension = AMBuild.AddJob(name)
1.37 + binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler)
1.38 + SM.PreSetupHL2Job(extension, binary, i)
1.39 + binary.AddSourceFiles('extensions/cstrike', [
1.40 + 'extension.cpp',
1.41 + 'natives.cpp',
1.42 + 'RegNatives.cpp',
1.43 + 'timeleft.cpp',
1.44 + 'forwards.cpp',
1.45 + 'util_cstrike.cpp',
1.46 + 'sdk/smsdk_ext.cpp',
1.47 + 'CDetour/detours.cpp',
1.48 + 'asm/asm.c'
1.49 + ])
1.50 + SM.PostSetupHL2Job(extension, binary, i)
1.51 + SM.AutoVersion('extensions/cstrike', binary)
1.52 + binary.SendToJob()
1.53 \ No newline at end of file
2.1 --- a/extensions/cstrike/extension.cpp Sun May 27 16:51:29 2012 -0400
2.2 +++ b/extensions/cstrike/extension.cpp Sat May 26 18:31:23 2012 -0400
2.3 @@ -59,9 +59,9 @@
2.4
2.5 bool CStrike::SDK_OnLoad(char *error, size_t maxlength, bool late)
2.6 {
2.7 - if (strcmp(g_pSM->GetGameFolderName(), "cstrike") != 0)
2.8 + if (strcmp(g_pSM->GetGameFolderName(), "cstrike") != 0 && strcmp(g_pSM->GetGameFolderName(), "csgo") != 0)
2.9 {
2.10 - snprintf(error, maxlength, "Cannot Load Cstrike Extension on mods other than CS:S");
2.11 + snprintf(error, maxlength, "Cannot Load Cstrike Extension on mods other than CS:S and CS:GO");
2.12 return false;
2.13 }
2.14
2.15 @@ -73,7 +73,7 @@
2.16 {
2.17 if (error)
2.18 {
2.19 - snprintf(error, maxlength, "Could not read sm-cstrike.games.txt: %s", conf_error);
2.20 + snprintf(error, maxlength, "Could not read sm-cstrike.games: %s", conf_error);
2.21 }
2.22 return false;
2.23 }
3.1 --- a/extensions/cstrike/extension.h Sun May 27 16:51:29 2012 -0400
3.2 +++ b/extensions/cstrike/extension.h Sat May 26 18:31:23 2012 -0400
3.3 @@ -44,12 +44,22 @@
3.4
3.5 int CallPriceForward(int client, const char *weapon_name, int price);
3.6
3.7 +#if SOURCE_ENGINE == SE_CSGO
3.8 +#define WEAPON_C4 49
3.9 +#define WEAPON_KNIFE 42
3.10 +#define WEAPON_KNIFE_GG 41
3.11 +#define WEAPON_KEVLAR 50
3.12 +#define WEAPON_ASSAULTSUIT 51
3.13 +#define WEAPON_NIGHTVISION 52
3.14 +#define WEAPON_DEFUSER 53
3.15 +#else
3.16 #define WEAPON_C4 6
3.17 #define WEAPON_KNIFE 28
3.18 #define WEAPON_SHIELD 30
3.19 #define WEAPON_KEVLAR 31
3.20 #define WEAPON_ASSAULTSUIT 32
3.21 #define WEAPON_NIGHTVISION 33
3.22 +#endif
3.23
3.24 /**
3.25 * @brief Sample implementation of the SDK Extension.
4.1 --- a/extensions/cstrike/forwards.cpp Sun May 27 16:51:29 2012 -0400
4.2 +++ b/extensions/cstrike/forwards.cpp Sat May 26 18:31:23 2012 -0400
4.3 @@ -1,5 +1,6 @@
4.4 #include "extension.h"
4.5 #include "forwards.h"
4.6 +#include "util_cstrike.h"
4.7
4.8 bool g_pTerminateRoundDetoured = false;
4.9 bool g_pCSWeaponDropDetoured = false;
4.10 @@ -37,11 +38,27 @@
4.11 lastclient = -1;
4.12 return 0;
4.13 }
4.14 +
4.15 +#if SOURCE_ENGINE == SE_CSGO
4.16 + int defaultprice = -1;
4.17 + if (g_iPriceOffset != -1 && g_PriceDetoured)
4.18 + {
4.19 + defaultprice = CallPriceForwardCSGO(client, weapon);
4.20 + }
4.21 +#endif
4.22 +
4.23 int val = DETOUR_MEMBER_CALL(DetourHandleBuy)(weapon);
4.24 +
4.25 +#if SOURCE_ENGINE == SE_CSGO
4.26 + if (defaultprice != -1)
4.27 + SetWeaponPrice(weapon, defaultprice);
4.28 +#endif
4.29 +
4.30 lastclient = -1;
4.31 return val;
4.32 }
4.33
4.34 +#if SOURCE_ENGINE != SE_CSGO
4.35 DETOUR_DECL_MEMBER0(DetourWeaponPrice, int)
4.36 {
4.37 int price = DETOUR_MEMBER_CALL(DetourWeaponPrice)();
4.38 @@ -53,6 +70,7 @@
4.39
4.40 return CallPriceForward(lastclient, weapon_name, price);
4.41 }
4.42 +#endif
4.43
4.44 DETOUR_DECL_MEMBER2(DetourTerminateRound, void, float, delay, int, reason)
4.45 {
4.46 @@ -79,6 +97,7 @@
4.47
4.48 return DETOUR_MEMBER_CALL(DetourTerminateRound)(orgdelay, orgreason);
4.49 }
4.50 +
4.51 DETOUR_DECL_MEMBER3(DetourCSWeaponDrop, void, CBaseEntity *, weapon, bool, something, bool, toss)
4.52 {
4.53 if (g_pIgnoreCSWeaponDropDetour)
4.54 @@ -102,6 +121,7 @@
4.55
4.56 return;
4.57 }
4.58 +
4.59 bool CreateWeaponPriceDetour()
4.60 {
4.61 if (weaponNameOffset == -1)
4.62 @@ -112,6 +132,29 @@
4.63 return false;
4.64 }
4.65 }
4.66 +
4.67 +#if SOURCE_ENGINE == SE_CSGO
4.68 + if (g_iPriceOffset == -1)
4.69 + {
4.70 + if (!g_pGameConf->GetOffset("WeaponPrice", &g_iPriceOffset))
4.71 + {
4.72 + g_iPriceOffset = -1;
4.73 + g_pSM->LogError(myself, "Failed to get WeaponPrice offset - Disabled OnGetWeaponPrice forward");
4.74 + return false;
4.75 + }
4.76 + }
4.77 + if (!CreateHandleBuyDetour())
4.78 + {
4.79 + g_pSM->LogError(myself, "HandleCommand_Buy_Internal failed to detour, disabled OnGetWeaponPrice forward.");
4.80 + return false;
4.81 + }
4.82 + else
4.83 + {
4.84 + g_PriceDetoured = true;
4.85 + return true;
4.86 + }
4.87 +#else
4.88 +
4.89 DWeaponPrice = DETOUR_CREATE_MEMBER(DetourWeaponPrice, "GetWeaponPrice");
4.90
4.91 if (DWeaponPrice != NULL)
4.92 @@ -129,6 +172,7 @@
4.93 g_pSM->LogError(myself, "GetWeaponPrice detour could not be initialized - Disabled OnGetWeaponPrice forward.");
4.94
4.95 return false;
4.96 +#endif
4.97 }
4.98
4.99 bool CreateTerminateRoundDetour()
4.100 @@ -179,13 +223,14 @@
4.101
4.102 void RemoveWeaponPriceDetour()
4.103 {
4.104 +#if SOURCE_ENGINE != SE_CSGO
4.105 if (DWeaponPrice != NULL)
4.106 {
4.107 DWeaponPrice->Destroy();
4.108 DWeaponPrice = NULL;
4.109 }
4.110 g_PriceDetoured = false;
4.111 -
4.112 +#endif
4.113 }
4.114
4.115 void RemoveHandleBuyDetour()
4.116 @@ -220,6 +265,85 @@
4.117 }
4.118 g_pCSWeaponDropDetoured = false;
4.119 }
4.120 +
4.121 +#if SOURCE_ENGINE == SE_CSGO
4.122 +bool SetWeaponPrice(int weaponID, int price)
4.123 +{
4.124 + void *info = GetWeaponInfo(weaponID);
4.125 + if (!info)
4.126 + {
4.127 + return false;
4.128 + }
4.129 + *(int *)((intptr_t)info+g_iPriceOffset) = price;
4.130 + return true;
4.131 +}
4.132 +
4.133 +bool SetWeaponPrice(const char *weapon, int price)
4.134 +{
4.135 + const char *weaponalias = GetTranslatedWeaponAlias(weapon);
4.136 + int weaponID = AliasToWeaponID(weaponalias);
4.137 + if (weaponID <= 0)
4.138 + {
4.139 + return false;
4.140 + }
4.141 + void *info = GetWeaponInfo(weaponID);
4.142 + if (!info)
4.143 + {
4.144 + return false;
4.145 + }
4.146 + *(int *)((intptr_t)info+g_iPriceOffset) = price;
4.147 + return true;
4.148 +
4.149 +}
4.150 +
4.151 +int CallPriceForwardCSGO(int client, const char *weapon, int price)
4.152 +{
4.153 + int changedprice = price;
4.154 + cell_t result = Pl_Continue;
4.155 +
4.156 + g_pPriceForward->PushCell(client);
4.157 + g_pPriceForward->PushString(weapon);
4.158 + g_pPriceForward->PushCellByRef(&changedprice);
4.159 + g_pPriceForward->Execute(&result);
4.160 +
4.161 + if (result == Pl_Continue)
4.162 + return price;
4.163 +
4.164 + return changedprice;
4.165 +}
4.166 +
4.167 +int CallPriceForwardCSGO(int client, const char *weapon)
4.168 +{
4.169 + const char *weaponalias = GetTranslatedWeaponAlias(weapon);
4.170 + int weaponID = AliasToWeaponID(weaponalias);
4.171 + if (weaponID <= 0)
4.172 + {
4.173 + return -1;
4.174 + }
4.175 + void *info = GetWeaponInfo(weaponID);
4.176 + if (!info)
4.177 + {
4.178 + return -1;
4.179 + }
4.180 + const char *weapon_name = (const char *)((intptr_t)info + weaponNameOffset);
4.181 + int price = *(int *)((intptr_t)info + g_iPriceOffset);
4.182 + int changedprice = price;
4.183 + cell_t result = Pl_Continue;
4.184 +
4.185 + g_pPriceForward->PushCell(client);
4.186 + g_pPriceForward->PushString(weapon_name);
4.187 + g_pPriceForward->PushCellByRef(&changedprice);
4.188 + g_pPriceForward->Execute(&result);
4.189 +
4.190 + if (result == Pl_Continue)
4.191 + return -1;
4.192 + if (SetWeaponPrice(weaponID, changedprice))
4.193 + return price;
4.194 + else
4.195 + return -1;
4.196 +}
4.197 +#else
4.198 +
4.199 int CallPriceForward(int client, const char *weapon_name, int price)
4.200 {
4.201 int changedprice = price;
4.202 @@ -236,3 +360,4 @@
4.203
4.204 return changedprice;
4.205 }
4.206 +#endif
5.1 --- a/extensions/cstrike/forwards.h Sun May 27 16:51:29 2012 -0400
5.2 +++ b/extensions/cstrike/forwards.h Sat May 26 18:31:23 2012 -0400
5.3 @@ -9,9 +9,17 @@
5.4 void RemoveTerminateRoundDetour();
5.5 void RemoveCSWeaponDropDetour();
5.6
5.7 +#if SOURCE_ENGINE == SE_CSGO
5.8 +bool SetWeaponPrice(int weaponID, int price);
5.9 +bool SetWeaponPrice(const char *weapon, int price);
5.10 +int CallPriceForwardCSGO(int client, const char *weapon);
5.11 +int CallPriceForwardCSGO(int client, const char *weapon, int price);
5.12 +#endif
5.13 +
5.14 extern IServerGameEnts *gameents;
5.15 extern IForward *g_pHandleBuyForward;
5.16 extern IForward *g_pPriceForward;
5.17 extern IForward *g_pTerminateRoundForward;
5.18 extern IForward *g_pCSWeaponDropForward;
5.19 +extern int g_iPriceOffset;
5.20 #endif //_INCLUDE_CSTRIKE_FORWARDS_H_
6.1 --- a/extensions/cstrike/msvc10/cstrike.vcxproj Sun May 27 16:51:29 2012 -0400
6.2 +++ b/extensions/cstrike/msvc10/cstrike.vcxproj Sat May 26 18:31:23 2012 -0400
6.3 @@ -476,6 +476,7 @@
6.4 <ClCompile Include="..\natives.cpp" />
6.5 <ClCompile Include="..\RegNatives.cpp" />
6.6 <ClCompile Include="..\timeleft.cpp" />
6.7 + <ClCompile Include="..\util_cstrike.cpp" />
6.8 <ClCompile Include="..\sdk\smsdk_ext.cpp" />
6.9 <ClCompile Include="..\asm\asm.c" />
6.10 <ClCompile Include="..\CDetour\detours.cpp" />
6.11 @@ -485,6 +486,7 @@
6.12 <ClInclude Include="..\forwards.h" />
6.13 <ClInclude Include="..\RegNatives.h" />
6.14 <ClInclude Include="..\timeleft.h" />
6.15 + <ClInclude Include="..\util_cstrike.h" />
6.16 <ClInclude Include="..\sdk\smsdk_config.h" />
6.17 <ClInclude Include="..\sdk\smsdk_ext.h" />
6.18 <ClInclude Include="..\asm\asm.h" />
7.1 --- a/extensions/cstrike/msvc10/cstrike.vcxproj.filters Sun May 27 16:51:29 2012 -0400
7.2 +++ b/extensions/cstrike/msvc10/cstrike.vcxproj.filters Sat May 26 18:31:23 2012 -0400
7.3 @@ -39,6 +39,9 @@
7.4 <ClCompile Include="..\timeleft.cpp">
7.5 <Filter>Source Files</Filter>
7.6 </ClCompile>
7.7 + <ClCompile Include="..\util_cstrike.cpp">
7.8 + <Filter>Source Files</Filter>
7.9 + </ClCompile>
7.10 <ClCompile Include="..\sdk\smsdk_ext.cpp">
7.11 <Filter>SourceMod SDK</Filter>
7.12 </ClCompile>
7.13 @@ -62,6 +65,9 @@
7.14 <ClInclude Include="..\timeleft.h">
7.15 <Filter>Header Files</Filter>
7.16 </ClInclude>
7.17 + <ClInclude Include="..\util_cstrike.h">
7.18 + <Filter>Header Files</Filter>
7.19 + </ClInclude>
7.20 <ClInclude Include="..\sdk\smsdk_config.h">
7.21 <Filter>SourceMod SDK</Filter>
7.22 </ClInclude>
8.1 --- a/extensions/cstrike/msvc9/cstrike.vcproj Sun May 27 16:51:29 2012 -0400
8.2 +++ b/extensions/cstrike/msvc9/cstrike.vcproj Sat May 26 18:31:23 2012 -0400
8.3 @@ -537,7 +537,7 @@
8.4 Name="VCCLCompilerTool"
8.5 AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_ORANGEBOXVALVE=6 /D SE_LEFT4DEAD=7 /D SE_LEFT4DEAD2=8 /D SE_ALIENSWARM=9 /D SE_PORTAL2=10 /D SE_CSGO=11 /D COMPILER_MSVC /D COMPILER_MSVC32"
8.6 Optimization="0"
8.7 - AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn;..\..\..\public\extensions;"$(HL2SDK-CSGO)\public";"$(HL2SDK-CSGO)\public\game\server";"$(HL2SDK-CSGO)\public\engine";"$(HL2SDK-CSGO)\public\tier0";"$(HL2SDK-CSGO)\public\tier1";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
8.8 + AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn;..\..\..\public\extensions;"$(HL2SDKCSGO)\public";"$(HL2SDKCSGO)\public\game\server";"$(HL2SDKCSGO)\public\engine";"$(HL2SDKCSGO)\public\tier0";"$(HL2SDKCSGO)\public\tier1";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
8.9 PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;CSTRIKE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=11"
8.10 MinimalRebuild="true"
8.11 BasicRuntimeChecks="3"
8.12 @@ -561,7 +561,7 @@
8.13 />
8.14 <Tool
8.15 Name="VCLinkerTool"
8.16 - AdditionalDependencies=""$(HL2SDK-CSGO)\lib\public\tier0.lib" "$(HL2SDK-CSGO)\lib\public\tier1.lib" "$(HL2SDK-CSGO)\lib\public\interfaces.lib""
8.17 + AdditionalDependencies=""$(HL2SDKCSGO)\lib\public\tier0.lib" "$(HL2SDKCSGO)\lib\public\tier1.lib" "$(HL2SDKCSGO)\lib\public\interfaces.lib""
8.18 OutputFile="$(OutDir)\game.cstrike.ext.2.csgo.dll"
8.19 LinkIncremental="2"
8.20 IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
8.21 @@ -620,7 +620,7 @@
8.22 Name="VCCLCompilerTool"
8.23 AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_ORANGEBOXVALVE=6 /D SE_LEFT4DEAD=7 /D SE_LEFT4DEAD2=8 /D SE_ALIENSWARM=9 /D SE_PORTAL2=10 /D SE_CSGO=11 /D COMPILER_MSVC /D COMPILER_MSVC32"
8.24 FavorSizeOrSpeed="1"
8.25 - AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn;..\..\..\public\extensions;"$(HL2SDK-CSGO)\public";"$(HL2SDK-CSGO)\public\game\server";"$(HL2SDK-CSGO)\public\engine";"$(HL2SDK-CSGO)\public\tier0";"$(HL2SDK-CSGO)\public\tier1";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
8.26 + AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn;..\..\..\public\extensions;"$(HL2SDKCSGO)\public";"$(HL2SDKCSGO)\public\game\server";"$(HL2SDKCSGO)\public\engine";"$(HL2SDKCSGO)\public\tier0";"$(HL2SDKCSGO)\public\tier1";"$(MMSOURCE18)\core";"$(MMSOURCE18)\core\sourcehook""
8.27 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;CSTRIKE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=11"
8.28 RuntimeLibrary="0"
8.29 EnableEnhancedInstructionSet="0"
8.30 @@ -642,7 +642,7 @@
8.31 />
8.32 <Tool
8.33 Name="VCLinkerTool"
8.34 - AdditionalDependencies=""$(HL2SDK-CSGO)\lib\public\tier0.lib" "$(HL2SDK-CSGO)\lib\public\tier1.lib" "$(HL2SDK-CSGO)\lib\public\interfaces.lib""
8.35 + AdditionalDependencies=""$(HL2SDKCSGO)\lib\public\tier0.lib" "$(HL2SDKCSGO)\lib\public\tier1.lib" "$(HL2SDKCSGO)\lib\public\interfaces.lib""
8.36 OutputFile="$(OutDir)\game.cstrike.ext.2.csgo.dll"
8.37 LinkIncremental="1"
8.38 IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMTD"
8.39 @@ -870,6 +870,10 @@
8.40 RelativePath="..\timeleft.cpp"
8.41 >
8.42 </File>
8.43 + <File
8.44 + RelativePath="..\util_cstrike.cpp"
8.45 + >
8.46 + </File>
8.47 </Filter>
8.48 <Filter
8.49 Name="Header Files"
8.50 @@ -892,6 +896,10 @@
8.51 RelativePath="..\timeleft.h"
8.52 >
8.53 </File>
8.54 + <File
8.55 + RelativePath="..\util_cstrike.h"
8.56 + >
8.57 + </File>
8.58 </Filter>
8.59 <Filter
8.60 Name="Resource Files"
9.1 --- a/extensions/cstrike/natives.cpp Sun May 27 16:51:29 2012 -0400
9.2 +++ b/extensions/cstrike/natives.cpp Sat May 26 18:31:23 2012 -0400
9.3 @@ -31,8 +31,12 @@
9.4
9.5 #include "extension.h"
9.6 #include "RegNatives.h"
9.7 +#include "forwards.h"
9.8 +#include "util_cstrike.h"
9.9 #include <server_class.h>
9.10
9.11 +int g_iPriceOffset = -1;
9.12 +
9.13 #define REGISTER_NATIVE_ADDR(name, code) \
9.14 void *addr; \
9.15 if (!g_pGameConf->GetMemSig(name, &addr) || !addr) \
9.16 @@ -44,7 +48,7 @@
9.17
9.18 inline CBaseEntity *GetCBaseEntity(int num, bool isplayer)
9.19 {
9.20 - edict_t *pEdict = engine->PEntityOfEntIndex(num);
9.21 + edict_t *pEdict = gamehelpers->EdictOfIndex(num);
9.22 if (!pEdict || pEdict->IsFree())
9.23 {
9.24 return NULL;
9.25 @@ -292,35 +296,13 @@
9.26
9.27 static cell_t CS_GetTranslatedWeaponAlias(IPluginContext *pContext, const cell_t *params)
9.28 {
9.29 - static ICallWrapper *pWrapper = NULL;
9.30 -
9.31 - if (!pWrapper)
9.32 - {
9.33 - REGISTER_NATIVE_ADDR("GetTranslatedWeaponAlias",
9.34 - PassInfo pass[1]; \
9.35 - PassInfo retpass[1]; \
9.36 - pass[0].flags = PASSFLAG_BYVAL; \
9.37 - pass[0].type = PassType_Basic; \
9.38 - pass[0].size = sizeof(char *); \
9.39 - retpass[0].flags = PASSFLAG_BYVAL; \
9.40 - retpass[0].type = PassType_Basic; \
9.41 - retpass[0].size = sizeof(char *); \
9.42 - pWrapper = g_pBinTools->CreateCall(addr, CallConv_Cdecl, &retpass[0], pass, 1))
9.43 - }
9.44 - char *dest, *weapon;
9.45 + char *weapon;
9.46 + char *dest;
9.47
9.48 pContext->LocalToString(params[2], &dest);
9.49 pContext->LocalToString(params[1], &weapon);
9.50
9.51 - char *ret = new char[128];
9.52 -
9.53 - unsigned char vstk[sizeof(char *)];
9.54 - unsigned char *vptr = vstk;
9.55 -
9.56 - *(char **)vptr = weapon;
9.57 -
9.58 - pWrapper->Execute(vstk, &ret);
9.59 -
9.60 + const char *ret = GetTranslatedWeaponAlias(weapon);
9.61 strncopy(dest, ret, params[3]);
9.62
9.63 return 1;
9.64 @@ -329,34 +311,31 @@
9.65 static cell_t CS_GetWeaponPrice(IPluginContext *pContext, const cell_t *params)
9.66 {
9.67 //Hard code return values for weapons that dont call GetWeaponPrice and always use default value.
9.68 - if (params[2] == WEAPON_C4 || params[2] == WEAPON_KNIFE || params[2] == WEAPON_SHIELD)
9.69 + int id = GetRealWeaponID(params[2]);
9.70 +#if SOURCE_ENGINE == SE_CSGO
9.71 + if (id == WEAPON_C4 || id == WEAPON_KNIFE || id == WEAPON_KNIFE_GG)
9.72 +#else
9.73 + if (id == WEAPON_C4 || id == WEAPON_KNIFE || id == WEAPON_SHIELD)
9.74 +#endif
9.75 return 0;
9.76 - if (params[2] == WEAPON_KEVLAR)
9.77 + if (id == WEAPON_KEVLAR)
9.78 return 650;
9.79 - if (params[2] == WEAPON_ASSAULTSUIT)
9.80 + if (id == WEAPON_ASSAULTSUIT)
9.81 return 1000;
9.82 - if (params[2] == WEAPON_NIGHTVISION)
9.83 + if (id == WEAPON_NIGHTVISION)
9.84 return 1250;
9.85 +#if SOURCE_ENGINE == SE_CSGO
9.86 + if (id == WEAPON_DEFUSER)
9.87 + return 200;
9.88 +#endif
9.89 + if (id == 0)
9.90 + return 0;
9.91
9.92 - static ICallWrapper *pWrapper = NULL;
9.93 - static int priceOffset = -1;
9.94 - if (!pWrapper)
9.95 + if (g_iPriceOffset == -1)
9.96 {
9.97 - REGISTER_NATIVE_ADDR("GetWeaponInfo",
9.98 - PassInfo pass[1]; \
9.99 - PassInfo retpass[1]; \
9.100 - pass[0].flags = PASSFLAG_BYVAL; \
9.101 - pass[0].type = PassType_Basic; \
9.102 - pass[0].size = sizeof(int); \
9.103 - retpass[0].flags = PASSFLAG_BYVAL; \
9.104 - retpass[0].type = PassType_Basic; \
9.105 - retpass[0].size = sizeof(void *); \
9.106 - pWrapper = g_pBinTools->CreateCall(addr, CallConv_Cdecl, &retpass[0], pass, 1))
9.107 - }
9.108 - if (priceOffset == -1)
9.109 - {
9.110 - if (!g_pGameConf->GetOffset("WeaponPrice", &priceOffset))
9.111 + if (!g_pGameConf->GetOffset("WeaponPrice", &g_iPriceOffset))
9.112 {
9.113 + g_iPriceOffset = -1;
9.114 return pContext->ThrowNativeError("Failed to get WeaponPrice offset");
9.115 }
9.116 }
9.117 @@ -367,30 +346,31 @@
9.118 return pContext->ThrowNativeError("Client index %d is not valid", params[1]);
9.119 }
9.120
9.121 - void *info;
9.122 -
9.123 - unsigned char vstk[sizeof(int)];
9.124 - unsigned char *vptr = vstk;
9.125 -
9.126 - *(int *)vptr = params[2];
9.127 -
9.128 - pWrapper->Execute(vstk, &info);
9.129 -
9.130 + void *info = GetWeaponInfo(params[2]);
9.131 if (!info)
9.132 return pContext->ThrowNativeError("Failed to get weaponinfo");
9.133
9.134 - int price = *(int *)((intptr_t)info + priceOffset);
9.135 + int price = *(int *)((intptr_t)info + g_iPriceOffset);
9.136
9.137 if (params[3] || weaponNameOffset == -1)
9.138 return price;
9.139
9.140 const char *weapon_name = (const char *)((intptr_t)info + weaponNameOffset);
9.141
9.142 +#if SOURCE_ENGINE == SE_CSGO
9.143 + return CallPriceForwardCSGO(params[1], weapon_name, price);
9.144 +#else
9.145 return CallPriceForward(params[1], weapon_name, price);
9.146 +#endif
9.147 }
9.148
9.149 static cell_t CS_GetClientClanTag(IPluginContext *pContext, const cell_t *params)
9.150 {
9.151 +#if SOURCE_ENGINE == SE_CSGO
9.152 + size_t len;
9.153 + pContext->StringToLocalUTF8(params[2], params[3], "", &len);
9.154 + return len;
9.155 +#else
9.156 static void *addr;
9.157 if (!addr)
9.158 {
9.159 @@ -426,10 +406,14 @@
9.160 pContext->StringToLocalUTF8(params[2], params[3], src, &len);
9.161
9.162 return len;
9.163 +#endif
9.164 }
9.165
9.166 static cell_t CS_SetClientClanTag(IPluginContext *pContext, const cell_t *params)
9.167 {
9.168 +#if SOURCE_ENGINE == SE_CSGO
9.169 + return 0;
9.170 +#else
9.171 static ICallWrapper *pWrapper = NULL;
9.172
9.173 if (!pWrapper)
9.174 @@ -464,6 +448,16 @@
9.175 pWrapper->Execute(vstk, NULL);
9.176
9.177 return 1;
9.178 +#endif
9.179 +}
9.180 +
9.181 +static cell_t CS_AliasToWeaponID(IPluginContext *pContext, const cell_t *params)
9.182 +{
9.183 + char *weapon;
9.184 +
9.185 + pContext->LocalToString(params[1], &weapon);
9.186 +
9.187 + return GetFakeWeaponID(AliasToWeaponID(weapon));
9.188 }
9.189
9.190 sp_nativeinfo_t g_CSNatives[] =
9.191 @@ -476,6 +470,7 @@
9.192 {"CS_GetWeaponPrice", CS_GetWeaponPrice},
9.193 {"CS_GetClientClanTag", CS_GetClientClanTag},
9.194 {"CS_SetClientClanTag", CS_SetClientClanTag},
9.195 + {"CS_AliasToWeaponID", CS_AliasToWeaponID},
9.196 {NULL, NULL}
9.197 };
9.198
10.1 --- a/extensions/cstrike/sdk/smsdk_config.h Sun May 27 16:51:29 2012 -0400
10.2 +++ b/extensions/cstrike/sdk/smsdk_config.h Sat May 26 18:31:23 2012 -0400
10.3 @@ -38,8 +38,8 @@
10.4 */
10.5
10.6 /* Basic information exposed publicly */
10.7 -#define SMEXT_CONF_NAME "CS:S Tools"
10.8 -#define SMEXT_CONF_DESCRIPTION "CS:S extended functionality"
10.9 +#define SMEXT_CONF_NAME "CS Tools"
10.10 +#define SMEXT_CONF_DESCRIPTION "CS extended functionality"
10.11 #define SMEXT_CONF_VERSION ""
10.12 #define SMEXT_CONF_AUTHOR "AlliedModders LLC"
10.13 #define SMEXT_CONF_URL "http://www.sourcemod.net/"
11.1 --- a/extensions/cstrike/timeleft.h Sun May 27 16:51:29 2012 -0400
11.2 +++ b/extensions/cstrike/timeleft.h Sat May 26 18:31:23 2012 -0400
11.3 @@ -40,6 +40,9 @@
11.4 public:
11.5 bool LevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background);
11.6 virtual void FireGameEvent(IGameEvent *event);
11.7 +#if SOURCE_ENGINE >= SE_ALIENSWARM
11.8 + virtual int GetEventDebugID( void ) { return 42; }
11.9 +#endif
11.10 };
11.11
11.12 extern TimeLeftEvents g_TimeLeftEvents;
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/extensions/cstrike/util_cstrike.cpp Sat May 26 18:31:23 2012 -0400
12.3 @@ -0,0 +1,379 @@
12.4 +/**
12.5 + * vim: set ts=4 :
12.6 + * =============================================================================
12.7 + * SourceMod Counter-Strike:Source Extension
12.8 + * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
12.9 + * =============================================================================
12.10 + *
12.11 + * This program is free software; you can redistribute it and/or modify it under
12.12 + * the terms of the GNU General Public License, version 3.0, as published by the
12.13 + * Free Software Foundation.
12.14 + *
12.15 + * This program is distributed in the hope that it will be useful, but WITHOUT
12.16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12.17 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12.18 + * details.
12.19 + *
12.20 + * You should have received a copy of the GNU General Public License along with
12.21 + * this program. If not, see <http://www.gnu.org/licenses/>.
12.22 + *
12.23 + * As a special exception, AlliedModders LLC gives you permission to link the
12.24 + * code of this program (as well as its derivative works) to "Half-Life 2," the
12.25 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
12.26 + * by the Valve Corporation. You must obey the GNU General Public License in
12.27 + * all respects for all other code used. Additionally, AlliedModders LLC grants
12.28 + * this exception to all derivative works. AlliedModders LLC defines further
12.29 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
12.30 + * or <http://www.sourcemod.net/license.php>.
12.31 + *
12.32 + * Version: $Id$
12.33 + */
12.34 +
12.35 +#include "util_cstrike.h"
12.36 +
12.37 +#include "extension.h"
12.38 +#include "RegNatives.h"
12.39 +
12.40 +#define REGISTER_ADDR(name, defaultret, code) \
12.41 + void *addr; \
12.42 + if (!g_pGameConf->GetMemSig(name, &addr) || !addr) \
12.43 + { \
12.44 + g_pSM->LogError(myself, "Failed to locate function."); \
12.45 + return defaultret; \
12.46 + } \
12.47 + code; \
12.48 + g_RegNatives.Register(pWrapper);
12.49 +
12.50 +void *GetWeaponInfo(int weaponID)
12.51 +{
12.52 + static ICallWrapper *pWrapper = NULL;
12.53 + if (!pWrapper)
12.54 + {
12.55 + REGISTER_ADDR("GetWeaponInfo", NULL,
12.56 + PassInfo pass[1]; \
12.57 + PassInfo retpass; \
12.58 + pass[0].flags = PASSFLAG_BYVAL; \
12.59 + pass[0].type = PassType_Basic; \
12.60 + pass[0].size = sizeof(int); \
12.61 + retpass.flags = PASSFLAG_BYVAL; \
12.62 + retpass.type = PassType_Basic; \
12.63 + retpass.size = sizeof(void *); \
12.64 + pWrapper = g_pBinTools->CreateCall(addr, CallConv_Cdecl, &retpass, pass, 1))
12.65 + }
12.66 +
12.67 + void *info;
12.68 +
12.69 + unsigned char vstk[sizeof(int)];
12.70 + unsigned char *vptr = vstk;
12.71 +
12.72 + *(int *)vptr = weaponID;
12.73 +
12.74 + pWrapper->Execute(vstk, &info);
12.75 +
12.76 + return info;
12.77 +}
12.78 +
12.79 +const char *GetTranslatedWeaponAlias(const char *weapon)
12.80 +{
12.81 + static ICallWrapper *pWrapper = NULL;
12.82 +
12.83 + if (!pWrapper)
12.84 + {
12.85 + REGISTER_ADDR("GetTranslatedWeaponAlias", weapon,
12.86 + PassInfo pass[1]; \
12.87 + PassInfo retpass; \
12.88 + pass[0].flags = PASSFLAG_BYVAL; \
12.89 + pass[0].type = PassType_Basic; \
12.90 + pass[0].size = sizeof(const char *); \
12.91 + retpass.flags = PASSFLAG_BYVAL; \
12.92 + retpass.type = PassType_Basic; \
12.93 + retpass.size = sizeof(const char *); \
12.94 + pWrapper = g_pBinTools->CreateCall(addr, CallConv_Cdecl, &retpass, pass, 1))
12.95 + }
12.96 + const char *ret = new char[128];
12.97 +
12.98 + unsigned char vstk[sizeof(const char *)];
12.99 + unsigned char *vptr = vstk;
12.100 +
12.101 + *(const char **)vptr = weapon;
12.102 +
12.103 + pWrapper->Execute(vstk, &ret);
12.104 +
12.105 + return ret;
12.106 +}
12.107 +
12.108 +int AliasToWeaponID(const char *weapon)
12.109 +{
12.110 + static ICallWrapper *pWrapper = NULL;
12.111 +
12.112 + if (!pWrapper)
12.113 + {
12.114 + REGISTER_ADDR("AliasToWeaponID", 0,
12.115 + PassInfo pass[1]; \
12.116 + PassInfo retpass; \
12.117 + pass[0].flags = PASSFLAG_BYVAL; \
12.118 + pass[0].type = PassType_Basic; \
12.119 + pass[0].size = sizeof(const char *); \
12.120 + retpass.flags = PASSFLAG_BYVAL; \
12.121 + retpass.type = PassType_Basic; \
12.122 + retpass.size = sizeof(int); \
12.123 + pWrapper = g_pBinTools->CreateCall(addr, CallConv_Cdecl, &retpass, pass, 1))
12.124 + }
12.125 + int weaponID = 0;
12.126 +
12.127 + unsigned char vstk[sizeof(const char *)];
12.128 + unsigned char *vptr = vstk;
12.129 +
12.130 + *(const char **)vptr = weapon;
12.131 +
12.132 + pWrapper->Execute(vstk, &weaponID);
12.133 +
12.134 + return weaponID;
12.135 +}
12.136 +int GetRealWeaponID(int weaponId)
12.137 +{
12.138 +#if SOURCE_ENGINE == SE_CSGO
12.139 + switch((SMCSWeapon)weaponId)
12.140 + {
12.141 + case SMCSWeapon_NONE:
12.142 + return (int)CSGOWeapon_NONE;
12.143 + case SMCSWeapon_DEAGLE:
12.144 + return (int)CSGOWeapon_DEAGLE;
12.145 + case SMCSWeapon_ELITE:
12.146 + return (int)CSGOWeapon_ELITE;
12.147 + case SMCSWeapon_FIVESEVEN:
12.148 + return (int)CSGOWeapon_FIVESEVEN;
12.149 + case SMCSWeapon_GLOCK:
12.150 + return (int)CSGOWeapon_GLOCK;
12.151 + case SMCSWeapon_P228:
12.152 + return (int)CSGOWeapon_P228;
12.153 + case SMCSWeapon_USP:
12.154 + return (int)CSGOWeapon_USP;
12.155 + case SMCSWeapon_AK47:
12.156 + return (int)CSGOWeapon_AK47;
12.157 + case SMCSWeapon_AUG:
12.158 + return (int)CSGOWeapon_AUG;
12.159 + case SMCSWeapon_AWP:
12.160 + return (int)CSGOWeapon_AWP;
12.161 + case SMCSWeapon_FAMAS:
12.162 + return (int)CSGOWeapon_FAMAS;
12.163 + case SMCSWeapon_G3SG1:
12.164 + return (int)CSGOWeapon_G3SG1;
12.165 + case SMCSWeapon_GALIL:
12.166 + return (int)CSGOWeapon_GALIL;
12.167 + case SMCSWeapon_GALILAR:
12.168 + return (int)CSGOWeapon_GALILAR;
12.169 + case SMCSWeapon_M249:
12.170 + return (int)CSGOWeapon_M249;
12.171 + case SMCSWeapon_M3:
12.172 + return (int)CSGOWeapon_M3;
12.173 + case SMCSWeapon_M4A1:
12.174 + return (int)CSGOWeapon_M4A1;
12.175 + case SMCSWeapon_MAC10:
12.176 + return (int)CSGOWeapon_MAC10;
12.177 + case SMCSWeapon_MP5NAVY:
12.178 + return (int)CSGOWeapon_MP5NAVY;
12.179 + case SMCSWeapon_P90:
12.180 + return (int)CSGOWeapon_P90;
12.181 + case SMCSWeapon_SCOUT:
12.182 + return (int)CSGOWeapon_SCOUT;
12.183 + case SMCSWeapon_SG550:
12.184 + return (int)CSGOWeapon_SG550;
12.185 + case SMCSWeapon_SG552:
12.186 + return (int)CSGOWeapon_SG552;
12.187 + case SMCSWeapon_TMP:
12.188 + return (int)CSGOWeapon_TMP;
12.189 + case SMCSWeapon_UMP45:
12.190 + return (int)CSGOWeapon_UMP45;
12.191 + case SMCSWeapon_XM1014:
12.192 + return (int)CSGOWeapon_XM1014;
12.193 + case SMCSWeapon_BIZON:
12.194 + return (int)CSGOWeapon_BIZON;
12.195 + case SMCSWeapon_MAG7:
12.196 + return (int)CSGOWeapon_MAG7;
12.197 + case SMCSWeapon_NEGEV:
12.198 + return (int)CSGOWeapon_NEGEV;
12.199 + case SMCSWeapon_SAWEDOFF:
12.200 + return (int)CSGOWeapon_SAWEDOFF;
12.201 + case SMCSWeapon_TEC9:
12.202 + return (int)CSGOWeapon_TEC9;
12.203 + case SMCSWeapon_TASER:
12.204 + return (int)CSGOWeapon_TASER;
12.205 + case SMCSWeapon_HKP2000:
12.206 + return (int)CSGOWeapon_HKP2000;
12.207 + case SMCSWeapon_MP7:
12.208 + return (int)CSGOWeapon_MP7;
12.209 + case SMCSWeapon_MP9:
12.210 + return (int)CSGOWeapon_MP9;
12.211 + case SMCSWeapon_NOVA:
12.212 + return (int)CSGOWeapon_NOVA;
12.213 + case SMCSWeapon_P250:
12.214 + return (int)CSGOWeapon_P250;
12.215 + case SMCSWeapon_SCAR17:
12.216 + return (int)CSGOWeapon_SCAR17;
12.217 + case SMCSWeapon_SCAR20:
12.218 + return (int)CSGOWeapon_SCAR20;
12.219 + case SMCSWeapon_SG556:
12.220 + return (int)CSGOWeapon_SG556;
12.221 + case SMCSWeapon_SSG08:
12.222 + return (int)CSGOWeapon_SSG08;
12.223 + case SMCSWeapon_KNIFE_GG:
12.224 + return (int)CSGOWeapon_KNIFE_GG;
12.225 + case SMCSWeapon_KNIFE:
12.226 + return (int)CSGOWeapon_KNIFE;
12.227 + case SMCSWeapon_FLASHBANG:
12.228 + return (int)CSGOWeapon_FLASHBANG;
12.229 + case SMCSWeapon_HEGRENADE:
12.230 + return (int)CSGOWeapon_HEGRENADE;
12.231 + case SMCSWeapon_SMOKEGRENADE:
12.232 + return (int)CSGOWeapon_SMOKEGRENADE;
12.233 + case SMCSWeapon_MOLOTOV:
12.234 + return (int)CSGOWeapon_MOLOTOV;
12.235 + case SMCSWeapon_DECOY:
12.236 + return (int)CSGOWeapon_DECOY;
12.237 + case SMCSWeapon_INCGRENADE:
12.238 + return (int)CSGOWeapon_INCGRENADE;
12.239 + case SMCSWeapon_C4:
12.240 + return (int)CSGOWeapon_C4;
12.241 + case SMCSWeapon_KEVLAR:
12.242 + return (int)CSGOWeapon_KEVLAR;
12.243 + case SMCSWeapon_ASSAULTSUIT:
12.244 + return (int)CSGOWeapon_ASSAULTSUIT;
12.245 + case SMCSWeapon_NIGHTVISION:
12.246 + return (int)CSGOWeapon_NVG;
12.247 + case SMCSWeapon_DEFUSER:
12.248 + return (int)CSGOWeapon_DEFUSER;
12.249 + default:
12.250 + return 0;
12.251 + }
12.252 +#else
12.253 + if (weaponId > 33 || weaponId < 0)
12.254 + return 0;
12.255 + else
12.256 + return weaponId;
12.257 +#endif
12.258 +}
12.259 +
12.260 +int GetFakeWeaponID(int weaponId)
12.261 +{
12.262 +#if SOURCE_ENGINE == SE_CSGO
12.263 + switch((CSGOWeapon)weaponId)
12.264 + {
12.265 + case CSGOWeapon_NONE:
12.266 + return (int)SMCSWeapon_NONE;
12.267 + case CSGOWeapon_DEAGLE:
12.268 + return (int)SMCSWeapon_DEAGLE;
12.269 + case CSGOWeapon_ELITE:
12.270 + return (int)SMCSWeapon_ELITE;
12.271 + case CSGOWeapon_FIVESEVEN:
12.272 + return (int)SMCSWeapon_FIVESEVEN;
12.273 + case CSGOWeapon_GLOCK:
12.274 + return (int)SMCSWeapon_GLOCK;
12.275 + case CSGOWeapon_P228:
12.276 + return (int)SMCSWeapon_P228;
12.277 + case CSGOWeapon_USP:
12.278 + return (int)SMCSWeapon_USP;
12.279 + case CSGOWeapon_AK47:
12.280 + return (int)SMCSWeapon_AK47;
12.281 + case CSGOWeapon_AUG:
12.282 + return (int)SMCSWeapon_AUG;
12.283 + case CSGOWeapon_AWP:
12.284 + return (int)SMCSWeapon_AWP;
12.285 + case CSGOWeapon_FAMAS:
12.286 + return (int)SMCSWeapon_FAMAS;
12.287 + case CSGOWeapon_G3SG1:
12.288 + return (int)SMCSWeapon_G3SG1;
12.289 + case CSGOWeapon_GALIL:
12.290 + return (int)SMCSWeapon_GALIL;
12.291 + case CSGOWeapon_GALILAR:
12.292 + return (int)SMCSWeapon_GALILAR;
12.293 + case CSGOWeapon_M249:
12.294 + return (int)SMCSWeapon_M249;
12.295 + case CSGOWeapon_M3:
12.296 + return (int)SMCSWeapon_M3;
12.297 + case CSGOWeapon_M4A1:
12.298 + return (int)SMCSWeapon_M4A1;
12.299 + case CSGOWeapon_MAC10:
12.300 + return (int)SMCSWeapon_MAC10;
12.301 + case CSGOWeapon_MP5NAVY:
12.302 + return (int)SMCSWeapon_MP5NAVY;
12.303 + case CSGOWeapon_P90:
12.304 + return (int)SMCSWeapon_P90;
12.305 + case CSGOWeapon_SCOUT:
12.306 + return (int)SMCSWeapon_SCOUT;
12.307 + case CSGOWeapon_SG550:
12.308 + return (int)SMCSWeapon_SG550;
12.309 + case CSGOWeapon_SG552:
12.310 + return (int)SMCSWeapon_SG552;
12.311 + case CSGOWeapon_TMP:
12.312 + return (int)SMCSWeapon_TMP;
12.313 + case CSGOWeapon_UMP45:
12.314 + return (int)SMCSWeapon_UMP45;
12.315 + case CSGOWeapon_XM1014:
12.316 + return (int)SMCSWeapon_XM1014;
12.317 + case CSGOWeapon_BIZON:
12.318 + return (int)SMCSWeapon_BIZON;
12.319 + case CSGOWeapon_MAG7:
12.320 + return (int)SMCSWeapon_MAG7;
12.321 + case CSGOWeapon_NEGEV:
12.322 + return (int)SMCSWeapon_NEGEV;
12.323 + case CSGOWeapon_SAWEDOFF:
12.324 + return (int)SMCSWeapon_SAWEDOFF;
12.325 + case CSGOWeapon_TEC9:
12.326 + return (int)SMCSWeapon_TEC9;
12.327 + case CSGOWeapon_TASER:
12.328 + return (int)SMCSWeapon_TASER;
12.329 + case CSGOWeapon_HKP2000:
12.330 + return (int)SMCSWeapon_HKP2000;
12.331 + case CSGOWeapon_MP7:
12.332 + return (int)SMCSWeapon_MP7;
12.333 + case CSGOWeapon_MP9:
12.334 + return (int)SMCSWeapon_MP9;
12.335 + case CSGOWeapon_NOVA:
12.336 + return (int)SMCSWeapon_NOVA;
12.337 + case CSGOWeapon_P250:
12.338 + return (int)SMCSWeapon_P250;
12.339 + case CSGOWeapon_SCAR17:
12.340 + return (int)SMCSWeapon_SCAR17;
12.341 + case CSGOWeapon_SCAR20:
12.342 + return (int)SMCSWeapon_SCAR20;
12.343 + case CSGOWeapon_SG556:
12.344 + return (int)SMCSWeapon_SG556;
12.345 + case CSGOWeapon_SSG08:
12.346 + return (int)SMCSWeapon_SSG08;
12.347 + case CSGOWeapon_KNIFE_GG:
12.348 + return (int)SMCSWeapon_KNIFE_GG;
12.349 + case CSGOWeapon_KNIFE:
12.350 + return (int)SMCSWeapon_KNIFE;
12.351 + case CSGOWeapon_FLASHBANG:
12.352 + return (int)SMCSWeapon_FLASHBANG;
12.353 + case CSGOWeapon_HEGRENADE:
12.354 + return (int)SMCSWeapon_HEGRENADE;
12.355 + case CSGOWeapon_SMOKEGRENADE:
12.356 + return (int)SMCSWeapon_SMOKEGRENADE;
12.357 + case CSGOWeapon_MOLOTOV:
12.358 + return (int)SMCSWeapon_MOLOTOV;
12.359 + case CSGOWeapon_DECOY:
12.360 + return (int)SMCSWeapon_DECOY;
12.361 + case CSGOWeapon_INCGRENADE:
12.362 + return (int)SMCSWeapon_INCGRENADE;
12.363 + case CSGOWeapon_C4:
12.364 + return (int)SMCSWeapon_C4;
12.365 + case CSGOWeapon_KEVLAR:
12.366 + return (int)SMCSWeapon_KEVLAR;
12.367 + case CSGOWeapon_ASSAULTSUIT:
12.368 + return (int)SMCSWeapon_ASSAULTSUIT;
12.369 + case CSGOWeapon_NVG:
12.370 + return (int)SMCSWeapon_NIGHTVISION;
12.371 + case CSGOWeapon_DEFUSER:
12.372 + return (int)SMCSWeapon_DEFUSER;
12.373 + default:
12.374 + return 0;
12.375 + }
12.376 +#else
12.377 + if (weaponId > 33 || weaponId < 0)
12.378 + return 0;
12.379 + else
12.380 + return weaponId;
12.381 +#endif
12.382 +}
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13.2 +++ b/extensions/cstrike/util_cstrike.h Sat May 26 18:31:23 2012 -0400
13.3 @@ -0,0 +1,162 @@
13.4 +/**
13.5 + * vim: set ts=4 :
13.6 + * =============================================================================
13.7 + * SourceMod Counter-Strike:Source Extension
13.8 + * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
13.9 + * =============================================================================
13.10 + *
13.11 + * This program is free software; you can redistribute it and/or modify it under
13.12 + * the terms of the GNU General Public License, version 3.0, as published by the
13.13 + * Free Software Foundation.
13.14 + *
13.15 + * This program is distributed in the hope that it will be useful, but WITHOUT
13.16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13.17 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13.18 + * details.
13.19 + *
13.20 + * You should have received a copy of the GNU General Public License along with
13.21 + * this program. If not, see <http://www.gnu.org/licenses/>.
13.22 + *
13.23 + * As a special exception, AlliedModders LLC gives you permission to link the
13.24 + * code of this program (as well as its derivative works) to "Half-Life 2," the
13.25 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
13.26 + * by the Valve Corporation. You must obey the GNU General Public License in
13.27 + * all respects for all other code used. Additionally, AlliedModders LLC grants
13.28 + * this exception to all derivative works. AlliedModders LLC defines further
13.29 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
13.30 + * or <http://www.sourcemod.net/license.php>.
13.31 + *
13.32 + * Version: $Id$
13.33 + */
13.34 +
13.35 +#ifndef _INCLUDE_CSTRIKE_UTIL_H_
13.36 +#define _INCLUDE_CSTRIKE_UTIL_H_
13.37 +
13.38 +#if SOURCE_ENGINE == SE_CSGO
13.39 +enum CSGOWeapon
13.40 +{
13.41 + CSGOWeapon_NONE,
13.42 + CSGOWeapon_DEAGLE,
13.43 + CSGOWeapon_ELITE,
13.44 + CSGOWeapon_FIVESEVEN,
13.45 + CSGOWeapon_GLOCK,
13.46 + CSGOWeapon_P228,
13.47 + CSGOWeapon_USP,
13.48 + CSGOWeapon_AK47,
13.49 + CSGOWeapon_AUG,
13.50 + CSGOWeapon_AWP,
13.51 + CSGOWeapon_FAMAS,
13.52 + CSGOWeapon_G3SG1,
13.53 + CSGOWeapon_GALIL,
13.54 + CSGOWeapon_GALILAR,
13.55 + CSGOWeapon_M249,
13.56 + CSGOWeapon_M3,
13.57 + CSGOWeapon_M4A1,
13.58 + CSGOWeapon_MAC10,
13.59 + CSGOWeapon_MP5NAVY,
13.60 + CSGOWeapon_P90,
13.61 + CSGOWeapon_SCOUT,
13.62 + CSGOWeapon_SG550,
13.63 + CSGOWeapon_SG552,
13.64 + CSGOWeapon_TMP,
13.65 + CSGOWeapon_UMP45,
13.66 + CSGOWeapon_XM1014,
13.67 + CSGOWeapon_BIZON,
13.68 + CSGOWeapon_MAG7,
13.69 + CSGOWeapon_NEGEV,
13.70 + CSGOWeapon_SAWEDOFF,
13.71 + CSGOWeapon_TEC9,
13.72 + CSGOWeapon_TASER,
13.73 + CSGOWeapon_HKP2000,
13.74 + CSGOWeapon_MP7,
13.75 + CSGOWeapon_MP9,
13.76 + CSGOWeapon_NOVA,
13.77 + CSGOWeapon_P250,
13.78 + CSGOWeapon_SCAR17,
13.79 + CSGOWeapon_SCAR20,
13.80 + CSGOWeapon_SG556,
13.81 + CSGOWeapon_SSG08,
13.82 + CSGOWeapon_KNIFE_GG,
13.83 + CSGOWeapon_KNIFE,
13.84 + CSGOWeapon_FLASHBANG,
13.85 + CSGOWeapon_HEGRENADE,
13.86 + CSGOWeapon_SMOKEGRENADE,
13.87 + CSGOWeapon_MOLOTOV,
13.88 + CSGOWeapon_DECOY,
13.89 + CSGOWeapon_INCGRENADE,
13.90 + CSGOWeapon_C4, //49
13.91 + CSGOWeapon_KEVLAR = 50,
13.92 + CSGOWeapon_ASSAULTSUIT,
13.93 + CSGOWeapon_NVG,
13.94 + CSGOWeapon_DEFUSER
13.95 +};
13.96 +enum SMCSWeapon
13.97 +{
13.98 + SMCSWeapon_NONE = 0,
13.99 + SMCSWeapon_P228,
13.100 + SMCSWeapon_GLOCK,
13.101 + SMCSWeapon_SCOUT,
13.102 + SMCSWeapon_HEGRENADE,
13.103 + SMCSWeapon_XM1014,
13.104 + SMCSWeapon_C4,
13.105 + SMCSWeapon_MAC10,
13.106 + SMCSWeapon_AUG,
13.107 + SMCSWeapon_SMOKEGRENADE,
13.108 + SMCSWeapon_ELITE,
13.109 + SMCSWeapon_FIVESEVEN,
13.110 + SMCSWeapon_UMP45,
13.111 + SMCSWeapon_SG550,
13.112 + SMCSWeapon_GALIL,
13.113 + SMCSWeapon_FAMAS,
13.114 + SMCSWeapon_USP,
13.115 + SMCSWeapon_AWP,
13.116 + SMCSWeapon_MP5NAVY,
13.117 + SMCSWeapon_M249,
13.118 + SMCSWeapon_M3,
13.119 + SMCSWeapon_M4A1,
13.120 + SMCSWeapon_TMP,
13.121 + SMCSWeapon_G3SG1,
13.122 + SMCSWeapon_FLASHBANG,
13.123 + SMCSWeapon_DEAGLE,
13.124 + SMCSWeapon_SG552,
13.125 + SMCSWeapon_AK47,
13.126 + SMCSWeapon_KNIFE,
13.127 + SMCSWeapon_P90,
13.128 + SMCSWeapon_SHIELD,
13.129 + SMCSWeapon_KEVLAR,
13.130 + SMCSWeapon_ASSAULTSUIT,
13.131 + SMCSWeapon_NIGHTVISION,
13.132 + SMCSWeapon_GALILAR,
13.133 + SMCSWeapon_BIZON,
13.134 + SMCSWeapon_MAG7,
13.135 + SMCSWeapon_NEGEV,
13.136 + SMCSWeapon_SAWEDOFF,
13.137 + SMCSWeapon_TEC9,
13.138 + SMCSWeapon_TASER,
13.139 + SMCSWeapon_HKP2000,
13.140 + SMCSWeapon_MP7,
13.141 + SMCSWeapon_MP9,
13.142 + SMCSWeapon_NOVA,
13.143 + SMCSWeapon_P250,
13.144 + SMCSWeapon_SCAR17,
13.145 + SMCSWeapon_SCAR20,
13.146 + SMCSWeapon_SG556,
13.147 + SMCSWeapon_SSG08,
13.148 + SMCSWeapon_KNIFE_GG,
13.149 + SMCSWeapon_MOLOTOV,
13.150 + SMCSWeapon_DECOY,
13.151 + SMCSWeapon_INCGRENADE,
13.152 + SMCSWeapon_DEFUSER
13.153 +};
13.154 +#endif
13.155 +void *GetWeaponInfo(int weaponID);
13.156 +
13.157 +const char *GetTranslatedWeaponAlias(const char *weapon);
13.158 +
13.159 +int AliasToWeaponID(const char *weapon);
13.160 +
13.161 +int GetRealWeaponID(int weaponId);
13.162 +
13.163 +int GetFakeWeaponID(int weaponId);
13.164 +
13.165 +#endif
14.1 --- a/gamedata/core.games/common.games.txt Sun May 27 16:51:29 2012 -0400
14.2 +++ b/gamedata/core.games/common.games.txt Sat May 26 18:31:23 2012 -0400
14.3 @@ -234,6 +234,7 @@
14.4 "#supported"
14.5 {
14.6 "game" "cstrike"
14.7 + "game" "csgo"
14.8 }
14.9
14.10 "Keys"
15.1 --- a/gamedata/sm-cstrike.games.txt Sun May 27 16:51:29 2012 -0400
15.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
15.3 @@ -1,106 +0,0 @@
15.4 -/**
15.5 - * Do not edit this file. Any changes will be overwritten by the gamedata
15.6 - * updater or by upgrading your SourceMod install.
15.7 - *
15.8 - * To override data in this file, create a subdirectory named "custom" and
15.9 - * place your own gamedata file(s) inside of it. Such files will be parsed
15.10 - * after SM's own.
15.11 - *
15.12 - * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(SourceMod)
15.13 - */
15.14 -
15.15 -"Games"
15.16 -{
15.17 - "cstrike"
15.18 - {
15.19 - "Offsets"
15.20 - {
15.21 - //Offset of szClassName in CCSWeaponInfo
15.22 - "WeaponName"
15.23 - {
15.24 - "windows" "6"
15.25 - "linux" "6"
15.26 - "mac" "6"
15.27 - }
15.28 - "WeaponPrice"
15.29 - {
15.30 - "windows" "2308"
15.31 - "linux" "2308"
15.32 - "mac" "2308"
15.33 - }
15.34 - //Offset into SetClanTag to find clan tag's offset from player
15.35 - "ClanTagOffset"
15.36 - {
15.37 - "windows" "24"
15.38 - "linux" "42"
15.39 - "mac" "29"
15.40 - }
15.41 - }
15.42 - "Signatures"
15.43 - {
15.44 - "RoundRespawn"
15.45 - {
15.46 - "library" "server"
15.47 - "windows" "\x55\x8B\xEC\x51\x89\x2A\x2A\x8B\x2A\x2A\x8B\x10\x8B"
15.48 - "linux" "@_ZN9CCSPlayer12RoundRespawnEv"
15.49 - "mac" "@_ZN9CCSPlayer12RoundRespawnEv"
15.50 - }
15.51 - "SwitchTeam"
15.52 - {
15.53 - "library" "server"
15.54 - "windows" "\x55\x8B\xEC\x83\xEC\x2A\x89\x4D\x2A\x8B\x45\x2A\x50\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\x85\xC0\x74"
15.55 - "linux" "@_ZN9CCSPlayer10SwitchTeamEi"
15.56 - "mac" "@_ZN9CCSPlayer10SwitchTeamEi"
15.57 - }
15.58 - "HandleCommand_Buy_Internal"
15.59 - {
15.60 - "library" "server"
15.61 - "windows" "\x55\x8B\xEC\x83\xEC\x2A\x89\x2A\x2A\x6A\x00\x8B\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x0F\x2A\x2A\xF7\xD8"
15.62 - "linux" "@_ZN9CCSPlayer26HandleCommand_Buy_InternalEPKc"
15.63 - "mac" "@_ZN9CCSPlayer26HandleCommand_Buy_InternalEPKc"
15.64 - }
15.65 - "GetWeaponPrice"
15.66 - {
15.67 - "library" "server"
15.68 - "windows" "\x8B\x81\x04\x09\x00\x00\xC3"
15.69 - "linux" "@_ZNK13CCSWeaponInfo14GetWeaponPriceEv"
15.70 - "mac" "@_ZNK13CCSWeaponInfo14GetWeaponPriceEv"
15.71 - }
15.72 - "CSWeaponDrop"//Wildcard first 6 bytes for CS:S DM
15.73 - {
15.74 - "library" "server"
15.75 - "windows" "\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x89\x8D\x5C\x2A\x2A\x2A\xC6\x45\x2A\x2A\x8B\x8D\x5C\x2A\x2A\x2A\xE8"
15.76 - "linux" "@_ZN9CCSPlayer12CSWeaponDropEP17CBaseCombatWeaponbb"
15.77 - "mac" "@_ZN9CCSPlayer12CSWeaponDropEP17CBaseCombatWeaponbb"
15.78 - }
15.79 - "TerminateRound"
15.80 - {
15.81 - "library" "server"
15.82 - "windows" "\x55\x8B\xEC\x83\xEC\x2A\x53\x8B\x2A\x2A\x56\x57\x33\xFF\x83"
15.83 - "linux" "@_ZN12CCSGameRules14TerminateRoundEfi"
15.84 - "mac" "@_ZN12CCSGameRules14TerminateRoundEfi"
15.85 - }
15.86 - "GetTranslatedWeaponAlias"
15.87 - {
15.88 - "library" "server"
15.89 - "windows" "\x55\x8B\xEC\x56\x57\x8B\x2A\x2A\x33\xF6\x8D\x2A\x00\x00\x00\x00\x8B\x04\xF5\x2A\x2A\x2A\x2A\x57\x50\xE8\x2A\x2A\x2A\x2A\x83\xC4\x2A\x85\xC0\x74\x2A\x83\xC6\x01\x83\x2A\x1A"
15.90 - "linux" "@_Z24GetTranslatedWeaponAliasPKc"
15.91 - "mac" "@_Z24GetTranslatedWeaponAliasPKc"
15.92 - }
15.93 - "GetWeaponInfo"
15.94 - {
15.95 - "library" "server"
15.96 - "windows" "\x55\x8B\xEC\x8B\x4D\x2A\x85\xC9\x75\x2A\x33\xC0\x5D\xC3\x83\xF9\x2A\x7C\x2A\x69\xC9\x2A\x2A\x00\x00"
15.97 - "linux" "@_Z13GetWeaponInfo10CSWeaponID"
15.98 - "mac" "@_Z13GetWeaponInfo10CSWeaponID"
15.99 - }
15.100 - "SetClanTag"
15.101 - {
15.102 - "library" "server"
15.103 - "windows" "\x55\x8B\xEC\x51\x89\x2A\x2A\x83\x2A\x2A\x2A\x74\x2A\x6A\x2A\x8B\x2A\x2A\x50"
15.104 - "linux" "@_ZN9CCSPlayer10SetClanTagEPKc"
15.105 - "mac" "@_ZN9CCSPlayer10SetClanTagEPKc"
15.106 - }
15.107 - }
15.108 - }
15.109 -}
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
16.2 +++ b/gamedata/sm-cstrike.games/game.csgo.txt Sat May 26 18:31:23 2012 -0400
16.3 @@ -0,0 +1,83 @@
16.4 +/**
16.5 + * Do not edit this file. Any changes will be overwritten by the gamedata
16.6 + * updater or by upgrading your SourceMod install.
16.7 + *
16.8 + * To override data in this file, create a subdirectory named "custom" and
16.9 + * place your own gamedata file(s) inside of it. Such files will be parsed
16.10 + * after SM's own.
16.11 + *
16.12 + * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(SourceMod)
16.13 + */
16.14 +
16.15 +"Games"
16.16 +{
16.17 + //No mac binary yet so no mac gamedata
16.18 + "csgo"
16.19 + {
16.20 + "Offsets"
16.21 + {
16.22 + //Offset of szClassName in CCSWeaponInfo
16.23 + "WeaponName"
16.24 + {
16.25 + "windows" "6"
16.26 + "linux" "6"
16.27 + }
16.28 + "WeaponPrice"
16.29 + {
16.30 + "windows" "2700"
16.31 + "linux" "2700"
16.32 + }
16.33 + }
16.34 + "Signatures"
16.35 + {
16.36 + "RoundRespawn"
16.37 + {
16.38 + "library" "server"
16.39 + "windows" "\x55\x8B\xEC\x83\xEC\x2A\x56\x8B\xF1\x8B\x0D\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x84\xC0\x75"
16.40 + "linux" "@_ZN9CCSPlayer12RoundRespawnEv"
16.41 + }
16.42 + "SwitchTeam"
16.43 + {
16.44 + "library" "server"
16.45 + "windows" "\x55\x8B\xEC\x83\xEC\x2A\x56\x57\x8B\x7D\x2A\x57\x8B\xF1\xE8\x2A\x2A\x2A\x2A\x83\xC4"
16.46 + "linux" "@_ZN9CCSPlayer10SwitchTeamEi"
16.47 + }
16.48 + "HandleCommand_Buy_Internal"
16.49 + {
16.50 + "library" "server"
16.51 + "windows" "\x55\x8B\xEC\x81\xEC\x2A\x2A\x00\x00\x53\x56\x8B\xF1\x80\xBE\x2A\x2A\x00\x00\x00"
16.52 + "linux" "@_ZN9CCSPlayer26HandleCommand_Buy_InternalEPKc"
16.53 + }
16.54 + "CSWeaponDrop"//Wildcard first 6 bytes for CS:S DM
16.55 + {
16.56 + "library" "server"
16.57 + "windows" "\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x53\x56\x8B\x2A\x2A\x32\xDB\x57\x8B\xF9\x85\xF6\x0F\x84"
16.58 + "linux" "@_ZN9CCSPlayer12CSWeaponDropEP17CBaseCombatWeaponbb"
16.59 + }
16.60 + "TerminateRound"
16.61 + {
16.62 + "library" "server"
16.63 + "windows" "\x55\x8B\xEC\x83\xEC\x2A\x53\x8B\x2A\x2A\x56\x57\x33\xFF"
16.64 + "linux" "@_ZN12CCSGameRules14TerminateRoundEfi"
16.65 + }
16.66 + "GetTranslatedWeaponAlias"
16.67 + {
16.68 + "library" "server"
16.69 + "windows" "\x55\x8B\xEC\x56\x57\x8B\x2A\x2A\x33\xF6\x8D\x9B\x2A\x2A\x2A\x2A\x8B\x04\xF5\x2A\x2A\x2A\x2A\x57\x50\xE8\x2A\x2A\x2A\x2A\x83\xC4\x2A\x85\xC0\x74\x2A\x46\x83\xFE\x2A\x72\x2A\x8B\xC7\x5F\x5E\x5D\xC3"
16.70 + "linux" "@_Z24GetTranslatedWeaponAliasPKc"
16.71 + }
16.72 + "GetWeaponInfo"
16.73 + {
16.74 + "library" "server"
16.75 + "windows" "\x55\x8B\xEC\x8B\x4D\x2A\x33\xC0\x85\xC9\x74"
16.76 + "linux" "@_Z13GetWeaponInfo10CSWeaponID"
16.77 + }
16.78 + "AliasToWeaponID"
16.79 + {
16.80 + "library" "server"
16.81 + "windows" "\x55\x8B\xEC\x56\x57\x8B\x2A\x2A\x85\xFF\x74\x2A\x33\xF6\x8B\xFF"
16.82 + "linux" "@_Z15AliasToWeaponIDPKc"
16.83 + }
16.84 + }
16.85 + }
16.86 +}
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
17.2 +++ b/gamedata/sm-cstrike.games/game.css.txt Sat May 26 18:31:23 2012 -0400
17.3 @@ -0,0 +1,113 @@
17.4 +/**
17.5 + * Do not edit this file. Any changes will be overwritten by the gamedata
17.6 + * updater or by upgrading your SourceMod install.
17.7 + *
17.8 + * To override data in this file, create a subdirectory named "custom" and
17.9 + * place your own gamedata file(s) inside of it. Such files will be parsed
17.10 + * after SM's own.
17.11 + *
17.12 + * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(SourceMod)
17.13 + */
17.14 +
17.15 +"Games"
17.16 +{
17.17 + "cstrike"
17.18 + {
17.19 + "Offsets"
17.20 + {
17.21 + //Offset of szClassName in CCSWeaponInfo
17.22 + "WeaponName"
17.23 + {
17.24 + "windows" "6"
17.25 + "linux" "6"
17.26 + "mac" "6"
17.27 + }
17.28 + "WeaponPrice"
17.29 + {
17.30 + "windows" "2308"
17.31 + "linux" "2308"
17.32 + "mac" "2308"
17.33 + }
17.34 + //Offset into SetClanTag to find clan tag's offset from player
17.35 + "ClanTagOffset"
17.36 + {
17.37 + "windows" "24"
17.38 + "linux" "42"
17.39 + "mac" "29"
17.40 + }
17.41 + }
17.42 + "Signatures"
17.43 + {
17.44 + "RoundRespawn"
17.45 + {
17.46 + "library" "server"
17.47 + "windows" "\x55\x8B\xEC\x51\x89\x2A\x2A\x8B\x2A\x2A\x8B\x10\x8B"
17.48 + "linux" "@_ZN9CCSPlayer12RoundRespawnEv"
17.49 + "mac" "@_ZN9CCSPlayer12RoundRespawnEv"
17.50 + }
17.51 + "SwitchTeam"
17.52 + {
17.53 + "library" "server"
17.54 + "windows" "\x55\x8B\xEC\x83\xEC\x2A\x89\x4D\x2A\x8B\x45\x2A\x50\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\x85\xC0\x74"
17.55 + "linux" "@_ZN9CCSPlayer10SwitchTeamEi"
17.56 + "mac" "@_ZN9CCSPlayer10SwitchTeamEi"
17.57 + }
17.58 + "HandleCommand_Buy_Internal"
17.59 + {
17.60 + "library" "server"
17.61 + "windows" "\x55\x8B\xEC\x83\xEC\x2A\x89\x2A\x2A\x6A\x00\x8B\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x0F\x2A\x2A\xF7\xD8"
17.62 + "linux" "@_ZN9CCSPlayer26HandleCommand_Buy_InternalEPKc"
17.63 + "mac" "@_ZN9CCSPlayer26HandleCommand_Buy_InternalEPKc"
17.64 + }
17.65 + "GetWeaponPrice"
17.66 + {
17.67 + "library" "server"
17.68 + "windows" "\x8B\x81\x04\x09\x00\x00\xC3"
17.69 + "linux" "@_ZNK13CCSWeaponInfo14GetWeaponPriceEv"
17.70 + "mac" "@_ZNK13CCSWeaponInfo14GetWeaponPriceEv"
17.71 + }
17.72 + "CSWeaponDrop"//Wildcard first 6 bytes for CS:S DM
17.73 + {
17.74 + "library" "server"
17.75 + "windows" "\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x89\x8D\x5C\x2A\x2A\x2A\xC6\x45\x2A\x2A\x8B\x8D\x5C\x2A\x2A\x2A\xE8"
17.76 + "linux" "@_ZN9CCSPlayer12CSWeaponDropEP17CBaseCombatWeaponbb"
17.77 + "mac" "@_ZN9CCSPlayer12CSWeaponDropEP17CBaseCombatWeaponbb"
17.78 + }
17.79 + "TerminateRound"
17.80 + {
17.81 + "library" "server"
17.82 + "windows" "\x55\x8B\xEC\x83\xEC\x2A\x53\x8B\x2A\x2A\x56\x57\x33\xFF\x83"
17.83 + "linux" "@_ZN12CCSGameRules14TerminateRoundEfi"
17.84 + "mac" "@_ZN12CCSGameRules14TerminateRoundEfi"
17.85 + }
17.86 + "GetTranslatedWeaponAlias"
17.87 + {
17.88 + "library" "server"
17.89 + "windows" "\x55\x8B\xEC\x56\x57\x8B\x2A\x2A\x33\xF6\x8D\x2A\x00\x00\x00\x00\x8B\x04\xF5\x2A\x2A\x2A\x2A\x57\x50\xE8\x2A\x2A\x2A\x2A\x83\xC4\x2A\x85\xC0\x74\x2A\x83\xC6\x01\x83\x2A\x1A"
17.90 + "linux" "@_Z24GetTranslatedWeaponAliasPKc"
17.91 + "mac" "@_Z24GetTranslatedWeaponAliasPKc"
17.92 + }
17.93 + "GetWeaponInfo"
17.94 + {
17.95 + "library" "server"
17.96 + "windows" "\x55\x8B\xEC\x8B\x4D\x2A\x85\xC9\x75\x2A\x33\xC0\x5D\xC3\x83\xF9\x2A\x7C\x2A\x69\xC9\x2A\x2A\x00\x00"
17.97 + "linux" "@_Z13GetWeaponInfo10CSWeaponID"
17.98 + "mac" "@_Z13GetWeaponInfo10CSWeaponID"
17.99 + }
17.100 + "SetClanTag"
17.101 + {
17.102 + "library" "server"
17.103 + "windows" "\x55\x8B\xEC\x51\x89\x2A\x2A\x83\x2A\x2A\x2A\x74\x2A\x6A\x2A\x8B\x2A\x2A\x50"
17.104 + "linux" "@_ZN9CCSPlayer10SetClanTagEPKc"
17.105 + "mac" "@_ZN9CCSPlayer10SetClanTagEPKc"
17.106 + }
17.107 + "AliasToWeaponID"
17.108 + {
17.109 + "library" "server"
17.110 + "windows" "\x55\x8B\xEC\x56\x57\x8B\x2A\x2A\x85\xFF\x74\x2A\x33\xF6\x8B\xFF\x8B\x04\x2A\x2A\x2A\x2A\x2A\x57\x50"
17.111 + "linux" "@_Z15AliasToWeaponIDPKc"
17.112 + "mac" "@_Z15AliasToWeaponIDPKc"
17.113 + }
17.114 + }
17.115 + }
17.116 +}
18.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
18.2 +++ b/gamedata/sm-cstrike.games/master.games.txt Sat May 26 18:31:23 2012 -0400
18.3 @@ -0,0 +1,23 @@
18.4 +/**
18.5 + * Do not edit this file. Any changes will be overwritten by the gamedata
18.6 + * updater or by upgrading your SourceMod install.
18.7 + *
18.8 + * To override data in this file, create a subdirectory named "custom" and
18.9 + * place your own gamedata file(s) inside of it. Such files will be parsed
18.10 + * after SM's own.
18.11 + *
18.12 + * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(SourceMod)
18.13 + */
18.14 +
18.15 +"Game Master"
18.16 +{
18.17 + "game.csgo.txt"
18.18 + {
18.19 + "game" "csgo"
18.20 + }
18.21 +
18.22 + "game.css.txt"
18.23 + {
18.24 + "game" "cstrike"
18.25 + }
18.26 +}
19.1 --- a/plugins/include/cstrike.inc Sun May 27 16:51:29 2012 -0400
19.2 +++ b/plugins/include/cstrike.inc Sat May 26 18:31:23 2012 -0400
19.3 @@ -67,41 +67,63 @@
19.4
19.5 enum CSWeaponID
19.6 {
19.7 - CSWeapon_NONE,
19.8 - CSWeapon_P228,
19.9 - CSWeapon_GLOCK,
19.10 - CSWeapon_SCOUT,
19.11 - CSWeapon_HEGRENADE,
19.12 - CSWeapon_XM1014,
19.13 - CSWeapon_C4,
19.14 - CSWeapon_MAC10,
19.15 - CSWeapon_AUG,
19.16 - CSWeapon_SMOKEGRENADE,
19.17 - CSWeapon_ELITE,
19.18 - CSWeapon_FIVESEVEN,
19.19 - CSWeapon_UMP45,
19.20 - CSWeapon_SG550,
19.21 - CSWeapon_GALIL,
19.22 - CSWeapon_FAMAS,
19.23 - CSWeapon_USP,
19.24 - CSWeapon_AWP,
19.25 - CSWeapon_MP5NAVY,
19.26 - CSWeapon_M249,
19.27 - CSWeapon_M3,
19.28 - CSWeapon_M4A1,
19.29 - CSWeapon_TMP,
19.30 - CSWeapon_G3SG1,
19.31 - CSWeapon_FLASHBANG,
19.32 - CSWeapon_DEAGLE,
19.33 - CSWeapon_SG552,
19.34 - CSWeapon_AK47,
19.35 - CSWeapon_KNIFE,
19.36 - CSWeapon_P90,
19.37 - CSWeapon_SHIELD,
19.38 - CSWeapon_KEVLAR,
19.39 - CSWeapon_ASSAULTSUIT,
19.40 - CSWeapon_NIGHTVISION
19.41 + CSWeapon_NONE = 0,
19.42 + CSWeapon_P228,
19.43 + CSWeapon_GLOCK,
19.44 + CSWeapon_SCOUT,
19.45 + CSWeapon_HEGRENADE,
19.46 + CSWeapon_XM1014,
19.47 + CSWeapon_C4,
19.48 + CSWeapon_MAC10,
19.49 + CSWeapon_AUG,
19.50 + CSWeapon_SMOKEGRENADE,
19.51 + CSWeapon_ELITE,
19.52 + CSWeapon_FIVESEVEN,
19.53 + CSWeapon_UMP45,
19.54 + CSWeapon_SG550,
19.55 + CSWeapon_GALIL,
19.56 + CSWeapon_FAMAS,
19.57 + CSWeapon_USP,
19.58 + CSWeapon_AWP,
19.59 + CSWeapon_MP5NAVY,
19.60 + CSWeapon_M249,
19.61 + CSWeapon_M3,
19.62 + CSWeapon_M4A1,
19.63 + CSWeapon_TMP,
19.64 + CSWeapon_G3SG1,
19.65 + CSWeapon_FLASHBANG,
19.66 + CSWeapon_DEAGLE,
19.67 + CSWeapon_SG552,
19.68 + CSWeapon_AK47,
19.69 + CSWeapon_KNIFE,
19.70 + CSWeapon_P90,
19.71 + CSWeapon_SHIELD,
19.72 + CSWeapon_KEVLAR,
19.73 + CSWeapon_ASSAULTSUIT,
19.74 + CSWeapon_NIGHTVISION,
19.75 + CSWeapon_GALILAR,
19.76 + CSWeapon_BIZON,
19.77 + CSWeapon_MAG7,
19.78 + CSWeapon_NEGEV,
19.79 + CSWeapon_SAWEDOFF,
19.80 + CSWeapon_TEC9,
19.81 + CSWeapon_TASER,
19.82 + CSWeapon_HKP2000,
19.83 + CSWeapon_MP7,
19.84 + CSWeapon_MP9,
19.85 + CSWeapon_NOVA,
19.86 + CSWeapon_P250,
19.87 + CSWeapon_SCAR17,
19.88 + CSWeapon_SCAR20,
19.89 + CSWeapon_SG556,
19.90 + CSWeapon_SSG08,
19.91 + CSWeapon_KNIFE_GG,
19.92 + CSWeapon_MOLOTOV,
19.93 + CSWeapon_DECOY,
19.94 + CSWeapon_INCGRENADE,
19.95 + CSWeapon_DEFUSER
19.96 };
19.97 +
19.98 /**
19.99 * Called when a player attempts to purchase an item.
19.100 * Return Plugin_Continue to allow the purchase or return a
19.101 @@ -224,6 +246,7 @@
19.102 * @return Number of non-null bytes written.
19.103 *
19.104 * @error Invalid client.
19.105 + * @note Only supported on CS:S. Writes 0-length string on CS:GO.
19.106 */
19.107 native CS_GetClientClanTag(client, String:buffer[], size);
19.108
19.109 @@ -234,10 +257,20 @@
19.110 * @noreturn
19.111 *
19.112 * @error Invalid client.
19.113 + * @note Only supported on CS:S. Has no effect on CS:GO.
19.114 */
19.115 native CS_SetClientClanTag(client, const String:tag[]);
19.116
19.117 /**
19.118 + * Gets a weaponID from a alias
19.119 + * @param alias Weapon alias to attempt to get an id for.
19.120 + * @return Returns a weapon id or 0 if failed to find a match.
19.121 + *
19.122 + * @note For best results use CS_GetTranslatedWeaponAlias on the weapon name before passing it.
19.123 + */
19.124 +native CS_AliasToWeaponID(const String:alias[]);
19.125 +
19.126 +/**
19.127 * Do not edit below this line!
19.128 */
19.129 public Extension:__ext_cstrike =
19.130 @@ -263,6 +296,7 @@
19.131 MarkNativeAsOptional("CS_GetWeaponPrice");
19.132 MarkNativeAsOptional("CS_GetClientClanTag");
19.133 MarkNativeAsOptional("CS_SetClientClanTag");
19.134 + MakrNativeAsOptional("CS_AliasToWeaponID");
19.135 }
19.136 #endif
19.137