@@ -54,7 +54,7 @@ public Plugin:myinfo = {
5454 name = " admin-tools" ,
5555 author = " Chanz, Berni" ,
5656 description = " Collection of mighty admin commands" ,
57- version = " 1.1 " ,
57+ version = " 1.2 " ,
5858 url = " http://bcserv.eu/"
5959}
6060
@@ -126,10 +126,11 @@ new Handle:g_hEvent_ToArray = INVALID_HANDLE;
126126new Handle :g_hEvent_KeyList = INVALID_HANDLE ;
127127
128128// Library Load Checks
129-
129+ new bool : g_bExtensionCstrikeLoaded = false ; // Whether the cstrike extension is loaded or not
130130
131131// Game Variables
132132new Handle :g_hGame_EventKeyList = INVALID_HANDLE ;
133+ new EngineVersion :g_evEngine_Version = Engine_Unknown ; // Guessed SDK version
133134
134135// Map Variables
135136new g_iSprite_LaserBeam = - 1 ;
@@ -145,13 +146,6 @@ new bool:g_bClient_IsBuried[MAXPLAYERS+1];
145146// Alias Command To Data Mapping
146147new Handle :g_hAlias_ToDataPack = INVALID_HANDLE ;
147148
148- // Guessed SDK version
149- new EngineVersion :engineVersion = Engine_Unknown ;
150-
151- // Whether the cstrike extension is loaded or not
152- new bool :isCstrikeExtensionLoaded = false ;
153-
154-
155149
156150/* **************************************************************************************
157151
@@ -221,22 +215,23 @@ public OnPluginStart()
221215 ParseEventKVCheck (" resource/modevents.res" );
222216
223217 // Feature detection
224- engineVersion = GetEngineVersion ();
218+ g_evEngine_Version = GetEngineVersion ();
225219
226220 // Check if the extension is loaded
227- if (GetExtensionFileStatus (" cstrike.ext" ) == 1 ) {
228- isCstrikeExtensionLoaded = true ;
221+
222+ if (GetExtensionFileStatus (" game.cstrike.ext" ) == 1 ) {
223+ g_bExtensionCstrikeLoaded = true ;
229224 }
230225}
231226
232227public OnMapStart ()
233228{
234229 // hax against valvefail (thx psychonic for fix)
235- if (engineVersion == Engine_SourceSDK2007 ){
230+ if (g_evEngine_Version == Engine_SourceSDK2007 ){
236231 SetConVarString (Plugin_VersionCvar , Plugin_Version );
237232 }
238233
239- if (engineVersion == Engine_Left4Dead2 ){
234+ if (g_evEngine_Version == Engine_Left4Dead2 ){
240235
241236 g_iSprite_LaserBeam = PrecacheModel (" materials/sprites/laserbeam.vmt" );
242237 //g_iSprite_Halo = PrecacheModel("materials/sprites/glow01.vmt");
@@ -249,9 +244,7 @@ public OnMapStart()
249244
250245 ClearEvents ();
251246
252- if (isCstrikeExtensionLoaded ) {
253- CreateTimer (1.0 , Timer_LateMapStart , INVALID_HANDLE , TIMER_FLAG_NO_MAPCHANGE );
254- }
247+ CreateTimer (1.0 , Timer_LateMapStart , INVALID_HANDLE , TIMER_FLAG_NO_MAPCHANGE );
255248}
256249
257250public OnConfigsExecuted ()
@@ -1646,7 +1639,7 @@ public Action:Command_Disarm(client, args) {
16461639 }
16471640
16481641 for (new i = 0 ; i < target_count ; ++ i ) {
1649- if (engineVersion == Engine_CSS && isCstrikeExtensionLoaded ) {
1642+ if (g_evEngine_Version == Engine_CSS && g_bExtensionCstrikeLoaded ) {
16501643 LOOP_CLIENTWEAPONS (target_list [i ],weapon ,index ) {
16511644 CS_DropWeapon (target_list [i ],weapon ,false ,true );
16521645 Entity_Kill (weapon );
@@ -2891,7 +2884,7 @@ ParseEventKVCheck(const String:path[PLATFORM_MAX_PATH]){
28912884 ParseEventKV (path );
28922885 }
28932886 else {
2894- PrintToServer ( " [ %s ] Can't find event resource file: %s " , path , Plugin_Name );
2887+ LogError ( " Can't find event resource file: %s " , path );
28952888 }
28962889}
28972890
@@ -3090,7 +3083,7 @@ stock FakeClientCommandChainable(client, const String:format[], any:...){
30903083
30913084GetSpawnPointCount (team ){
30923085
3093- if (engineVersion != Engine_CSS || ! isCstrikeExtensionLoaded ) {
3086+ if (g_evEngine_Version != Engine_CSS || ! g_bExtensionCstrikeLoaded ) {
30943087 return 0 ;
30953088 }
30963089
@@ -3101,21 +3094,23 @@ stock CS_GetSpawnPointCount(team)
31013094{
31023095 new count = 0 ;
31033096 new entity = - 1 ;
3104-
3097+
31053098 switch (team ) {
31063099
31073100 case TEAM_ONE : {
31083101
31093102 while ((entity = FindEntityByClassname (entity , " info_player_terrorist" )) != INVALID_ENT_REFERENCE ) {
31103103
3111- count ++ ;
3104+ //PrintToServer("info_player_terrorist m_iTeamNum: %d", GetEntProp(entity, Prop_Data, "m_iTeamNum"));
3105+ count ++ ;
31123106 }
31133107 }
31143108 case TEAM_TWO : {
31153109
31163110 while ((entity = FindEntityByClassname (entity , " info_player_counterterrorist" )) != INVALID_ENT_REFERENCE ) {
3117-
3118- count ++ ;
3111+
3112+ //PrintToServer("info_player_counterterrorist m_iTeamNum: %d", GetEntProp(entity, Prop_Data, "m_iTeamNum"));
3113+ count ++ ;
31193114 }
31203115 }
31213116 }
@@ -3125,7 +3120,7 @@ stock CS_GetSpawnPointCount(team)
31253120
31263121stock RespawnPlayer (client ){
31273122
3128- if (GetEngineVersion () == Engine_CSS && isCstrikeExtensionLoaded ) {
3123+ if (GetEngineVersion () == Engine_CSS && g_bExtensionCstrikeLoaded ) {
31293124 // TODO Make it work in all games
31303125 CS_RespawnPlayer (client );
31313126 }
@@ -3154,7 +3149,7 @@ stock bool:SwitchTeam(client, team){
31543149
31553150 ChangeClientTeam (client , team );
31563151
3157- if (engineVersion == Engine_CSS ) {
3152+ if (g_evEngine_Version == Engine_CSS ) {
31583153 // Hide the model selection menu
31593154 switch (team ) {
31603155
@@ -3171,8 +3166,8 @@ stock bool:SwitchTeam(client, team){
31713166 }
31723167 }
31733168 else {
3174- if (engineVersion != Engine_CSS
3175- || ! isCstrikeExtensionLoaded
3169+ if (g_evEngine_Version != Engine_CSS
3170+ || ! g_bExtensionCstrikeLoaded
31763171 || team == TEAM_SPECTATOR ) {
31773172 // Target is spec we need to change the team instead of just switching it
31783173 ChangeClientTeam (client , team );
0 commit comments