Permalink
Browse files

Minor changes

  • Loading branch information...
Bara committed May 18, 2018
1 parent b566001 commit 041698a465eb2cd8094c8b8a78a018ec9ac9f25a
@@ -26,9 +26,9 @@ forward void TTT_OnItemsReset();
* @param itemshort The short-tag identifier of the item (must be unique).
* @param itemlong The long fancy name for the item.
* @param price The price of the item.
* @param role The optional role to restrict the item to.
* @param sort The priority in Sorting. Buy menu is sorted from high to low.
* @param discount Item discountable for special players? (Required: ttt_shop_discount)
* @param role The optional role to restrict the item to. (Default: 0 - for all)
* @param sort The priority in Sorting. Buy menu is sorted from high to low. (Default: 0)
* @param discount Item discountable for special players? (Default: false - Required: ttt_shop_discount)
*/
native bool TTT_RegisterCustomItem(const char[] itemshort, const char[] itemlong, int price, int role = 0, int sort = 0, bool discount = false);
@@ -55,7 +55,7 @@ public void OnPluginStart()
char sDate[12];
FormatTime(sDate, sizeof(sDate), "%y-%m-%d");
BuildPath(Path_SM, g_sLog, sizeof(g_sLog), "logs/ttt/ttt_random_teleporter_%s.log", sDate);
BuildPath(Path_SM, g_sLog, sizeof(g_sLog), "logs/ttt_random_teleporter_%s.log", sDate);
TTT_StartConfig("random_teleporter");
CreateConVar("ttt2_random_teleporter_version", TTT_PLUGIN_VERSION, TTT_PLUGIN_DESCRIPTION, FCVAR_NOTIFY | FCVAR_DONTRECORD | FCVAR_REPLICATED);
@@ -88,10 +88,12 @@ public void OnConfigsExecuted()
g_cPluginTag = FindConVar("ttt_plugin_tag");
g_cPluginTag.AddChangeHook(OnConVarChanged);
g_cPluginTag.GetString(g_sPluginTag, sizeof(g_sPluginTag));
// LogToFile(g_sLog, "(OnConfigsExecuted) called!");
}
public void OnAllPluginsLoaded()
{
// LogToFile(g_sLog, "(OnAllPluginsLoaded) called!");
RegisterItem();
}
@@ -77,6 +77,8 @@ bool g_bReopen[MAXPLAYERS + 1] = { true, ... };
Database g_dDB = null;
char g_sLog[PLATFORM_MAX_PATH+1];
char g_sShopCMDs[][] = {
"menu",
"shop"
@@ -184,6 +186,10 @@ public void OnPluginStart()
LoadTranslations("common.phrases");
LoadTranslations("ttt.phrases");
char sDate[12];
FormatTime(sDate, sizeof(sDate), "%y-%m-%d");
BuildPath(Path_SM, g_sLog, sizeof(g_sLog), "logs/ttt_shop_%s.log", sDate);
g_hReopenCookie = RegClientCookie("ttt_reopen_shop", "Cookie to reopen shop menu", CookieAccess_Private);
if (TTT_GetSQLConnection() != null)
@@ -192,17 +198,7 @@ public void OnPluginStart()
AlterCreditsColumn();
}
ResetItemsArray(true);
}
public void OnMapStart()
{
ResetItemsArray(true);
}
public void OnMapEnd()
{
ResetItemsArray(false);
ResetItemsArray("OnPluginStart", true);
}
public void OnConfigsExecuted()
@@ -758,6 +754,8 @@ public int Native_RegisterCustomItem(Handle plugin, int numParams)
bool temp_discount = view_as<bool>(GetNativeCell(6));
int temp_item[Item];
// LogToFile(g_sLog, "Short: %s - Long: %s - Price: %d", temp_short, temp_long, temp_price);
if ((strlen(temp_short) < 1) || (strlen(temp_long) < 1) || (temp_price <= 0))
{
return false;
@@ -1293,7 +1291,7 @@ public Action Command_SetCredits(int client, int args)
public Action Command_ResetItems(int client, int args)
{
ResetItemsArray(true);
ResetItemsArray("Command_ResetItems", true);
Call_StartForward(g_hOnItemsReset);
Call_Finish();
@@ -1352,9 +1350,11 @@ public int Native_GiveClientItem(Handle plugin, int numParams)
}
void ResetItemsArray(bool initArray = false)
void ResetItemsArray(const char[] sFunction, bool initArray = false)
{
delete g_aCustomItems;
LogToFile(g_sLog, "Function: %s - Init: %d", sFunction, initArray);
if (initArray)
{

0 comments on commit 041698a

Please sign in to comment.