Changeset 4915 in niluje


Ignore:
Timestamp:
Dec 5, 2008, 4:18:57 AM (10 years ago)
Author:
NiLuJe
Message:

L4D Difficulty Enforcer:

  • Add some debug ServerPrint? to see what's going on since the last update. (Update which enforces versus mode @ normal, and coop @ lobby setting). So far, it would seem like, at least for versus, we're screwed.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Plugins/trunk/SourceMod/scripting/NiLuJe/l4d_difficulty.sp

    r4913 r4915  
    1818        author = "NiLuJe",
    1919        description = "Enforce the z_difficulty cvar",
    20         version = "1.20",
     20        version = "1.25",
    2121        url = "http://www.sourcemod.net/"
    2222}
     
    239239public ConVarChange_ZDifficulty( Handle:cvar, const String:oldValue[], const String:newValue[] )
    240240{
     241        PrintToServer( "[SM] ConVarChange_ZDifficulty => oldValue: %s / newValue: %s", oldValue, newValue );
    241242        if ( newValue[0] == oldValue[0] )
    242243        {
     244                PrintToServer( "[SM] ConVarChange_ZDifficulty => newValue == oldValue => return!" );
    243245                return;
    244246        }
     
    247249        decl String:szConVarBuff[16];
    248250        GetConVarString( g_hL4dDifficulty, szConVarBuff, 16 );
     251        PrintToServer( "[SM] ConVarChange_ZDifficulty => szConVarBuff: %s", szConVarBuff );
    249252       
    250253        /* Avoid recursion, and invalid values, in case z_difficulty is set before us (ie. server.cfg) */
     254        /* Since the update enforcing the lobby difficulty/versus @ normal, it seems we're called too late, and our 'new' value, ends up in oldValue, when the
     255         * engine tries to reset it to the lobby value, which ends up in newValue. Since the engine will always come before us, we're screwed :'(. */
    251256        if ( szConVarBuff[0] == oldValue[0] || szConVarBuff[0] == 'D' || szConVarBuff[0] == 'd' )
    252257        {
    253                 return;
    254         }
    255 
     258                PrintToServer( "[SM] ConVarChange_ZDifficulty => szConVarBuff == oldValue || szConVarBuff == Default => return!" );
     259                return;
     260        }
     261
     262        PrintToServer( "[SM] ConVarChange_ZDifficulty => Pre-SetConVar( g_hZDifficulty, szConVarBuff )" );
    256263        SetConVarString( g_hZDifficulty, szConVarBuff );
     264        PrintToServer( "[SM] ConVarChange_ZDifficulty => Post-SetConVar( g_hZDifficulty, szConVarBuff )" );
    257265}
    258266
     
    260268public ConVarChange_L4dDifficulty( Handle:cvar, const String:oldValue[], const String:newValue[] )
    261269{
     270        PrintToServer( "[SM] ConVarChange_L4dDifficulty => oldValue: %s / newValue: %s", oldValue, newValue );
    262271        if ( newValue[0] == oldValue[0] || newValue[0] == 'D' || newValue[0] == 'd' )
    263272        {
     273                PrintToServer( "[SM] ConVarChange_L4dDifficulty => newValue == oldValue || newvalue == Default => return!" );
    264274                PrintToChatAll( "[SM] L4D difficulty is already set to %s", newValue );
    265275                return;
    266276        }
    267277
     278        PrintToServer( "[SM] ConVarChange_L4dDifficulty => Pre-SetConVarString( g_hZDifficulty, newValue )" );
    268279        PrintToChatAll( "[SM] L4D difficulty has been set to %s", newValue );
    269280        SetConVarString( g_hZDifficulty, newValue );
    270 }
     281        PrintToServer( "[SM] ConVarChange_L4dDifficulty => Post-SetConVarString( g_hZDifficulty, newValue )" );
     282}
Note: See TracChangeset for help on using the changeset viewer.