diff --git a/ZombieRiot/scripting/unloze_zr.sp b/ZombieRiot/scripting/unloze_zr.sp index c72d7eda..3a6504a4 100644 --- a/ZombieRiot/scripting/unloze_zr.sp +++ b/ZombieRiot/scripting/unloze_zr.sp @@ -50,16 +50,15 @@ int g_iToolsVelocity; //from zombie reloaded int g_iClientZMClasses[g_dIndexes]; int g_iClientHumanClasses[g_dIndexes]; int g_iClientRespawnCount[g_dIndexes]; -int g_iSpeedIndex[g_dIndexes]; int g_iWeaponSlot[g_dIndexes]; int g_iWeaponPrice[g_dIndexes]; int g_iBotStuckindex[g_dIndexes]; int g_iClientRespawnCountNum; -int g_iLoadClassesIndex; int g_iZMBeginindex; int g_iSoundIndexes; int g_iWeaponIndex; int g_iBotStuckCounts; +int g_iLoadClassesIndex; float g_fKnockBackIndex[g_dIndexes + 1]; float g_fJumpHeightIndex[g_dIndexes + 1]; @@ -141,6 +140,7 @@ public void OnPluginStart() RegConsoleCmd("say", Cmd_Say); RegConsoleCmd("sm_zclass", Cmd_Zclass, "Class Prefferences"); //named like zombiereloaded for ease of use RegConsoleCmd("sm_zmarket", Cmd_zmarket, "weapon Prefferences"); //named like zombiereloaded for ease of use + RegConsoleCmd("sm_market", Cmd_zmarket, "weapon Prefferences"); //named like zombiereloaded for ease of use RegAdminCmd("sm_LoadClasses", Cmd_LoadManually, ADMFLAG_RCON); RegAdminCmd("sm_wave", Cmd_ChangeWave, ADMFLAG_RCON); RegAdminCmd("sm_human", Cmd_Humanize, ADMFLAG_BAN); @@ -460,7 +460,7 @@ public void Zmarket(int client) ZmarketMenu.SetTitle("Weapon Selection"); for (int i = 0; i < g_iWeaponIndex; i++) { - ZmarketMenu.AddItem("", g_cWeaponNames[i][g_iLength]); + ZmarketMenu.AddItem(g_cWeaponNames[i][g_iLength], g_cWeaponNames[i][g_iLength]); } ZmarketMenu.ExitButton = true; ZmarketMenu.ExitBackButton = true; @@ -471,41 +471,45 @@ public void Zmarket(int client) //---------------------------------------------------------------------------------------------------- static void Zclass(int client) { - char l_cHuman[g_dLength]; - char l_cZM[g_dLength]; - int l_iZMIndex = g_iClientZMClasses[client]; - int l_iHumanIndex = g_iClientHumanClasses[client]; - Menu ZclassMenu = CreateMenu(Zclass_Menu); - if (strlen(g_cZMRoundClasses[l_iZMIndex][g_iLength]) < 1) - { - for (int i = 0; i < g_dIndexes; i++) - { - if (strlen(g_cZMRoundClasses[i][g_iLength]) < 1) - continue; - l_iZMIndex = i; - break; - } - } - if (strlen(g_cHumanClasses[l_iHumanIndex][g_iLength]) < 1) - { - for (int i = 0; i < g_dIndexes; i++) - { - if (strlen(g_cHumanClasses[i][g_iLength]) < 1) - continue; - l_iHumanIndex = i; - break; - } - } - Format(l_cZM, sizeof(l_cZM), "Active Zombie Class: %s", g_cZMRoundClasses[l_iZMIndex][g_iLength]); - Format(l_cHuman, sizeof(l_cHuman), "Active Human Class: %s", g_cHumanClasses[l_iHumanIndex][g_iLength]); - ZclassMenu.SetTitle("TeamClass Selection"); - ZclassMenu.AddItem("", "Human Classes"); - ZclassMenu.AddItem("", l_cHuman, ITEMDRAW_DISABLED); - ZclassMenu.AddItem("", "Zombie Classes"); - ZclassMenu.AddItem("", l_cZM, ITEMDRAW_DISABLED); - ZclassMenu.ExitButton = true; - ZclassMenu.ExitBackButton = true; - ZclassMenu.Display(client, 0); + char l_cHuman[g_dLength]; + char l_cZM[g_dLength]; + int l_iZMIndex = g_iClientZMClasses[client]; + int l_iHumanIndex = g_iClientHumanClasses[client]; + Menu ZclassMenu = CreateMenu(Zclass_Menu); + + //if you did not pick a zm skin it picks the first for you + if (strlen(g_cZMRoundClasses[l_iZMIndex][g_iLength]) < 1) + { + for (int i = 0; i < g_dIndexes; i++) + { + if (strlen(g_cZMRoundClasses[i][g_iLength]) < 1) + continue; + l_iZMIndex = i; + break; + } + } + + //if you did not pick a human skin it picks the first for you + if (strlen(g_cHumanClasses[l_iHumanIndex][g_iLength]) < 1) + { + for (int i = 0; i < g_dIndexes; i++) + { + if (strlen(g_cHumanClasses[i][g_iLength]) < 1) + continue; + l_iHumanIndex = i; + break; + } + } + Format(l_cZM, sizeof(l_cZM), "Active Zombie Class: %s", g_cZMRoundClasses[l_iZMIndex][g_iLength]); + Format(l_cHuman, sizeof(l_cHuman), "Active Human Class: %s", g_cHumanClasses[l_iHumanIndex][g_iLength]); + ZclassMenu.SetTitle("TeamClass Selection"); + ZclassMenu.AddItem("", "Human Classes"); + ZclassMenu.AddItem("", l_cHuman, ITEMDRAW_DISABLED); + ZclassMenu.AddItem("", "Zombie Classes"); + ZclassMenu.AddItem("", l_cZM, ITEMDRAW_DISABLED); + ZclassMenu.ExitButton = true; + ZclassMenu.ExitBackButton = true; + ZclassMenu.Display(client, 0); } //---------------------------------------------------------------------------------------------------- @@ -515,7 +519,19 @@ public int Zmarket_menu(Menu menu, MenuAction action, int client, int selection) { if (action == MenuAction_Select && IsValidClient(client)) { - ZmarketGetWeapon(client, selection); + char info[64]; + menu.GetItem(selection, info, sizeof(info)); + + int weapon_index = 0; + for (int i = 0; i < g_iWeaponIndex; i++) + { + if (StrEqual(g_cWeaponNames[i][g_iLength], info)) + { + weapon_index = i; + break; + } + } + ZmarketGetWeapon(client, weapon_index); } else if (action == MenuAction_End) { @@ -543,7 +559,7 @@ public int Zclass_Menu(Menu menu, MenuAction action, int client, int selection) //---------------------------------------------------------------------------------------------------- public void ZmarketGetWeapon(int client, int index) { - if (GetClientTeam(client) != CS_TEAM_CT || !IsPlayerAlive(client)) + if (!IsValidClient(client) || GetClientTeam(client) != CS_TEAM_CT || !IsPlayerAlive(client)) { PrintToChat(client, "You have to be Human for obtaining weapons"); return; @@ -587,100 +603,100 @@ public void ZmarketGetWeapon(int client, int index) //---------------------------------------------------------------------------------------------------- static void ZclassTeamMenu(int client, int state) { - //0 human, 2 zm - Menu zclassMenu; - AdminId l_AdminID = GetUserAdmin(client); - int l_iAdminGroupCount = GetAdminGroupCount(l_AdminID); - int l_iFound; - int l_iFlags; - if (state == 2) - { - zclassMenu = CreateMenu(Zombieclass_Menu); - zclassMenu.SetTitle("Playerclass Zombie Selection"); - for (int i = 0; i < g_dIndexes; i++) - { - if (strlen(g_cZMRoundClasses[i][g_iLength]) < 1) - continue; - - if (strlen(g_cGroup[i][g_iLength]) < 1 && strlen(g_cSMFLAGS[i][g_iLength]) < 1) - { - zclassMenu.AddItem("", g_cZMRoundClasses[i][g_iLength]); - l_iFound++; - } - else - { - l_iFound = 0; - if (strlen(g_cGroup[i][g_iLength]) > 0) - { - for (int j = 0; j < l_iAdminGroupCount; j++) - { - if (StrEqual(g_cGroup[i][g_iLength], g_cAdminGroups[client][j][g_iLength])) - { - zclassMenu.AddItem("", g_cZMRoundClasses[i][g_iLength]); - l_iFound++; - break; - } - } - } - } - l_iFlags = ReadFlagString(g_cSMFLAGS[i][g_iLength]); - if (GetUserFlagBits(client) & l_iFlags && l_iFound < 1 && strlen(g_cSMFLAGS[i][g_iLength]) > 0) - { - zclassMenu.AddItem("", g_cZMRoundClasses[i][g_iLength]); - l_iFound++; - } - if (l_iFound == 0) - { - zclassMenu.AddItem("", g_cZMRoundClasses[i][g_iLength], ITEMDRAW_DISABLED); - } - - } - } - else - { - zclassMenu = CreateMenu(Humanclass_Menu); - zclassMenu.SetTitle("Active Playerclass Human Selection"); - for (int i = 0; i < g_dIndexes; i++) - { - if (strlen(g_cHumanClasses[i][g_iLength]) < 1) - continue; - - if (strlen(g_cGroup[i][g_iLength]) < 1 && strlen(g_cSMFLAGS[i][g_iLength]) < 1) - { - zclassMenu.AddItem("", g_cHumanClasses[i][g_iLength]); - l_iFound++; - } - else - { - l_iFound = 0; - if (strlen(g_cGroup[i][g_iLength]) > 0) - { - for (int j = 0; j < l_iAdminGroupCount; j++) - { - if (StrEqual(g_cGroup[i][g_iLength], g_cAdminGroups[client][j][g_iLength])) - { - zclassMenu.AddItem("", g_cHumanClasses[i][g_iLength]); - l_iFound++; - break; - } - } - } - } - l_iFlags = ReadFlagString(g_cSMFLAGS[i][g_iLength]); - if (GetUserFlagBits(client) & l_iFlags && l_iFound < 1 && strlen(g_cSMFLAGS[i][g_iLength]) > 0) - { - zclassMenu.AddItem("", g_cHumanClasses[i][g_iLength]); - l_iFound++; - } - if (l_iFound == 0) - { - zclassMenu.AddItem("", g_cHumanClasses[i][g_iLength], ITEMDRAW_DISABLED); - } - } - } - zclassMenu.ExitButton = true; - zclassMenu.ExitBackButton = true; - zclassMenu.Display(client, 0); + //0 human, 2 zm + Menu zclassMenu; + AdminId l_AdminID = GetUserAdmin(client); + int l_iAdminGroupCount = GetAdminGroupCount(l_AdminID); + int l_iFound; + int l_iFlags; + if (state == 2) + { + zclassMenu = CreateMenu(Zombieclass_Menu); + zclassMenu.SetTitle("Playerclass Zombie Selection"); + for (int i = 0; i < g_dIndexes; i++) + { + if (strlen(g_cZMRoundClasses[i][g_iLength]) < 1) + continue; + + if (strlen(g_cGroup[i][g_iLength]) < 1 && strlen(g_cSMFLAGS[i][g_iLength]) < 1) + { + zclassMenu.AddItem(g_cZMRoundClasses[i][g_iLength], g_cZMRoundClasses[i][g_iLength]); + l_iFound++; + } + else + { + l_iFound = 0; + if (strlen(g_cGroup[i][g_iLength]) > 0) + { + for (int j = 0; j < l_iAdminGroupCount; j++) + { + if (StrEqual(g_cGroup[i][g_iLength], g_cAdminGroups[client][j][g_iLength])) + { + zclassMenu.AddItem(g_cZMRoundClasses[i][g_iLength], g_cZMRoundClasses[i][g_iLength]); + l_iFound++; + break; + } + } + } + } + l_iFlags = ReadFlagString(g_cSMFLAGS[i][g_iLength]); + if (GetUserFlagBits(client) & l_iFlags && l_iFound < 1 && strlen(g_cSMFLAGS[i][g_iLength]) > 0) + { + zclassMenu.AddItem(g_cZMRoundClasses[i][g_iLength], g_cZMRoundClasses[i][g_iLength]); + l_iFound++; + } + if (l_iFound == 0) + { + zclassMenu.AddItem(g_cZMRoundClasses[i][g_iLength], g_cZMRoundClasses[i][g_iLength], ITEMDRAW_DISABLED); + } + + } + } + else + { + zclassMenu = CreateMenu(Humanclass_Menu); + zclassMenu.SetTitle("Active Playerclass Human Selection"); + for (int i = 0; i < g_dIndexes; i++) + { + if (strlen(g_cHumanClasses[i][g_iLength]) < 1) + continue; + + if (strlen(g_cGroup[i][g_iLength]) < 1 && strlen(g_cSMFLAGS[i][g_iLength]) < 1) + { + zclassMenu.AddItem(g_cHumanClasses[i][g_iLength], g_cHumanClasses[i][g_iLength]); + l_iFound++; + } + else + { + l_iFound = 0; + if (strlen(g_cGroup[i][g_iLength]) > 0) + { + for (int j = 0; j < l_iAdminGroupCount; j++) + { + if (StrEqual(g_cGroup[i][g_iLength], g_cAdminGroups[client][j][g_iLength])) + { + zclassMenu.AddItem(g_cHumanClasses[i][g_iLength], g_cHumanClasses[i][g_iLength]); + l_iFound++; + break; + } + } + } + } + l_iFlags = ReadFlagString(g_cSMFLAGS[i][g_iLength]); + if (GetUserFlagBits(client) & l_iFlags && l_iFound < 1 && strlen(g_cSMFLAGS[i][g_iLength]) > 0) + { + zclassMenu.AddItem(g_cHumanClasses[i][g_iLength], g_cHumanClasses[i][g_iLength]); + l_iFound++; + } + if (l_iFound == 0) + { + zclassMenu.AddItem(g_cHumanClasses[i][g_iLength], g_cHumanClasses[i][g_iLength], ITEMDRAW_DISABLED); + } + } + } + zclassMenu.ExitButton = true; + zclassMenu.ExitBackButton = true; + zclassMenu.Display(client, 0); } //---------------------------------------------------------------------------------------------------- // Purpose: @@ -689,10 +705,21 @@ public int Zombieclass_Menu(Menu menu, MenuAction action, int client, int select { if (action == MenuAction_Select && IsValidClient(client)) { + char info[64]; + menu.GetItem(selection, info, sizeof(info)); + //going through all zm classes by name until finding the one that matches the menu selection. + for (int i = g_iZMBeginindex; i < g_iLoadClassesIndex; i++) + { + if (StrEqual(g_cZMRoundClasses[i][g_iLength], info)) + { + g_iClientZMClasses[client] = i; //we found the zm class selected in the menu + break; + } + } char l_cInfo[4]; - g_iClientZMClasses[client] = selection + g_iZMBeginindex; IntToString(g_iClientZMClasses[client], l_cInfo, sizeof(l_cInfo)); SetClientCookie(client, g_hClientZMCookie, l_cInfo); + if (g_bSwitchingIndex && GetClientTeam(client) == CS_TEAM_T && IsPlayerAlive(client)) //beginning of round, is correct team and alive { SelectWaveBasedZM(client, 1); @@ -711,11 +738,22 @@ public int Humanclass_Menu(Menu menu, MenuAction action, int client, int selecti { if (action == MenuAction_Select && IsValidClient(client)) { + char info[64]; + menu.GetItem(selection, info, sizeof(info)); + //going through all human classes by name until finding the one that matches the menu selection. + for (int i = 0; i < g_iZMBeginindex; i++) + { + if (StrEqual(g_cHumanClasses[i][g_iLength], info)) + { + g_iClientHumanClasses[client] = i; //we found the human class selected in the menu + break; + } + } + char l_cInfo[4]; - IntToString(selection, l_cInfo, sizeof(l_cInfo)); + IntToString(g_iClientHumanClasses[client], l_cInfo, sizeof(l_cInfo)); SetClientCookie(client, g_hClientHumanCookie, l_cInfo); - g_iClientHumanClasses[client] = selection; if (g_bSwitchingIndex && GetClientTeam(client) == CS_TEAM_CT && IsPlayerAlive(client)) //beginning of round, is correct team and alive { SelectWavebasedHuman(client); @@ -764,7 +802,9 @@ public void LoadExtraSettings() char l_cLine[g_dLength]; if (!FileExists(g_cPathsExtra)) { - CreateDefaultExtraFile(); + delete l_hFile; + LogError("create a extrasettings.txt file!"); + return; } l_hFile = OpenFile(g_cPathsExtra, "r"); while (!IsEndOfFile(l_hFile) && ReadFileLine(l_hFile, l_cLine, sizeof(l_cLine))) @@ -850,7 +890,9 @@ public void loadWeapons() KeyValues kv = CreateKeyValues("Weapons"); if (!FileExists(g_cPathsWeapons)) { - CreateBackUpWeapons(); + delete kv; + LogError("create kv file"); + return; } g_iWeaponIndex = 0; //ofc this has to be reset, otherwise it ends up going out of bounds dx kv.ImportFromFile(g_cPathsWeapons); @@ -877,49 +919,34 @@ public void loadWeapons() //---------------------------------------------------------------------------------------------------- public Action LoadClasses() { - Handle l_hFile = INVALID_HANDLE; - Handle l_hFileZM = INVALID_HANDLE; - char l_cLine[g_dLength]; - g_iLoadClassesIndex = 0; - l_hFile = OpenFile(g_cPathsClassHuman, "r"); - l_hFileZM = OpenFile(g_cPathsClassZM, "r"); - if (!FileExists(g_cPathsClassHuman) && !FileExists(g_cPathsClassZM)) - { - CreateBackUpClassHuman(g_iLoadClassesIndex); - CreateBackUpClassZM(g_iLoadClassesIndex); - delete l_hFile; - delete l_hFileZM; - return Plugin_Handled; - } - else if (!FileExists(g_cPathsClassHuman)) - { - CreateBackUpClassHuman(g_iLoadClassesIndex); - delete l_hFile; - delete l_hFileZM; - return Plugin_Handled; - } - else if (!FileExists(g_cPathsClassZM)) - { - CreateBackUpClassZM(g_iLoadClassesIndex); - delete l_hFile; - delete l_hFileZM; - return Plugin_Handled; - } + Handle l_hFile = INVALID_HANDLE; + Handle l_hFileZM = INVALID_HANDLE; + char l_cLine[g_dLength]; + g_iLoadClassesIndex = 0; + l_hFile = OpenFile(g_cPathsClassHuman, "r"); + l_hFileZM = OpenFile(g_cPathsClassZM, "r"); + if (!FileExists(g_cPathsClassHuman) || !FileExists(g_cPathsClassZM)) + { + delete l_hFile; + delete l_hFileZM; + LogError("You need to create the classeshuman.txt and the classeszm.txt"); + return Plugin_Handled; + } - - //first indexes go to human classes, all afterfollowing to zms - while (!IsEndOfFile(l_hFile) && ReadFileLine(l_hFile, l_cLine, sizeof(l_cLine))) - { - ReadingClassValuesFromFile(g_iLoadClassesIndex, l_cLine); - } - g_iZMBeginindex = g_iLoadClassesIndex; - while (!IsEndOfFile(l_hFileZM) && ReadFileLine(l_hFileZM, l_cLine, sizeof(l_cLine))) - { - ReadingClassValuesFromFile(g_iLoadClassesIndex, l_cLine); - } - delete l_hFileZM; - delete l_hFile; - return Plugin_Handled; + //first indexes go to human classes, all afterfollowing to zms + while (!IsEndOfFile(l_hFile) && ReadFileLine(l_hFile, l_cLine, sizeof(l_cLine))) + { + ReadingClassValuesFromFile(g_iLoadClassesIndex, l_cLine); + } + //after going through humans are all remaining indexes for zombies. + g_iZMBeginindex = g_iLoadClassesIndex; + while (!IsEndOfFile(l_hFileZM) && ReadFileLine(l_hFileZM, l_cLine, sizeof(l_cLine))) + { + ReadingClassValuesFromFile(g_iLoadClassesIndex, l_cLine); + } + delete l_hFileZM; + delete l_hFile; + return Plugin_Handled; } //---------------------------------------------------------------------------------------------------- // Purpose: @@ -1066,7 +1093,7 @@ public Action RetrieveWaveSettings(int wave) l_hWave = OpenFile(g_cPathsWaveSettings, "r"); if (l_hWave == INVALID_HANDLE) { - CreateDefaultWave(); + LogError("create a wavesettings.txt file"); delete l_hWave; return Plugin_Handled; } @@ -1106,6 +1133,7 @@ public void LoadWave(int wave) Format(l_cJumptokey1, sizeof(l_cJumptokey1), "Wave %i", wave +1); for (int i = 0; i < g_dIndexes; i++) { + //resetting human and zombie classes each round/wave. Format(g_cHumanClasses[i][g_iLength], sizeof(g_cHumanClasses), ""); Format(g_cZMRoundClasses[i][g_iLength], sizeof(g_cZMRoundClasses), ""); } @@ -1154,6 +1182,7 @@ public void LoadWave(int wave) ReplaceStrings(l_cLine, "Zombie Class"); if (StrContains(l_cLine, "@all") > -1) { + //in this case it just goes through all zombie classes for (int i = g_iZMBeginindex; i < g_iLoadClassesIndex; i++) { Format(g_cZMRoundClasses[i][g_iLength], sizeof(g_cZMRoundClasses), g_cUniqueName[i][g_iLength]); @@ -1197,7 +1226,6 @@ public void LoadWave(int wave) } if (StrEqual(l_cLine, g_cUniqueName[i][g_iLength], false)) { - //PrintToChatAll("l_cLine ZM SUCCESS: %s \n%i", l_cLine, i); Format(g_cZMRoundClasses[i][g_iLength], sizeof(g_cZMRoundClasses), g_cUniqueName[i][g_iLength]); break; } @@ -1317,159 +1345,6 @@ public bool skipIndex(int index) //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- -public void CreateDefaultExtraFile() -{ - KeyValues kv = CreateKeyValues("ExtraSettings"); - kv.JumpToKey("Extras", true); - kv.SetFloat("Respawn Time", 9.0); - kv.SetFloat("round start zclass time", 15.0); - kv.SetFloat("zm spawn protection", 1.0); - kv.SetFloat("human spawn protection", 4.0); - kv.SetFloat("zmsoundInterval", 15.0); - kv.SetNum("botStuckCount", 3); - kv.SetFloat("botStuckPush", 250.0); - kv.SetString("zmsoundsFile", " "); - kv.SetString("Global command", "mp_afterroundmoney 16000"); - kv.Rewind(); - kv.ExportToFile(g_cPathsExtra); - delete kv; -} -//---------------------------------------------------------------------------------------------------- -// Purpose: -//---------------------------------------------------------------------------------------------------- -public void CreateDefaultWave() -{ - Handle l_hFile = INVALID_HANDLE; - Handle l_hFileZM = INVALID_HANDLE; - char l_cLine[g_dLength]; - char l_cHuman[g_dLength]; - char l_cZM[g_dLength]; - l_hFileZM = OpenFile(g_cPathsClassZM, "r"); - l_hFile = OpenFile(g_cPathsClassHuman, "r"); - while (!IsEndOfFile(l_hFileZM) && ReadFileLine(l_hFileZM, l_cLine, sizeof(l_cLine))) - { - if (StrContains(l_cLine, "unique name") > -1) - { - ReplaceStrings(l_cLine, "unique name"); - Format(l_cHuman, sizeof(l_cHuman), l_cLine); - break; - } - } - while (!IsEndOfFile(l_hFile) && ReadFileLine(l_hFile, l_cLine, sizeof(l_cLine))) - { - if (StrContains(l_cLine, "unique name") > -1) - { - ReplaceStrings(l_cLine, "unique name"); - Format(l_cZM, sizeof(l_cZM), l_cLine); - break; - } - } - KeyValues kv = CreateKeyValues("Waves"); - kv.JumpToKey("Wave 1", true); - g_iZMScaleability = 5.0; - g_fZMHealthScaleability = 1.0; - g_iZMCount = 2; - kv.SetFloat("PlayerScaleAbility", g_iZMScaleability); - kv.SetFloat("HealthScaleAbility", g_fZMHealthScaleability); - kv.SetNum("Zombie Count", g_iZMCount); //creates 10 zombies per player - kv.SetNum("Respawns", 5); - kv.SetNum("bot_scaling", 1); - kv.SetString("wavecommand", "mp_roundtime 14"); - //hopefully creates now - kv.SetString("Zombie Class", l_cHuman); //Selects backup classes - kv.SetString("Human Class", l_cZM); - kv.Rewind(); - kv.ExportToFile(g_cPathsWaveSettings); - delete kv; - delete l_hFileZM; - delete l_hFile; -} -//---------------------------------------------------------------------------------------------------- -// Purpose: -//---------------------------------------------------------------------------------------------------- -public void CreateBackUpClassZM(int index) -{ - KeyValues kv = CreateKeyValues("Classes"); - Format(g_cUniqueName[index][g_iLength], sizeof(g_cUniqueName), "Zombie Backup Class"); - kv.JumpToKey(g_cUniqueName[index][g_iLength], true); - kv.SetString("unique name", g_cUniqueName[index][g_iLength]); - Format(g_cTeam[index][g_iLength], sizeof(g_cTeam), "ZM"); - kv.SetString("team", g_cTeam[index][g_iLength]); - Format(g_cGroup[index][g_iLength], sizeof(g_cGroup), " "); - kv.SetString("group", g_cGroup[index][g_iLength]); - Format(g_cSMFLAGS[index][g_iLength], sizeof(g_cSMFLAGS), " "); - kv.SetString("sm_flags", g_cSMFLAGS[index][g_iLength]); - Format(g_cModelPath[index][g_iLength], sizeof(g_cModelPath), "models/player/tm_pirate_varianta.mdl"); - kv.SetString("model path", g_cModelPath[index][g_iLength]); - Format(g_cNoFallDmg[index][g_iLength], sizeof(g_cNoFallDmg), "YES"); - kv.SetString("no_fall_damage", g_cNoFallDmg[index][g_iLength]); - Format(g_cHealth[index][g_iLength], sizeof(g_cHealth), "250"); - kv.SetString("health", g_cHealth[index][g_iLength]); - Format(g_cSpeed[index][g_iLength], sizeof(g_cSpeed), "250.0"); - kv.SetString("speed", g_cSpeed[index][g_iLength]); - Format(g_cKnockback[index][g_iLength], sizeof(g_cKnockback), "2.5"); - kv.SetString("knockback", g_cKnockback[index][g_iLength]); - Format(g_cJumpHeight[index][g_iLength], sizeof(g_cJumpHeight), "1.0"); - kv.SetString("jump_height", g_cJumpHeight[index][g_iLength]); - Format(g_cJumpDistance[index][g_iLength], sizeof(g_cJumpDistance), "1.0"); - kv.SetString("jump_distance", g_cJumpDistance[index][g_iLength]); - Format(g_cDamageMultiplier[index][g_iLength], sizeof(g_cDamageMultiplier), "1.0"); - kv.SetString("damage_multiplier", g_cDamageMultiplier[index][g_iLength]); - kv.Rewind(); - kv.ExportToFile(g_cPathsClassZM); - delete kv; -} -public void CreateBackUpClassHuman(int index) -{ - KeyValues kv = CreateKeyValues("Classes"); - Format(g_cUniqueName[index][g_iLength], sizeof(g_cUniqueName), "Human Backup Class"); - kv.JumpToKey(g_cUniqueName[index][g_iLength], true); - kv.SetString("unique name", g_cUniqueName[index][g_iLength]); - Format(g_cTeam[index][g_iLength], sizeof(g_cTeam), "Human"); - kv.SetString("team", g_cTeam[index][g_iLength]); - Format(g_cGroup[index][g_iLength], sizeof(g_cGroup), " "); - kv.SetString("group", g_cGroup[index][g_iLength]); - Format(g_cSMFLAGS[index][g_iLength], sizeof(g_cSMFLAGS), " "); - kv.SetString("sm_flags", g_cSMFLAGS[index][g_iLength]); - Format(g_cModelPath[index][g_iLength], sizeof(g_cModelPath), "models/player/tm_pirate_varianta.mdl"); - kv.SetString("model path", g_cModelPath[index][g_iLength]); - Format(g_cNoFallDmg[index][g_iLength], sizeof(g_cNoFallDmg), "NO"); - kv.SetString("no_fall_damage", g_cNoFallDmg[index][g_iLength]); - Format(g_cHealth[index][g_iLength], sizeof(g_cHealth), "100"); - kv.SetString("health", g_cHealth[index][g_iLength]); - Format(g_cSpeed[index][g_iLength], sizeof(g_cSpeed), "250.0"); - kv.SetString("speed", g_cSpeed[index][g_iLength]); - Format(g_cKnockback[index][g_iLength], sizeof(g_cKnockback), "1.0"); - kv.SetString("knockback", g_cKnockback[index][g_iLength]); - Format(g_cJumpHeight[index][g_iLength], sizeof(g_cJumpHeight), "1.0"); - kv.SetString("jump_height", g_cJumpHeight[index][g_iLength]); - Format(g_cJumpDistance[index][g_iLength], sizeof(g_cJumpDistance), "1.0"); - kv.SetString("jump_distance", g_cJumpDistance[index][g_iLength]); - Format(g_cDamageMultiplier[index][g_iLength], sizeof(g_cDamageMultiplier), "1.0"); - kv.SetString("damage_multiplier", g_cDamageMultiplier[index][g_iLength]); - kv.Rewind(); - kv.ExportToFile(g_cPathsClassHuman); - delete kv; -} -//---------------------------------------------------------------------------------------------------- -// Purpose: -//---------------------------------------------------------------------------------------------------- -public void CreateBackUpWeapons() -{ - KeyValues kv = CreateKeyValues("Weapons"); - kv.JumpToKey("Glock", true); - kv.SetString("weaponentity", "weapon_glock"); - kv.SetString("zmarketname", "Glock"); - kv.SetNum("weaponslot", 1); - kv.SetNum("zmarketprice", 200); - kv.SetString("zmarketcommand", "sm_glock"); - kv.Rewind(); - kv.ExportToFile(g_cPathsWeapons); - delete kv; -} -//---------------------------------------------------------------------------------------------------- -// Purpose: -//---------------------------------------------------------------------------------------------------- public void ReadingClassValuesFromFile(int index, char[] Line) { char li_c[g_dLength]; @@ -1617,6 +1492,7 @@ public Action SelectWaveBasedZM(int client, int state) } } } + //if no model selected just picks the first available for players else if (strlen(g_cZMRoundClasses[g_iClientZMClasses[client]][g_iLength]) < 1) { for (int i = 0; i < g_dIndexes; i++) @@ -1673,7 +1549,7 @@ public Action ModelSelection(int client, int state, int modelIndex) else g_bFallDamage[client] = false; //setting the class speed simply. - SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", StringToFloat(g_cSpeed[g_iSpeedIndex[client]][g_iLength])); + SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", StringToFloat(g_cSpeed[i][g_iLength])); if (state < 2) { CreateTimer(g_fZMSpawnProtection, Timer_StopProtection, GetClientUserId(client)); @@ -1698,7 +1574,6 @@ public Action ModelSelection(int client, int state, int modelIndex) } else SetEntityHealth(client, StringToInt(g_cHealth[i][g_iLength])); - g_iSpeedIndex[client] = i; g_fKnockBackIndex[client] = StringToFloat(g_cKnockback[i][g_iLength]); g_fJumpHeightIndex[client] = StringToFloat(g_cJumpHeight[i][g_iLength]); g_fJumpDistanceIndex[client] = StringToFloat(g_cJumpDistance[i][g_iLength]);