just putting a message if people upgrade their tier
This commit is contained in:
parent
9bb3092600
commit
e00711eedf
@ -33,7 +33,6 @@ public Plugin myinfo =
|
||||
url = "www.unloze.com"
|
||||
};
|
||||
|
||||
|
||||
public Action time_query_activity(Handle timer, any data)
|
||||
{
|
||||
if (!g_hDatabase)
|
||||
@ -418,6 +417,55 @@ public void SQL_OnQueryCompletedTimeServer(Database db, DBResultSet results, con
|
||||
SetPlayerTier(client);
|
||||
SetTierRewards(client);
|
||||
}
|
||||
else if (check_if_client_new_tier(client))
|
||||
{
|
||||
SetPlayerTier(client);
|
||||
SetTierRewards(client);
|
||||
}
|
||||
}
|
||||
|
||||
public bool check_if_client_new_tier(int client)
|
||||
{
|
||||
char sPath[PLATFORM_MAX_PATH];
|
||||
BuildPath(Path_SM, sPath, sizeof(sPath), "configs/unloze_playt_time_tiers.cfg");
|
||||
|
||||
KeyValues kv = new KeyValues("PlayTimeTiers");
|
||||
if (!kv.ImportFromFile(sPath))
|
||||
{
|
||||
LogError("configs/unloze_playt_time_tiers not found");
|
||||
delete kv;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!kv.GotoFirstSubKey(false))
|
||||
{
|
||||
LogError("configs/unloze_playt_time_tiers.cfg is empty or malformed");
|
||||
delete kv;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool upgrade_tier = false;
|
||||
do
|
||||
{
|
||||
char sKey[16], sVal[16];
|
||||
kv.GetSectionName(sKey, sizeof(sKey));
|
||||
kv.GetString(NULL_STRING, sVal, sizeof(sVal), "-1");
|
||||
|
||||
int tier = StringToInt(sVal);
|
||||
int hours = StringToInt(sKey);
|
||||
if (hours > g_iPlayerTimeServer[client])
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (tier > g_iPlayerTier[client])
|
||||
{
|
||||
PrintToChatAll("%N Leveled up to Tier: %i!", client, tier);
|
||||
upgrade_tier = true;
|
||||
}
|
||||
|
||||
} while (kv.GotoNextKey(false));
|
||||
delete kv;
|
||||
return upgrade_tier;
|
||||
}
|
||||
|
||||
public void SetTierRewards(int client)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user