diff --git a/addons/sourcemod/scripting/SurfTimer.sp b/addons/sourcemod/scripting/SurfTimer.sp index ba91a94..e064877 100644 --- a/addons/sourcemod/scripting/SurfTimer.sp +++ b/addons/sourcemod/scripting/SurfTimer.sp @@ -261,10 +261,10 @@ int g_WrcpStage[MAXPLAYERS + 1]; bool g_bhasStages; /*---------- Spawn Locations ----------*/ -float g_fSpawnLocation[MAXZONEGROUPS][CPLIMIT][3]; -float g_fSpawnAngle[MAXZONEGROUPS][CPLIMIT][3]; -float g_fSpawnVelocity[MAXZONEGROUPS][CPLIMIT][3]; -bool g_bGotSpawnLocation[MAXZONEGROUPS][CPLIMIT]; +float g_fSpawnLocation[MAXZONEGROUPS][CPLIMIT][2][3]; +float g_fSpawnAngle[MAXZONEGROUPS][CPLIMIT][2][3]; +float g_fSpawnVelocity[MAXZONEGROUPS][CPLIMIT][2][3]; +bool g_bGotSpawnLocation[MAXZONEGROUPS][CPLIMIT][2]; /*---------- Bonus Variables ----------*/ @@ -777,6 +777,9 @@ bool g_bSpecListOnly[MAXPLAYERS + 1]; bool g_bSideHud[MAXPLAYERS + 1]; int g_iSideHudModule[MAXPLAYERS + 1][5]; +// Custom tele side +int g_iTeleSide[MAXPLAYERS + 1]; + /*---------- Run Variables ----------*/ // Clients personal record in map diff --git a/addons/sourcemod/scripting/surftimer.smx b/addons/sourcemod/scripting/surftimer.smx new file mode 100644 index 0000000..d11207e Binary files /dev/null and b/addons/sourcemod/scripting/surftimer.smx differ diff --git a/addons/sourcemod/scripting/surftimer/admin.sp b/addons/sourcemod/scripting/surftimer/admin.sp index 027e1d8..455adc2 100644 --- a/addons/sourcemod/scripting/surftimer/admin.sp +++ b/addons/sourcemod/scripting/surftimer/admin.sp @@ -85,6 +85,26 @@ public Action Admin_insertSpawnLocation(int client, int args) if (!IsValidClient(client) || !IsPlayerZoner(client)) return Plugin_Handled; + Menu menu = CreateMenu(ChooseTeleSideHandler); + SetMenuTitle(menu, "Choose side for this spawn location"); + AddMenuItem(menu, "", "Left"); + AddMenuItem(menu, "", "Right"); + SetMenuOptionFlags(menu, MENUFLAG_BUTTON_EXIT); + DisplayMenu(menu, client, MENU_TIME_FOREVER); + + return Plugin_Handled; +} + +public int ChooseTeleSideHandler(Handle menu, MenuAction action, int param1, int param2) +{ + if (action == MenuAction_Select) + InsertSpawnLocation(param1, param2); + else if (action == MenuAction_End) + delete menu; +} + +public void InsertSpawnLocation(int client, int teleside) +{ float SpawnLocation[3]; float SpawnAngle[3]; float Velocity[3]; @@ -95,20 +115,18 @@ public Action Admin_insertSpawnLocation(int client, int args) SpawnLocation[2] += 3.0; - if (g_bGotSpawnLocation[g_iClientInZone[client][2]][1]) + if (g_bGotSpawnLocation[g_iClientInZone[client][2]][1][teleside]) { - db_updateSpawnLocations(SpawnLocation, SpawnAngle, Velocity, g_iClientInZone[client][2]); + db_updateSpawnLocations(SpawnLocation, SpawnAngle, Velocity, g_iClientInZone[client][2], teleside); CPrintToChat(client, "%t", "Admin7", g_szChatPrefix); } else { - db_insertSpawnLocations(SpawnLocation, SpawnAngle, Velocity, g_iClientInZone[client][2]); + db_insertSpawnLocations(SpawnLocation, SpawnAngle, Velocity, g_iClientInZone[client][2], teleside); CPrintToChat(client, "%t", "SpawnAdded", g_szChatPrefix); } CPrintToChat(client, "%f : %f : %f : %i", SpawnLocation, SpawnAngle, Velocity, g_iClientInZone[client][2]); - - return Plugin_Handled; } public Action Admin_deleteSpawnLocation(int client, int args) @@ -116,10 +134,23 @@ public Action Admin_deleteSpawnLocation(int client, int args) if (!IsValidClient(client) || !IsPlayerZoner(client)) return Plugin_Handled; - if (g_bGotSpawnLocation[g_iClientInZone[client][2]][1]) + if (g_bGotSpawnLocation[g_iClientInZone[client][2]][1][0] || g_bGotSpawnLocation[g_iClientInZone[client][2]][1][1]) { - db_deleteSpawnLocations(g_iClientInZone[client][2]); - CPrintToChat(client, "%t", "Admin8", g_szChatPrefix); + Menu menu = CreateMenu(DelSpawnLocationHandler); + SetMenuTitle(menu, "Choose side of spawn location to delete"); + + if (g_bGotSpawnLocation[g_iClientInZone[client][2]][1][0]) + AddMenuItem(menu, "", "Left"); + else + AddMenuItem(menu, "", "Left", ITEMDRAW_DISABLED); + + if (g_bGotSpawnLocation[g_iClientInZone[client][2]][1][1]) + AddMenuItem(menu, "", "Right"); + else + AddMenuItem(menu, "", "Right", ITEMDRAW_DISABLED); + + SetMenuOptionFlags(menu, MENUFLAG_BUTTON_EXIT); + DisplayMenu(menu, client, MENU_TIME_FOREVER); } else CPrintToChat(client, "%t", "Admin9", g_szChatPrefix); @@ -127,6 +158,25 @@ public Action Admin_deleteSpawnLocation(int client, int args) return Plugin_Handled; } +public int DelSpawnLocationHandler(Handle menu, MenuAction action, int param1, int param2) +{ + if (action == MenuAction_Select) + DelSpawnLocation(param1, param2); + else if (action == MenuAction_End) + delete menu; +} + +public void DelSpawnLocation(int client, int teleside) +{ + if (g_bGotSpawnLocation[g_iClientInZone[client][2]][1][teleside]) + { + db_deleteSpawnLocations(g_iClientInZone[client][2], teleside); + CPrintToChat(client, "%t", "Admin8", g_szChatPrefix); + } + else + CPrintToChat(client, "%t", "Admin9", g_szChatPrefix); +} + public Action Admin_ClearAssists(int client, int args) { if (IsPlayerTimerAdmin(client)) diff --git a/addons/sourcemod/scripting/surftimer/commands.sp b/addons/sourcemod/scripting/surftimer/commands.sp index 77ff7d0..63950fa 100644 --- a/addons/sourcemod/scripting/surftimer/commands.sp +++ b/addons/sourcemod/scripting/surftimer/commands.sp @@ -1975,6 +1975,17 @@ void CenterSpeedDisplay(int client, bool menu = false) MiscellaneousOptions(client); } +void TeleSide(int client, bool menu = false) +{ + if (g_iTeleSide[client] == 0) + g_iTeleSide[client]++; + else + g_iTeleSide[client] = 0; + + if (menu) + MiscellaneousOptions(client); +} + public Action Client_Hide(int client, int args) { HideMethod(client); @@ -3207,11 +3218,11 @@ public void MiscellaneousOptions(int client) else AddMenuItem(menu, "", "[OFF] Timer Sounds"); - // Hide Weapon - if (g_bViewModel[client]) - AddMenuItem(menu, "", "[OFF] Hide Weapon"); + // Tele Side + if (g_iTeleSide[client] == 0) + AddMenuItem(menu, "", "[LEFT] Start Side"); else - AddMenuItem(menu, "", "[ON] Hide Weapon"); + AddMenuItem(menu, "", "[RIGHT] Start Side"); // Speed Gradient if (g_SpeedGradient[client] == 0) @@ -3243,6 +3254,13 @@ public void MiscellaneousOptions(int client) else AddMenuItem(menu, "", "[OFF] Hide Chat"); + // Hide Weapon + if (g_bViewModel[client]) + AddMenuItem(menu, "", "[OFF] Hide Weapon"); + else + AddMenuItem(menu, "", "[ON] Hide Weapon"); + + SetMenuExitBackButton(menu, true); DisplayMenu(menu, client, MENU_TIME_FOREVER); } @@ -3255,11 +3273,12 @@ public int MiscellaneousOptionsHandler(Menu menu, MenuAction action, int param1, { case 0: HideMethod(param1, true); case 1: QuakeSounds(param1, true); - case 2: HideViewModel(param1, true); + case 2: TeleSide(param1, true); case 3: SpeedGradient(param1, true); case 4: SpeedMode(param1, true); case 5: CenterSpeedDisplay(param1, true); case 6: HideChat(param1, true); + case 7: HideViewModel(param1, true); } } else if (action == MenuAction_Cancel) diff --git a/addons/sourcemod/scripting/surftimer/db/queries.sp b/addons/sourcemod/scripting/surftimer/db/queries.sp index 1641876..090b870 100644 --- a/addons/sourcemod/scripting/surftimer/db/queries.sp +++ b/addons/sourcemod/scripting/surftimer/db/queries.sp @@ -39,10 +39,10 @@ char sql_insertmaptier[] = "INSERT INTO ck_maptier (mapname, tier) VALUES ('%s', char sql_updatemaptier[] = "UPDATE ck_maptier SET tier = %i WHERE mapname ='%s'"; // ck_playeroptions2 -char sql_createPlayerOptions[] = "CREATE TABLE `ck_playeroptions2` (`steamid` varchar(32) NOT NULL DEFAULT '', `timer` int(11) NOT NULL DEFAULT '1', `hide` int(11) NOT NULL DEFAULT '0', `sounds` int(11) NOT NULL DEFAULT '1', `chat` int(11) NOT NULL DEFAULT '0', `viewmodel` int(11) NOT NULL DEFAULT '1', `autobhop` int(11) NOT NULL DEFAULT '1', `checkpoints` int(11) NOT NULL DEFAULT '1', `gradient` int(11) NOT NULL DEFAULT '3', `speedmode` int(11) NOT NULL DEFAULT '0', `centrespeed` int(11) NOT NULL DEFAULT '0', `centrehud` int(11) NOT NULL DEFAULT '1', `module1c` int(11) NOT NULL DEFAULT '1', `module2c` int(11) NOT NULL DEFAULT '2', `module3c` int(11) NOT NULL DEFAULT '3', `module4c` int(11) NOT NULL DEFAULT '4', `module5c` int(11) NOT NULL DEFAULT '5', `module6c` int(11) NOT NULL DEFAULT '6', `sidehud` int(11) NOT NULL DEFAULT '1', `module1s` int(11) NOT NULL DEFAULT '5', `module2s` int(11) NOT NULL DEFAULT '0', `module3s` int(11) NOT NULL DEFAULT '0', `module4s` int(11) NOT NULL DEFAULT '0', `module5s` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`steamid`)) DEFAULT CHARSET=utf8mb4;"; +char sql_createPlayerOptions[] = "CREATE TABLE `ck_playeroptions2` (`steamid` varchar(32) NOT NULL DEFAULT '', `timer` int(11) NOT NULL DEFAULT '1', `hide` int(11) NOT NULL DEFAULT '0', `sounds` int(11) NOT NULL DEFAULT '1', `chat` int(11) NOT NULL DEFAULT '0', `viewmodel` int(11) NOT NULL DEFAULT '1', `autobhop` int(11) NOT NULL DEFAULT '1', `checkpoints` int(11) NOT NULL DEFAULT '1', `gradient` int(11) NOT NULL DEFAULT '3', `speedmode` int(11) NOT NULL DEFAULT '0', `centrespeed` int(11) NOT NULL DEFAULT '0', `centrehud` int(11) NOT NULL DEFAULT '1', teleside int(11) NOT NULL DEFAULT '0', `module1c` int(11) NOT NULL DEFAULT '1', `module2c` int(11) NOT NULL DEFAULT '2', `module3c` int(11) NOT NULL DEFAULT '3', `module4c` int(11) NOT NULL DEFAULT '4', `module5c` int(11) NOT NULL DEFAULT '5', `module6c` int(11) NOT NULL DEFAULT '6', `sidehud` int(11) NOT NULL DEFAULT '1', `module1s` int(11) NOT NULL DEFAULT '5', `module2s` int(11) NOT NULL DEFAULT '0', `module3s` int(11) NOT NULL DEFAULT '0', `module4s` int(11) NOT NULL DEFAULT '0', `module5s` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`steamid`)) DEFAULT CHARSET=utf8mb4;"; char sql_insertPlayerOptions[] = "INSERT INTO ck_playeroptions2 (steamid) VALUES ('%s');"; -char sql_selectPlayerOptions[] = "SELECT timer, hide, sounds, chat, viewmodel, autobhop, checkpoints, gradient, speedmode, centrespeed, centrehud, module1c, module2c, module3c, module4c, module5c, module6c, sidehud, module1s, module2s, module3s, module4s, module5s FROM ck_playeroptions2 where steamid = '%s';"; -char sql_updatePlayerOptions[] = "UPDATE ck_playeroptions2 SET timer = %i, hide = %i, sounds = %i, chat = %i, viewmodel = %i, autobhop = %i, checkpoints = %i, gradient = %i, speedmode = %i, centrespeed = %i, centrehud = %i, module1c = %i, module2c = %i, module3c = %i, module4c = %i, module5c = %i, module6c = %i, sidehud = %i, module1s = %i, module2s = %i, module3s = %i, module4s = %i, module5s = %i where steamid = '%s'"; +char sql_selectPlayerOptions[] = "SELECT timer, hide, sounds, chat, viewmodel, autobhop, checkpoints, gradient, speedmode, centrespeed, centrehud, teleside, module1c, module2c, module3c, module4c, module5c, module6c, sidehud, module1s, module2s, module3s, module4s, module5s FROM ck_playeroptions2 where steamid = '%s';"; +char sql_updatePlayerOptions[] = "UPDATE ck_playeroptions2 SET timer = %i, hide = %i, sounds = %i, chat = %i, viewmodel = %i, autobhop = %i, checkpoints = %i, gradient = %i, speedmode = %i, centrespeed = %i, centrehud = %i, teleside = %i, module1c = %i, module2c = %i, module3c = %i, module4c = %i, module5c = %i, module6c = %i, sidehud = %i, module1s = %i, module2s = %i, module3s = %i, module4s = %i, module5s = %i where steamid = '%s'"; // ck_playerrank char sql_createPlayerRank[] = "CREATE TABLE IF NOT EXISTS `ck_playerrank` (`steamid` varchar(32) NOT NULL DEFAULT '', `steamid64` varchar(64) DEFAULT NULL, `name` varchar(32) DEFAULT NULL, `country` varchar(32) DEFAULT NULL, `points` int(12) DEFAULT '0', `wrpoints` int(12) NOT NULL DEFAULT '0', `wrbpoints` int(12) NOT NULL DEFAULT '0', `wrcppoints` int(11) NOT NULL DEFAULT '0', `top10points` int(12) NOT NULL DEFAULT '0', `groupspoints` int(12) NOT NULL DEFAULT '0', `mappoints` int(11) NOT NULL DEFAULT '0', `bonuspoints` int(12) NOT NULL DEFAULT '0', `finishedmaps` int(12) DEFAULT '0', `finishedmapspro` int(12) DEFAULT '0', `finishedbonuses` int(12) NOT NULL DEFAULT '0', `finishedstages` int(12) NOT NULL DEFAULT '0', `wrs` int(12) NOT NULL DEFAULT '0', `wrbs` int(12) NOT NULL DEFAULT '0', `wrcps` int(12) NOT NULL DEFAULT '0', `top10s` int(12) NOT NULL DEFAULT '0', `groups` int(12) NOT NULL DEFAULT '0', `lastseen` int(64) DEFAULT NULL, `joined` int(64) NOT NULL, `timealive` int(64) NOT NULL DEFAULT '0', `timespec` int(64) NOT NULL DEFAULT '0', `connections` int(64) NOT NULL DEFAULT '1', `readchangelog` int(11) NOT NULL DEFAULT '0', `style` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`steamid`, `style`)) DEFAULT CHARSET=utf8mb4;"; @@ -91,11 +91,11 @@ char sql_selectPlayerRankProTime[] = "SELECT name,mapname FROM ck_playertimes WH char sql_selectAllMapTimesinMap[] = "SELECT runtimepro from ck_playertimes WHERE mapname = '%s';"; // ck_spawnlocations -char sql_createSpawnLocations[] = "CREATE TABLE IF NOT EXISTS ck_spawnlocations (mapname VARCHAR(54) NOT NULL, pos_x FLOAT NOT NULL, pos_y FLOAT NOT NULL, pos_z FLOAT NOT NULL, ang_x FLOAT NOT NULL, ang_y FLOAT NOT NULL, ang_z FLOAT NOT NULL, `vel_x` float NOT NULL DEFAULT '0', `vel_y` float NOT NULL DEFAULT '0', `vel_z` float NOT NULL DEFAULT '0', zonegroup INT(12) DEFAULT 0, stage INT(12) DEFAULT 0, PRIMARY KEY(mapname, zonegroup, stage))DEFAULT CHARSET=utf8mb4;"; -char sql_insertSpawnLocations[] = "INSERT INTO ck_spawnlocations (mapname, pos_x, pos_y, pos_z, ang_x, ang_y, ang_z, vel_x, vel_y, vel_z, zonegroup) VALUES ('%s', '%f', '%f', '%f', '%f', '%f', '%f', '%f', '%f', '%f', %i);"; -char sql_updateSpawnLocations[] = "UPDATE ck_spawnlocations SET pos_x = '%f', pos_y = '%f', pos_z = '%f', ang_x = '%f', ang_y = '%f', ang_z = '%f', vel_x = '%f', vel_y = '%f', vel_z = '%f' WHERE mapname = '%s' AND zonegroup = %i"; -char sql_selectSpawnLocations[] = "SELECT mapname, pos_x, pos_y, pos_z, ang_x, ang_y, ang_z, vel_x, vel_y, vel_z, zonegroup, stage FROM ck_spawnlocations WHERE mapname ='%s';"; -char sql_deleteSpawnLocations[] = "DELETE FROM ck_spawnlocations WHERE mapname = '%s' AND zonegroup = %i AND stage = 1;"; +char sql_createSpawnLocations[] = "CREATE TABLE IF NOT EXISTS ck_spawnlocations (mapname VARCHAR(54) NOT NULL, pos_x FLOAT NOT NULL, pos_y FLOAT NOT NULL, pos_z FLOAT NOT NULL, ang_x FLOAT NOT NULL, ang_y FLOAT NOT NULL, ang_z FLOAT NOT NULL, `vel_x` float NOT NULL DEFAULT '0', `vel_y` float NOT NULL DEFAULT '0', `vel_z` float NOT NULL DEFAULT '0', zonegroup INT(12) DEFAULT 0, stage INT(12) DEFAULT 0, teleside INT(11) DEFAULT 0, PRIMARY KEY(mapname, zonegroup, stage, teleside)) DEFAULT CHARSET=utf8mb4;"; +char sql_insertSpawnLocations[] = "INSERT INTO ck_spawnlocations (mapname, pos_x, pos_y, pos_z, ang_x, ang_y, ang_z, vel_x, vel_y, vel_z, zonegroup, teleside) VALUES ('%s', '%f', '%f', '%f', '%f', '%f', '%f', '%f', '%f', '%f', %i, %i);"; +char sql_updateSpawnLocations[] = "UPDATE ck_spawnlocations SET pos_x = '%f', pos_y = '%f', pos_z = '%f', ang_x = '%f', ang_y = '%f', ang_z = '%f', vel_x = '%f', vel_y = '%f', vel_z = '%f' WHERE mapname = '%s' AND zonegroup = %i AND teleside = %i;"; +char sql_selectSpawnLocations[] = "SELECT mapname, pos_x, pos_y, pos_z, ang_x, ang_y, ang_z, vel_x, vel_y, vel_z, zonegroup, stage, teleside FROM ck_spawnlocations WHERE mapname ='%s';"; +char sql_deleteSpawnLocations[] = "DELETE FROM ck_spawnlocations WHERE mapname = '%s' AND zonegroup = %i AND stage = 1 AND teleside = %i;"; // ck_vipadmins (should rename this table..) char sql_createVipAdmins[] = "CREATE TABLE `ck_vipadmins` (`steamid` varchar(32) NOT NULL DEFAULT '', `title` varchar(128) DEFAULT '0', `namecolour` int(11) DEFAULT '0', `textcolour` int(11) NOT NULL DEFAULT '0', `joinmsg` varchar(255) DEFAULT 'none', `pbsound` varchar(256) NOT NULL DEFAULT 'none', `topsound` varchar(256) NOT NULL DEFAULT 'none', `wrsound` varchar(256) NOT NULL DEFAULT 'none', `inuse` int(11) DEFAULT '0', `vip` int(11) DEFAULT '0', `admin` int(11) NOT NULL DEFAULT '0', `zoner` int(11) NOT NULL DEFAULT '0', `active` int(11) NOT NULL DEFAULT '1', PRIMARY KEY (`steamid`), KEY `vip` (`steamid`,`vip`,`admin`,`zoner`)) DEFAULT CHARSET=utf8mb4;"; diff --git a/addons/sourcemod/scripting/surftimer/misc.sp b/addons/sourcemod/scripting/surftimer/misc.sp index 96294b5..95341b1 100644 --- a/addons/sourcemod/scripting/surftimer/misc.sp +++ b/addons/sourcemod/scripting/surftimer/misc.sp @@ -191,6 +191,9 @@ public void teleportClient(int client, int zonegroup, int zone, bool stopTime) realZone = 0; else realZone = zone; + + // Check clients tele side + int teleside = g_iTeleSide[client]; if (g_bStartposUsed[client][zonegroup]) { @@ -222,7 +225,7 @@ public void teleportClient(int client, int zonegroup, int zone, bool stopTime) return; } } - else if (g_bGotSpawnLocation[zonegroup][realZone]) + else if (g_bGotSpawnLocation[zonegroup][realZone][teleside]) { // Check if teleporting to bonus if (zonegroup > 0) @@ -242,7 +245,7 @@ public void teleportClient(int client, int zonegroup, int zone, bool stopTime) if (stopTime) Client_Stop(client, 0); - Array_Copy(g_fSpawnLocation[zonegroup][realZone], g_fTeleLocation[client], 3); + Array_Copy(g_fSpawnLocation[zonegroup][realZone][teleside], g_fTeleLocation[client], 3); g_specToStage[client] = true; g_bRespawnPosition[client] = false; @@ -265,7 +268,7 @@ public void teleportClient(int client, int zonegroup, int zone, bool stopTime) g_bInStageZone[client] = false; } - teleportEntitySafe(client, g_fSpawnLocation[zonegroup][realZone], g_fSpawnAngle[zonegroup][realZone], g_fSpawnVelocity[zonegroup][realZone], stopTime); + teleportEntitySafe(client, g_fSpawnLocation[zonegroup][realZone][teleside], g_fSpawnAngle[zonegroup][realZone][teleside], g_fSpawnVelocity[zonegroup][realZone][teleside], stopTime); return; } diff --git a/addons/sourcemod/scripting/surftimer/sql.sp b/addons/sourcemod/scripting/surftimer/sql.sp index 512bf70..96a3a1f 100644 --- a/addons/sourcemod/scripting/surftimer/sql.sp +++ b/addons/sourcemod/scripting/surftimer/sql.sp @@ -72,6 +72,10 @@ public void db_setupDatabase() { db_upgradeDatabase(2); } + else if (!SQL_FastQuery(g_hDb, "SELECT teleside FROM ck_playeroptions LIMIT 1")) + { + db_upgradeDatabase(3); + } } SQL_UnlockDatabase(g_hDb); @@ -148,6 +152,11 @@ public void db_upgradeDatabase(int ver) { SQL_FastQuery(g_hDb, "ALTER TABLE ck_playerrank ADD COLUMN wrcppoints INT(11) NOT NULL DEFAULT 0 AFTER `wrbpoints`;"); } + else if (ver == 3) + { + SQL_FastQuery(g_hDb, "ALTER TABLE ck_playeroptions2 ADD COLUMN teleside INT(11) NOT NULL DEFAULT 0 AFTER centrehud;"); + SQL_FastQuery(g_hDb, "ALTER TABLE ck_spawnlocations DROP PRIMARY KEY, ADD COLUMN teleside INT(11) NOT NULL DEFAULT 0 AFTER stage, ADD PRIMARY KEY (mapname, zonegroup, stage, teleside);"); + } SQL_UnlockDatabase(g_hDb); } @@ -344,26 +353,26 @@ public int callback_Confirm(Menu menu, MenuAction action, int client, int key) = SPAWN LOCATION = ==================================*/ -public void db_deleteSpawnLocations(int zGrp) +public void db_deleteSpawnLocations(int zGrp, int teleside) { - g_bGotSpawnLocation[zGrp][1] = false; + g_bGotSpawnLocation[zGrp][1][teleside] = false; char szQuery[128]; - Format(szQuery, 128, sql_deleteSpawnLocations, g_szMapName, zGrp); + Format(szQuery, 128, sql_deleteSpawnLocations, g_szMapName, zGrp, teleside); SQL_TQuery(g_hDb, SQL_CheckCallback, szQuery, 1, DBPrio_Low); } -public void db_updateSpawnLocations(float position[3], float angle[3], float vel[3], int zGrp) +public void db_updateSpawnLocations(float position[3], float angle[3], float vel[3], int zGrp, int teleside) { char szQuery[512]; - Format(szQuery, 512, sql_updateSpawnLocations, position[0], position[1], position[2], angle[0], angle[1], angle[2], vel[0], vel[1], vel[2], g_szMapName, zGrp); + Format(szQuery, 512, sql_updateSpawnLocations, position[0], position[1], position[2], angle[0], angle[1], angle[2], vel[0], vel[1], vel[2], g_szMapName, zGrp, teleside); SQL_TQuery(g_hDb, db_editSpawnLocationsCallback, szQuery, zGrp, DBPrio_Low); } -public void db_insertSpawnLocations(float position[3], float angle[3], float vel[3], int zGrp) +public void db_insertSpawnLocations(float position[3], float angle[3], float vel[3], int zGrp, int teleside) { char szQuery[512]; - Format(szQuery, 512, sql_insertSpawnLocations, g_szMapName, position[0], position[1], position[2], angle[0], angle[1], angle[2], vel[0], vel[1], vel[2], zGrp); + Format(szQuery, 512, sql_insertSpawnLocations, g_szMapName, position[0], position[1], position[2], angle[0], angle[1], angle[2], vel[0], vel[1], vel[2], zGrp, teleside); SQL_TQuery(g_hDb, db_editSpawnLocationsCallback, szQuery, zGrp, DBPrio_Low); } @@ -382,7 +391,10 @@ public void db_selectSpawnLocations() for (int s = 0; s < CPLIMIT; s++) { for (int i = 0; i < MAXZONEGROUPS; i++) - g_bGotSpawnLocation[i][s] = false; + { + g_bGotSpawnLocation[i][s][0] = false; + g_bGotSpawnLocation[i][s][1] = false; + } } char szQuery[254]; @@ -404,16 +416,20 @@ public void db_selectSpawnLocationsCallback(Handle owner, Handle hndl, const cha { while (SQL_FetchRow(hndl)) { - g_bGotSpawnLocation[SQL_FetchInt(hndl, 10)][SQL_FetchInt(hndl, 11)] = true; - g_fSpawnLocation[SQL_FetchInt(hndl, 10)][SQL_FetchInt(hndl, 11)][0] = SQL_FetchFloat(hndl, 1); - g_fSpawnLocation[SQL_FetchInt(hndl, 10)][SQL_FetchInt(hndl, 11)][1] = SQL_FetchFloat(hndl, 2); - g_fSpawnLocation[SQL_FetchInt(hndl, 10)][SQL_FetchInt(hndl, 11)][2] = SQL_FetchFloat(hndl, 3); - g_fSpawnAngle[SQL_FetchInt(hndl, 10)][SQL_FetchInt(hndl, 11)][0] = SQL_FetchFloat(hndl, 4); - g_fSpawnAngle[SQL_FetchInt(hndl, 10)][SQL_FetchInt(hndl, 11)][1] = SQL_FetchFloat(hndl, 5); - g_fSpawnAngle[SQL_FetchInt(hndl, 10)][SQL_FetchInt(hndl, 11)][2] = SQL_FetchFloat(hndl, 6); - g_fSpawnVelocity[SQL_FetchInt(hndl, 10)][SQL_FetchInt(hndl, 11)][0] = SQL_FetchFloat(hndl, 7); - g_fSpawnVelocity[SQL_FetchInt(hndl, 10)][SQL_FetchInt(hndl, 11)][1] = SQL_FetchFloat(hndl, 8); - g_fSpawnVelocity[SQL_FetchInt(hndl, 10)][SQL_FetchInt(hndl, 11)][2] = SQL_FetchFloat(hndl, 9); + int zonegroup = SQL_FetchInt(hndl, 10); + int stage = SQL_FetchInt(hndl, 11); + int teleside = SQL_FetchInt(hndl, 12); + + g_bGotSpawnLocation[zonegroup][stage][teleside] = true; + g_fSpawnLocation[zonegroup][stage][teleside][0] = SQL_FetchFloat(hndl, 1); + g_fSpawnLocation[zonegroup][stage][teleside][1] = SQL_FetchFloat(hndl, 2); + g_fSpawnLocation[zonegroup][stage][teleside][2] = SQL_FetchFloat(hndl, 3); + g_fSpawnAngle[zonegroup][stage][teleside][0] = SQL_FetchFloat(hndl, 4); + g_fSpawnAngle[zonegroup][stage][teleside][1] = SQL_FetchFloat(hndl, 5); + g_fSpawnAngle[zonegroup][stage][teleside][2] = SQL_FetchFloat(hndl, 6); + g_fSpawnVelocity[zonegroup][stage][teleside][0] = SQL_FetchFloat(hndl, 7); + g_fSpawnVelocity[zonegroup][stage][teleside][1] = SQL_FetchFloat(hndl, 8); + g_fSpawnVelocity[zonegroup][stage][teleside][2] = SQL_FetchFloat(hndl, 9); } } @@ -5425,18 +5441,19 @@ public void db_viewPlayerOptionsCallback(Handle owner, Handle hndl, const char[] g_SpeedMode[client] = SQL_FetchInt(hndl, 8); g_bCenterSpeedDisplay[client] = view_as(SQL_FetchInt(hndl, 9)); g_bCentreHud[client] = view_as(SQL_FetchInt(hndl, 10)); - g_iCentreHudModule[client][0] = SQL_FetchInt(hndl, 11); - g_iCentreHudModule[client][1] = SQL_FetchInt(hndl, 12); - g_iCentreHudModule[client][2] = SQL_FetchInt(hndl, 13); - g_iCentreHudModule[client][3] = SQL_FetchInt(hndl, 14); - g_iCentreHudModule[client][4] = SQL_FetchInt(hndl, 15); - g_iCentreHudModule[client][5] = SQL_FetchInt(hndl, 16); - g_bSideHud[client] = view_as(SQL_FetchInt(hndl, 17)); - g_iSideHudModule[client][0] = SQL_FetchInt(hndl, 18); - g_iSideHudModule[client][1] = SQL_FetchInt(hndl, 19); - g_iSideHudModule[client][2] = SQL_FetchInt(hndl, 20); - g_iSideHudModule[client][3] = SQL_FetchInt(hndl, 21); - g_iSideHudModule[client][4] = SQL_FetchInt(hndl, 22); + g_iTeleSide[client] = SQL_FetchInt(hndl, 11); + g_iCentreHudModule[client][0] = SQL_FetchInt(hndl, 12); + g_iCentreHudModule[client][1] = SQL_FetchInt(hndl, 13); + g_iCentreHudModule[client][2] = SQL_FetchInt(hndl, 14); + g_iCentreHudModule[client][3] = SQL_FetchInt(hndl, 15); + g_iCentreHudModule[client][4] = SQL_FetchInt(hndl, 16); + g_iCentreHudModule[client][5] = SQL_FetchInt(hndl, 17); + g_bSideHud[client] = view_as(SQL_FetchInt(hndl, 18)); + g_iSideHudModule[client][0] = SQL_FetchInt(hndl, 19); + g_iSideHudModule[client][1] = SQL_FetchInt(hndl, 20); + g_iSideHudModule[client][2] = SQL_FetchInt(hndl, 21); + g_iSideHudModule[client][3] = SQL_FetchInt(hndl, 22); + g_iSideHudModule[client][4] = SQL_FetchInt(hndl, 23); // Functionality for normal spec list if (g_iSideHudModule[client][0] == 5 && (g_iSideHudModule[client][1] == 0 && g_iSideHudModule[client][2] == 0 && g_iSideHudModule[client][3] == 0 && g_iSideHudModule[client][4] == 0)) @@ -5468,6 +5485,7 @@ public void db_viewPlayerOptionsCallback(Handle owner, Handle hndl, const char[] g_SpeedMode[client] = 0; g_bCenterSpeedDisplay[client] = false; g_bCentreHud[client] = true; + g_iTeleSide[client] = 0; g_iCentreHudModule[client][0] = 1; g_iCentreHudModule[client][1] = 2; g_iCentreHudModule[client][2] = 3; @@ -5501,7 +5519,7 @@ public void db_updatePlayerOptions(int client) // "UPDATE ck_playeroptions2 SET timer = %i, hide = %i, sounds = %i, chat = %i, viewmodel = %i, autobhop = %i, checkpoints = %i, centrehud = %i, module1c = %i, module2c = %i, module3c = %i, module4c = %i, module5c = %i, module6c = %i, sidehud = %i, module1s = %i, module2s = %i, module3s = %i, module4s = %i, module5s = %i where steamid = '%s'"; if (g_bSettingsLoaded[client] && g_bServerDataLoaded && g_bLoadedModules[client]) { - Format(szQuery, 1024, sql_updatePlayerOptions, BooltoInt(g_bTimerEnabled[client]), BooltoInt(g_bHide[client]), BooltoInt(g_bEnableQuakeSounds[client]), BooltoInt(g_bHideChat[client]), BooltoInt(g_bViewModel[client]), BooltoInt(g_bAutoBhopClient[client]), BooltoInt(g_bCheckpointsEnabled[client]), g_SpeedGradient[client], g_SpeedMode[client], BooltoInt(g_bCenterSpeedDisplay[client]), BooltoInt(g_bCentreHud[client]), g_iCentreHudModule[client][0], g_iCentreHudModule[client][1], g_iCentreHudModule[client][2], g_iCentreHudModule[client][3], g_iCentreHudModule[client][4], g_iCentreHudModule[client][5], BooltoInt(g_bSideHud[client]), g_iSideHudModule[client][0], g_iSideHudModule[client][1], g_iSideHudModule[client][2], g_iSideHudModule[client][3], g_iSideHudModule[client][4], g_szSteamID[client]); + Format(szQuery, 1024, sql_updatePlayerOptions, BooltoInt(g_bTimerEnabled[client]), BooltoInt(g_bHide[client]), BooltoInt(g_bEnableQuakeSounds[client]), BooltoInt(g_bHideChat[client]), BooltoInt(g_bViewModel[client]), BooltoInt(g_bAutoBhopClient[client]), BooltoInt(g_bCheckpointsEnabled[client]), g_SpeedGradient[client], g_SpeedMode[client], BooltoInt(g_bCenterSpeedDisplay[client]), BooltoInt(g_bCentreHud[client]), g_iTeleSide[client], g_iCentreHudModule[client][0], g_iCentreHudModule[client][1], g_iCentreHudModule[client][2], g_iCentreHudModule[client][3], g_iCentreHudModule[client][4], g_iCentreHudModule[client][5], BooltoInt(g_bSideHud[client]), g_iSideHudModule[client][0], g_iSideHudModule[client][1], g_iSideHudModule[client][2], g_iSideHudModule[client][3], g_iSideHudModule[client][4], g_szSteamID[client]); SQL_TQuery(g_hDb, SQL_CheckCallback, szQuery, client, DBPrio_Low); } }