mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-06 18:08:26 +00:00
Merge branch 'master' into vscript
This commit is contained in:
commit
3dd6149983
@ -35,6 +35,7 @@
|
||||
// Physics
|
||||
"airaccelerate" "1000.0" // sv_airaccelerate value for the style.
|
||||
"runspeed" "260.00" // Running speed. Requires DHooks, shavit-misc and shavit_misc_staticprestrafe set to 1.
|
||||
"maxprestrafe" "0.0" // The max prestrafe that still allows your timer to start/restart. You generally do *not* need or want to change this unless for surf things (combined with style-setting "prespeed_type" "6" or cvar "shavit_misc_prespeed 6"). Default is 0.0 (disabled).
|
||||
"gravity" "1.0" // Gravity setting, 1.0 for default. Standard for low gravity styles is 0.6.
|
||||
"speed" "1.0" // Speed multiplier, 1.0 for default. Standard for slowmo styles is 0.5. This a multiplier for m_flLaggedMovementValue.
|
||||
"timescale" "1.0" // Timing will scale with this setting. This is a multiplier for m_flLaggedMovementValue but also affects the timer increase speed.
|
||||
|
||||
@ -53,6 +53,7 @@ enum
|
||||
Migration_DeprecateExactTimeInt,
|
||||
Migration_AddPlayertimesAuthFK,
|
||||
Migration_FixSQLiteMapzonesROWID,
|
||||
Migration_AddUsersFirstLogin,
|
||||
MIGRATIONS_END
|
||||
};
|
||||
|
||||
@ -87,6 +88,7 @@ char gS_MigrationNames[][] = {
|
||||
"DeprecateExactTimeInt",
|
||||
"AddPlayertimesAuthFK",
|
||||
"FixSQLiteMapzonesROWID",
|
||||
"AddUsersFirstLogin",
|
||||
};
|
||||
|
||||
static Database gH_SQL;
|
||||
@ -133,13 +135,13 @@ public void SQL_CreateTables(Database hSQL, const char[] prefix, int driver)
|
||||
if (driver == Driver_mysql)
|
||||
{
|
||||
FormatEx(sQuery, sizeof(sQuery),
|
||||
"CREATE TABLE IF NOT EXISTS `%susers` (`auth` INT NOT NULL, `name` VARCHAR(32) COLLATE 'utf8mb4_general_ci', `ip` INT, `lastlogin` INT NOT NULL DEFAULT -1, `points` FLOAT NOT NULL DEFAULT 0, `playtime` FLOAT NOT NULL DEFAULT 0, PRIMARY KEY (`auth`), INDEX `points` (`points`), INDEX `lastlogin` (`lastlogin`)) ENGINE=INNODB;",
|
||||
"CREATE TABLE IF NOT EXISTS `%susers` (`auth` INT NOT NULL, `name` VARCHAR(32) COLLATE 'utf8mb4_general_ci', `ip` INT, `lastlogin` INT NOT NULL DEFAULT -1, `firstlogin` INT NOT NULL DEFAULT -1, `points` FLOAT NOT NULL DEFAULT 0, `playtime` FLOAT NOT NULL DEFAULT 0, PRIMARY KEY (`auth`), INDEX `points` (`points`), INDEX `lastlogin` (`lastlogin`)) ENGINE=INNODB;",
|
||||
gS_SQLPrefix);
|
||||
}
|
||||
else
|
||||
{
|
||||
FormatEx(sQuery, sizeof(sQuery),
|
||||
"CREATE TABLE IF NOT EXISTS `%susers` (`auth` INT NOT NULL PRIMARY KEY, `name` VARCHAR(32), `ip` INT, `lastlogin` INTEGER NOT NULL DEFAULT -1, `points` FLOAT NOT NULL DEFAULT 0, `playtime` FLOAT NOT NULL DEFAULT 0);",
|
||||
"CREATE TABLE IF NOT EXISTS `%susers` (`auth` INT NOT NULL PRIMARY KEY, `name` VARCHAR(32), `ip` INT, `lastlogin` INTEGER NOT NULL DEFAULT -1, `firstlogin` INTEGER NOT NULL DEFAULT -1, `points` FLOAT NOT NULL DEFAULT 0, `playtime` FLOAT NOT NULL DEFAULT 0);",
|
||||
gS_SQLPrefix);
|
||||
}
|
||||
|
||||
@ -369,6 +371,7 @@ void ApplyMigration(int migration)
|
||||
case Migration_DeprecateExactTimeInt: ApplyMigration_DeprecateExactTimeInt();
|
||||
case Migration_AddPlayertimesAuthFK: ApplyMigration_AddPlayertimesAuthFK();
|
||||
case Migration_FixSQLiteMapzonesROWID: ApplyMigration_FixSQLiteMapzonesROWID();
|
||||
case Migration_AddUsersFirstLogin: ApplyMigration_AddUsersFirstLogin();
|
||||
}
|
||||
}
|
||||
|
||||
@ -686,6 +689,20 @@ public void Trans_FixSQLiteMapzonesROWID_Error(Database db, any data, int numQue
|
||||
LogError("Timer error! SQLiteMapzonesROWID migration transaction failed. Reason: %s", error);
|
||||
}
|
||||
|
||||
void ApplyMigration_AddUsersFirstLogin()
|
||||
{
|
||||
char sQuery[256];
|
||||
FormatEx(sQuery, sizeof(sQuery), "ALTER TABLE %susers ADD `firstlogin` INT NOT NULL DEFAULT -1 %s;", gS_SQLPrefix, (gI_Driver == Driver_mysql) ? "AFTER `lastlogin`" : "");
|
||||
QueryLog(gH_SQL, ApplyMigration_AddUsersFirstLogin2222222_Callback, sQuery, Migration_AddUsersFirstLogin, DBPrio_High);
|
||||
}
|
||||
|
||||
public void ApplyMigration_AddUsersFirstLogin2222222_Callback(Database db, DBResultSet results, const char[] error, any data)
|
||||
{
|
||||
char sQuery[256];
|
||||
FormatEx(sQuery, sizeof(sQuery), "UPDATE %susers SET firstlogin = lastlogin WHERE lastlogin > 0;", gS_SQLPrefix);
|
||||
QueryLog(gH_SQL, SQL_TableMigrationSingleQuery_Callback, sQuery, Migration_AddUsersFirstLogin, DBPrio_High);
|
||||
}
|
||||
|
||||
public void SQL_TableMigrationSingleQuery_Callback(Database db, DBResultSet results, const char[] error, any data)
|
||||
{
|
||||
InsertMigration(data);
|
||||
|
||||
@ -164,6 +164,7 @@ public SMCResult OnStyleEnterSection(SMCParser smc, const char[] name, bool opt_
|
||||
|
||||
SetStyleSettingFloat(gI_CurrentParserIndex, "airaccelerate", 1000.0);
|
||||
SetStyleSettingFloat(gI_CurrentParserIndex, "runspeed", 260.00);
|
||||
SetStyleSettingFloat(gI_CurrentParserIndex, "maxprestrafe", 0.0);
|
||||
SetStyleSettingFloat(gI_CurrentParserIndex, "gravity", 1.0);
|
||||
SetStyleSettingFloat(gI_CurrentParserIndex, "speed", 1.0);
|
||||
SetStyleSettingInt (gI_CurrentParserIndex, "halftime", 0);
|
||||
|
||||
@ -182,6 +182,7 @@ char gS_Verification[MAXPLAYERS+1][8];
|
||||
bool gB_CookiesRetrieved[MAXPLAYERS+1];
|
||||
float gF_ZoneAiraccelerate[MAXPLAYERS+1];
|
||||
float gF_ZoneSpeedLimit[MAXPLAYERS+1];
|
||||
float gF_ZoneStartSpeedLimit[MAXPLAYERS+1];
|
||||
int gI_LastPrintedSteamID[MAXPLAYERS+1];
|
||||
|
||||
// kz support
|
||||
@ -1648,8 +1649,11 @@ void ChangeClientStyle(int client, int style, bool manual)
|
||||
char sStyle[4];
|
||||
IntToString(style, sStyle, 4);
|
||||
|
||||
if(gB_StyleCookies)
|
||||
{
|
||||
SetClientCookie(client, gH_StyleCookie, sStyle);
|
||||
}
|
||||
}
|
||||
|
||||
public void Player_Jump(Event event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
@ -2551,7 +2555,23 @@ bool CanStartTimer(int client, int track, bool skipGroundCheck)
|
||||
if (curVel <= 50.0)
|
||||
return true;
|
||||
|
||||
float prestrafe = StyleMaxPrestrafe(style);
|
||||
float cfgMax = GetStyleSettingFloat(style, "maxprestrafe");
|
||||
float zoneMax = gF_ZoneStartSpeedLimit[client];
|
||||
float prestrafe;
|
||||
|
||||
if (zoneMax > 0.0)
|
||||
{
|
||||
prestrafe = zoneMax;
|
||||
}
|
||||
else if (cfgMax > 0.0)
|
||||
{
|
||||
prestrafe = cfgMax;
|
||||
}
|
||||
else
|
||||
{
|
||||
prestrafe = StyleMaxPrestrafe(style);
|
||||
}
|
||||
|
||||
if (curVel > prestrafe)
|
||||
return false;
|
||||
|
||||
@ -2830,14 +2850,14 @@ public void OnClientAuthorized(int client, const char[] auth)
|
||||
if (gI_Driver == Driver_mysql)
|
||||
{
|
||||
FormatEx(sQuery, 512,
|
||||
"INSERT INTO %susers (auth, name, ip, lastlogin) VALUES (%d, '%s', %d, %d) ON DUPLICATE KEY UPDATE name = '%s', ip = %d, lastlogin = %d;",
|
||||
gS_MySQLPrefix, iSteamID, sEscapedName, iIPAddress, iTime, sEscapedName, iIPAddress, iTime);
|
||||
"INSERT INTO %susers (auth, name, ip, lastlogin, firstlogin) VALUES (%d, '%s', %d, %d, %d) ON DUPLICATE KEY UPDATE name = '%s', ip = %d, lastlogin = %d;",
|
||||
gS_MySQLPrefix, iSteamID, sEscapedName, iIPAddress, iTime, iTime, sEscapedName, iIPAddress, iTime);
|
||||
}
|
||||
else // postgresql & sqlite
|
||||
{
|
||||
FormatEx(sQuery, 512,
|
||||
"INSERT INTO %susers (auth, name, ip, lastlogin) VALUES (%d, '%s', %d, %d) ON CONFLICT(auth) DO UPDATE SET name = '%s', ip = %d, lastlogin = %d;",
|
||||
gS_MySQLPrefix, iSteamID, sEscapedName, iIPAddress, iTime, sEscapedName, iIPAddress, iTime);
|
||||
"INSERT INTO %susers (auth, name, ip, lastlogin, firstlogin) VALUES (%d, '%s', %d, %d, %d) ON CONFLICT(auth) DO UPDATE SET name = '%s', ip = %d, lastlogin = %d;",
|
||||
gS_MySQLPrefix, iSteamID, sEscapedName, iIPAddress, iTime, iTime, sEscapedName, iIPAddress, iTime);
|
||||
}
|
||||
|
||||
QueryLog(gH_SQL, SQL_InsertUser_Callback, sQuery, GetClientSerial(client));
|
||||
@ -2949,7 +2969,11 @@ void SQL_DBConnect()
|
||||
|
||||
public void Shavit_OnEnterZone(int client, int type, int track, int id, int entity, int data)
|
||||
{
|
||||
if (type == Zone_Airaccelerate && track == gA_Timers[client].iTimerTrack)
|
||||
if (type == Zone_Start && track == gA_Timers[client].iTimerTrack)
|
||||
{
|
||||
gF_ZoneStartSpeedLimit[client] = float(data);
|
||||
}
|
||||
else if (type == Zone_Airaccelerate && track == gA_Timers[client].iTimerTrack)
|
||||
{
|
||||
gF_ZoneAiraccelerate[client] = float(data);
|
||||
}
|
||||
@ -2971,7 +2995,7 @@ public void Shavit_OnLeaveZone(int client, int type, int track, int id, int enti
|
||||
// Probably so very niche that it doesn't matter.
|
||||
if (track != gA_Timers[client].iTimerTrack)
|
||||
return;
|
||||
if (type != Zone_Airaccelerate && type != Zone_CustomSpeedLimit && type != Zone_Autobhop)
|
||||
if (type != Zone_Airaccelerate && type != Zone_CustomSpeedLimit && type != Zone_Autobhop && type != Zone_Start)
|
||||
return;
|
||||
|
||||
UpdateStyleSettings(client);
|
||||
|
||||
@ -74,6 +74,8 @@ Function gH_AfterWarningMenu[MAXPLAYERS+1];
|
||||
int gI_LastWeaponTick[MAXPLAYERS+1];
|
||||
int gI_LastNoclipTick[MAXPLAYERS+1];
|
||||
int gI_LastStopInfo[MAXPLAYERS+1];
|
||||
int gI_LastGroundLandTick[MAXPLAYERS+1];
|
||||
float gF_ZoneStartSpeedLimit[MAXPLAYERS+1];
|
||||
|
||||
// cookies
|
||||
Handle gH_HideCookie = null;
|
||||
@ -112,6 +114,7 @@ Convar gCV_StopTimerWarning = null;
|
||||
Convar gCV_WRMessages = null;
|
||||
Convar gCV_BhopSounds = null;
|
||||
Convar gCV_RestrictNoclip = null;
|
||||
Convar gCV_UnNoclipOnRestart = null;
|
||||
Convar gCV_SpecScoreboardOrder = null;
|
||||
Convar gCV_BadSetLocalAnglesFix = null;
|
||||
ConVar gCV_PauseMovement = null;
|
||||
@ -265,7 +268,7 @@ public void OnPluginStart()
|
||||
|
||||
// cvars and stuff
|
||||
gCV_GodMode = new Convar("shavit_misc_godmode", "3", "Enable godmode for players?\n0 - Disabled\n1 - Only prevent fall/world damage.\n2 - Only prevent damage from other players.\n3 - Full godmode.\n4 - Prevent fall/world/entity damage (all except damage from other players).", 0, true, 0.0, true, 4.0);
|
||||
gCV_PreSpeed = new Convar("shavit_misc_prespeed", "2", "Stop prespeeding in the start zone?\n0 - Disabled, fully allow prespeeding.\n1 - Limit relatively to prestrafelimit.\n2 - Block bunnyhopping in startzone.\n3 - Limit to prestrafelimit and block bunnyhopping.\n4 - Limit to prestrafelimit but allow prespeeding. Combine with shavit_core_nozaxisspeed 1 for SourceCode timer's behavior.\n5 - Limit horizontal speed to prestrafe but allow prespeeding.", 0, true, 0.0, true, 5.0);
|
||||
gCV_PreSpeed = new Convar("shavit_misc_prespeed", "2", "Stop prespeeding in the start zone?\n0 - Disabled, fully allow prespeeding.\n1 - Limit relatively to prestrafelimit.\n2 - Block bunnyhopping in startzone.\n3 - Limit to prestrafelimit and block bunnyhopping.\n4 - Limit to prestrafelimit but allow prespeeding. Combine with shavit_core_nozaxisspeed 1 for SourceCode timer's behavior.\n5 - Limit horizontal speed to prestrafe but allow prespeeding. \n6 - Limit horizontal speed to prestrafe and block bunnyhopping.", 0, true, 0.0, true, 5.0);
|
||||
gCV_HideTeamChanges = new Convar("shavit_misc_hideteamchanges", "1", "Hide team changes in chat?\n0 - Disabled\n1 - Enabled", 0, true, 0.0, true, 1.0);
|
||||
gCV_RespawnOnTeam = new Convar("shavit_misc_respawnonteam", "1", "Respawn whenever a player joins a team?\n0 - Disabled\n1 - Enabled", 0, true, 0.0, true, 1.0);
|
||||
gCV_RespawnOnRestart = new Convar("shavit_misc_respawnonrestart", "1", "Respawn a dead player if they use the timer restart command?\n0 - Disabled\n1 - Enabled", 0, true, 0.0, true, 1.0);
|
||||
@ -295,6 +298,7 @@ public void OnPluginStart()
|
||||
gCV_WRMessages = new Convar("shavit_misc_wrmessages", "3", "How many \"NEW <style> WR!!!\" messages to print?\n0 - Disabled", 0, true, 0.0, true, 100.0);
|
||||
gCV_BhopSounds = new Convar("shavit_misc_bhopsounds", "1", "Should bhop (landing and jumping) sounds be muted?\n1 - Blocked while !hide is enabled\n2 - Always blocked", 0, true, 1.0, true, 2.0);
|
||||
gCV_RestrictNoclip = new Convar("shavit_misc_restrictnoclip", "0", "Should noclip be be restricted\n0 - Disabled\n1 - No vertical velocity while in noclip in start zone\n2 - No noclip in start zone", 0, true, 0.0, true, 2.0);
|
||||
gCV_UnNoclipOnRestart = new Convar("shavit_misc_unnocliponrestart", "1", "Should noclip be disabled when a player restarts their timer while in noclip?\n0 - Disabled\n1 - Normal movement will be restored on restart", 0, true, 0.0, true, 1.0);
|
||||
gCV_SpecScoreboardOrder = new Convar("shavit_misc_spec_scoreboard_order", "1", "Use scoreboard ordering for players when changing target when spectating.", 0, true, 0.0, true, 1.0);
|
||||
|
||||
if (gEV_Type != Engine_TF2)
|
||||
@ -1347,7 +1351,14 @@ public Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float
|
||||
prespeed_type = gCV_PreSpeed.IntValue;
|
||||
}
|
||||
|
||||
int tickCount = GetGameTickCount();
|
||||
int iPrevGroundEntity = (gI_GroundEntity[client] != -1) ? EntRefToEntIndex(gI_GroundEntity[client]) : -1;
|
||||
|
||||
if (iPrevGroundEntity == -1 && iGroundEntity != -1)
|
||||
{
|
||||
gI_LastGroundLandTick[client] = tickCount;
|
||||
}
|
||||
|
||||
if ((prespeed_type == 2 || prespeed_type == 3) && iPrevGroundEntity == -1 && iGroundEntity != -1 && (buttons & IN_JUMP) > 0)
|
||||
{
|
||||
DumbSetVelocity(client, view_as<float>({0.0, 0.0, 0.0}));
|
||||
@ -1358,6 +1369,22 @@ public Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float
|
||||
GetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", fSpeed);
|
||||
|
||||
float fLimit = (Shavit_GetStyleSettingFloat(gI_Style[client], "runspeed") + gCV_PrestrafeLimit.FloatValue);
|
||||
float cfgLimit = Shavit_GetStyleSettingFloat(gI_Style[client], "maxprestrafe");
|
||||
float zoneLimit = gF_ZoneStartSpeedLimit[client];
|
||||
float maxPrestrafe = StyleMaxPrestrafe(gI_Style[client]);
|
||||
|
||||
if (zoneLimit > 0.0)
|
||||
{
|
||||
fLimit = zoneLimit;
|
||||
}
|
||||
else if (cfgLimit > 0.0)
|
||||
{
|
||||
fLimit = cfgLimit;
|
||||
}
|
||||
else if (fLimit > maxPrestrafe)
|
||||
{
|
||||
fLimit = maxPrestrafe;
|
||||
}
|
||||
|
||||
// if trying to jump, add a very low limit to stop prespeeding in an elegant way
|
||||
// otherwise, make sure nothing weird is happening (such as sliding at ridiculous speeds, at zone enter)
|
||||
@ -1366,12 +1393,30 @@ public Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float
|
||||
fLimit /= 3.0;
|
||||
}
|
||||
|
||||
int iOldButtons = GetEntProp(client, Prop_Data, "m_nOldButtons");
|
||||
// TODO: somehow incorporate the autobhop style thingy or figure out a better way to do all of this lmao
|
||||
int iAutoBhop = Shavit_GetStyleSettingBool(Shavit_GetBhopStyle(client), "autobhop");
|
||||
bool isJumping = (buttons & IN_JUMP) > 0;
|
||||
if (!iAutoBhop)
|
||||
{
|
||||
isJumping = isJumping && (iOldButtons & IN_JUMP) == 0;
|
||||
}
|
||||
if (
|
||||
prespeed_type == 6
|
||||
&& iGroundEntity != -1
|
||||
&& tickCount - gI_LastGroundLandTick[client] <= 150
|
||||
&& isJumping
|
||||
)
|
||||
{
|
||||
fLimit /= 3.0;
|
||||
}
|
||||
|
||||
float fSpeedXY = (SquareRoot(Pow(fSpeed[0], 2.0) + Pow(fSpeed[1], 2.0)));
|
||||
float fScale = (fLimit / fSpeedXY);
|
||||
|
||||
if(fScale < 1.0)
|
||||
{
|
||||
if (prespeed_type == 5)
|
||||
if (prespeed_type == 5 || prespeed_type == 6)
|
||||
{
|
||||
float zSpeed = fSpeed[2];
|
||||
fSpeed[2] = 0.0;
|
||||
@ -1426,6 +1471,14 @@ public Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
public void Shavit_OnEnterZone(int client, int type, int track, int id, int entity, int data)
|
||||
{
|
||||
if (type == Zone_Start && track == Shavit_GetClientTrack(client))
|
||||
{
|
||||
gF_ZoneStartSpeedLimit[client] = float(data);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnClientPutInServer(int client)
|
||||
{
|
||||
SDKHook(client, SDKHook_SetTransmit, OnSetTransmit);
|
||||
@ -1437,6 +1490,7 @@ public void OnClientPutInServer(int client)
|
||||
|
||||
gI_LastWeaponTick[client] = 0;
|
||||
gI_LastNoclipTick[client] = 0;
|
||||
gI_LastGroundLandTick[client] = 0;
|
||||
|
||||
if(IsFakeClient(client))
|
||||
{
|
||||
@ -2288,8 +2342,22 @@ public Action Shavit_OnStartPre(int client, int track, bool& skipGroundTimer)
|
||||
GetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", fSpeed);
|
||||
|
||||
float fLimit = (Shavit_GetStyleSettingFloat(gI_Style[client], "runspeed") + gCV_PrestrafeLimit.FloatValue);
|
||||
float cfgLimit = Shavit_GetStyleSettingFloat(gI_Style[client], "maxprestrafe");
|
||||
float zoneLimit = gF_ZoneStartSpeedLimit[client];
|
||||
float maxPrestrafe = StyleMaxPrestrafe(gI_Style[client]);
|
||||
if (fLimit > maxPrestrafe) fLimit = maxPrestrafe;
|
||||
|
||||
if (zoneLimit > 0.0)
|
||||
{
|
||||
fLimit = zoneLimit;
|
||||
}
|
||||
else if (cfgLimit > 0.0)
|
||||
{
|
||||
fLimit = cfgLimit;
|
||||
}
|
||||
else if (fLimit > maxPrestrafe)
|
||||
{
|
||||
fLimit = maxPrestrafe;
|
||||
}
|
||||
|
||||
// if trying to jump, add a very low limit to stop prespeeding in an elegant way
|
||||
// otherwise, make sure nothing weird is happening (such as sliding at ridiculous speeds, at zone enter)
|
||||
@ -2303,7 +2371,7 @@ public Action Shavit_OnStartPre(int client, int track, bool& skipGroundTimer)
|
||||
|
||||
if(fScale < 1.0)
|
||||
{
|
||||
if (prespeed_type == 5)
|
||||
if (prespeed_type == 5 || prespeed_type == 6)
|
||||
{
|
||||
float zSpeed = fSpeed[2];
|
||||
fSpeed[2] = 0.0;
|
||||
@ -2378,6 +2446,11 @@ public void Shavit_OnRestart(int client, int track)
|
||||
SetEntProp(client, Prop_Send, "m_bHasHelmet", 1);
|
||||
}
|
||||
}
|
||||
|
||||
if(gCV_UnNoclipOnRestart.BoolValue)
|
||||
{
|
||||
SetEntityMoveType(client, MOVETYPE_WALK);
|
||||
}
|
||||
}
|
||||
|
||||
public Action Shavit_OnStyleCommandPre(int client, int oldstyle, int newstyle, int track)
|
||||
|
||||
@ -890,9 +890,9 @@ Action OpenStatsMenu_Main(int steamid, int style, DataPack data)
|
||||
char sQuery[2048];
|
||||
|
||||
FormatEx(sQuery, sizeof(sQuery),
|
||||
"SELECT 0, points, lastlogin, ip, playtime, name FROM %susers WHERE auth = %d\n" ...
|
||||
"UNION ALL SELECT 1, SUM(playtime), 0, 0, 0, '' FROM %sstyleplaytime WHERE auth = %d AND style = %d\n" ...
|
||||
"UNION ALL SELECT 2, COUNT(*), 0, 0, 0, '' FROM %susers u1\n" ...
|
||||
"SELECT 0, points, lastlogin, firstlogin, ip, playtime, name FROM %susers WHERE auth = %d\n" ...
|
||||
"UNION ALL SELECT 1, SUM(playtime), 0, 0, 0, 0, '' FROM %sstyleplaytime WHERE auth = %d AND style = %d\n" ...
|
||||
"UNION ALL SELECT 2, COUNT(*), 0, 0, 0, 0, '' FROM %susers u1\n" ...
|
||||
" JOIN (SELECT points FROM %susers WHERE auth = %d) u2\n" ...
|
||||
" WHERE u1.points >= u2.points",
|
||||
gS_MySQLPrefix, steamid,
|
||||
@ -960,6 +960,7 @@ public void OpenStatsMenuCallback(Database db, DBResultSet results, const char[]
|
||||
|
||||
float fPoints;
|
||||
char sLastLogin[32];
|
||||
char sFirstLogin[32];
|
||||
char sCountry[64];
|
||||
char sPlaytime[16];
|
||||
|
||||
@ -989,7 +990,11 @@ public void OpenStatsMenuCallback(Database db, DBResultSet results, const char[]
|
||||
FormatTime(sLastLogin, 32, "%Y-%m-%d %H:%M:%S", iLastLogin);
|
||||
Format(sLastLogin, 32, "%T: %s", "LastLogin", client, (iLastLogin != -1)? sLastLogin:"N/A");
|
||||
|
||||
int iIPAddress = results.FetchInt(3);
|
||||
int iFirstLogin = results.FetchInt(3);
|
||||
FormatTime(sFirstLogin, 32, "%Y-%m-%d %H:%M:%S", iFirstLogin);
|
||||
Format(sFirstLogin, 32, "%T: %s", "FirstLogin", client, (iFirstLogin != -1)? sFirstLogin:"N/A");
|
||||
|
||||
int iIPAddress = results.FetchInt(4);
|
||||
char sIPAddress[32];
|
||||
IPAddressToString(iIPAddress, sIPAddress, 32);
|
||||
|
||||
@ -998,10 +1003,10 @@ public void OpenStatsMenuCallback(Database db, DBResultSet results, const char[]
|
||||
sCountry = "Local Area Network";
|
||||
}
|
||||
|
||||
float fPlaytime = results.FetchFloat(4);
|
||||
float fPlaytime = results.FetchFloat(5);
|
||||
FormatSeconds(fPlaytime, sPlaytime, sizeof(sPlaytime), false, true, true);
|
||||
|
||||
results.FetchString(5, gS_TargetName[client], MAX_NAME_LENGTH);
|
||||
results.FetchString(6, gS_TargetName[client], MAX_NAME_LENGTH);
|
||||
ReplaceString(gS_TargetName[client], MAX_NAME_LENGTH, "#", "?");
|
||||
}
|
||||
else if (type == 1)
|
||||
@ -1056,8 +1061,8 @@ public void OpenStatsMenuCallback(Database db, DBResultSet results, const char[]
|
||||
}
|
||||
|
||||
Menu menu = new Menu(MenuHandler_ProfileHandler);
|
||||
menu.SetTitle("%s's %T. [U:1:%u]\n%T: %s\n%s\n%s\n%T: %s\n",
|
||||
gS_TargetName[client], "Profile", client, gI_TargetSteamID[client], "Country", client, sCountry, sLastLogin,
|
||||
menu.SetTitle("%s's %T. [U:1:%u]\n%T: %s\n%s\n%s\n%s\n%T: %s\n",
|
||||
gS_TargetName[client], "Profile", client, gI_TargetSteamID[client], "Country", client, sCountry, sFirstLogin, sLastLogin,
|
||||
sRankingString, "Playtime", client, sPlaytime);
|
||||
|
||||
int[] styles = new int[gI_Styles];
|
||||
|
||||
@ -4406,7 +4406,20 @@ void CreateEditMenu(int client, bool autostage=false)
|
||||
FormatEx(sMenuItem, 64, "%T", "ZoneForceRender", client, ((gA_EditCache[client].iFlags & ZF_ForceRender) > 0)? "+":"-");
|
||||
menu.AddItem("forcerender", sMenuItem);
|
||||
|
||||
if (gA_EditCache[client].iType == Zone_Stage)
|
||||
if (gA_EditCache[client].iType == Zone_Start)
|
||||
{
|
||||
if (gA_EditCache[client].iData == 0)
|
||||
{
|
||||
FormatEx(sMenuItem, 64, "%T", "ZoneSetSpeedLimitDefault", client, gA_EditCache[client].iData);
|
||||
}
|
||||
else
|
||||
{
|
||||
FormatEx(sMenuItem, 64, "%T", "ZoneSetSpeedLimit", client, gA_EditCache[client].iData);
|
||||
}
|
||||
|
||||
menu.AddItem("datafromchat", sMenuItem);
|
||||
}
|
||||
else if (gA_EditCache[client].iType == Zone_Stage)
|
||||
{
|
||||
if (autostage)
|
||||
{
|
||||
|
||||
@ -74,6 +74,10 @@
|
||||
{
|
||||
"en" "Last Login"
|
||||
}
|
||||
"FirstLogin"
|
||||
{
|
||||
"en" "First Login"
|
||||
}
|
||||
"MapCompletions"
|
||||
{
|
||||
"en" "Map completions"
|
||||
|
||||
@ -260,6 +260,11 @@
|
||||
"#format" "{1:d}"
|
||||
"en" "Custom speed limit: {1} (No Limit)"
|
||||
}
|
||||
"ZoneSetSpeedLimitDefault"
|
||||
{
|
||||
"#format" "{1:d}"
|
||||
"en" "Custom speed limit: {1} (Default Speedcap)"
|
||||
}
|
||||
"ZoneSetStage"
|
||||
{
|
||||
"#format" "{1:d}"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user