Raised This Month: $51 Target: $400
 12% 

[L4D2] Shop [v4.5 | 20 March 2022]


Post New Thread Reply   
 
Thread Tools Display Modes
pan0s
Senior Member
Join Date: Nov 2017
Old 03-16-2022 , 10:43   Re: [L4D2] Shop [v4.1 | 15 March 2022]
Reply With Quote #101

Quote:
Originally Posted by VYRNACH_GAMING View Post
is it normal for the plugin to have this much database handles? I have not updated to the latest version cause I have customized the plugin to include my mods but I don't think it will help right? https://pastebin.com/tyNcJsmN

My thread on possible memory leak after running for 12 hours continuously without hibernating: https://forums.alliedmods.net/showthread.php?t=336893
please try v4.2, I have checked all Handle(Database and Menu) and added delete statement for undeleted handle.
If you have customized the plugin by your self, you should use v4.2 as the base to add your new codes. I don't suggest you adding delete statement by yourself as on somewhere you may miss adding.

Last edited by pan0s; 03-16-2022 at 10:52.
pan0s is offline
pan0s
Senior Member
Join Date: Nov 2017
Old 03-16-2022 , 10:44   Re: [L4D2] Shop [v4.1 | 15 March 2022]
Reply With Quote #102

Quote:
Originally Posted by Psyk0tik View Post
No, that's not normal. According to your handle dump, there are several query and connection handles not being closed. I checked the source code and found the issues.

Not closing queries (look for red text):
Code:
void CreateDBTable()
{
	Database db = ConnectDB();
	if (db != null)
	{
		DBResultSet query = SQL_Query(db, "CREATE TABLE IF NOT EXISTS Shop(steamId TEXT, points INTEGER, PRIMARY KEY (steamId))");
		char isSucceed[255];
		isSucceed = query.RowCount>0? "Success." : "Already existesd.";
		if(query.RowCount>0)
		{
			LogMessage("[CREATE]: Create Shop table: \"%s\"", isSucceed);
		}
		PrintToServer("[Shop] Create Shop table: %s", isSucceed);

		// query = SQL_Query(db, "DROP TABLE IF EXISTS SpecialFunctions");
		query = SQL_Query(db, "CREATE TABLE IF NOT EXISTS SpecialFunctions(steamId TEXT, functionNo TEXT, isEnabled INTEGER, PRIMARY KEY (steamId, functionNo))");
		isSucceed = query.RowCount>0? "Created." : "Already existesd.";
		if(query.RowCount>0)
		{
			LogMessage("[CREATE]: Create SpecialFunctions table: \"%s\"", isSucceed);
		}
		PrintToServer("[Shop] Create SpecialFunctions table: %s", isSucceed);
		delete query; // missing from plugin's code (v4.1)
	}
	delete db;
}
Not closing DB connections (look for red text):
Code:
int LoadPoints(int client)
{
	Database db = ConnectDB();
	int db_points = 0;
	if (db != null)
	{
		char steamId[32];
		char error[255];

		Handle hSelectStmt = INVALID_HANDLE;

		GetClientAuthId(client, AuthId_Steam2, steamId, sizeof(steamId));

		///////////////////////// Load special functions
		if ((hSelectStmt = SQL_PrepareQuery(db, "SELECT functionNo, isEnabled FROM SpecialFunctions WHERE steamId = ?", error, sizeof(error))) == INVALID_HANDLE)
		{
			LogError("[ERROR]: SELECT SQL_PrepareQuery: \"%s\"", error);
		}

		// Disabled all special function first
		for(int i =0; i< SF_SIZE; i++)
		{
			g_bClientSF[client][0][i] = false;
			g_bClientSF[client][1][i] = false;
		}
		SQL_BindParamString(hSelectStmt, 0, steamId, false);
		if (SQL_Execute(hSelectStmt))
		{
			while(SQL_FetchRow(hSelectStmt))
			{
				char functionNo[32];
				SQL_FetchString(hSelectStmt, 0, functionNo, sizeof(functionNo));
				int index = GetFunctionIndex(functionNo);
				bool isEnabled = SQL_FetchInt(hSelectStmt, 1) == 1;
				g_bClientSF[client][0][index] = isEnabled;
				g_bClientSF[client][1][index] = true;
			}
		}
		///////////////////////////////////////////////////

		////////////////////////////////// Load points
		if ((hSelectStmt = SQL_PrepareQuery(db, "SELECT steamId,points FROM Shop WHERE steamId = ?", error, sizeof(error))) == INVALID_HANDLE)
		{
			LogError("[ERROR]: SELECT SQL_PrepareQuery: \"%s\"", error);
			delete db; // missing from plugin's code (v4.1)
			return db_points;
		}
		SQL_BindParamString(hSelectStmt, 0, steamId, false);

		// Find the client in the database
		if (SQL_Execute(hSelectStmt))
		{
			char playerName[64];
			GetClientName(client, playerName, sizeof(playerName));
			if(SQL_FetchRow(hSelectStmt))
			{
				SQL_FetchString(hSelectStmt, 0, steamId, sizeof(steamId));
				db_points = SQL_FetchInt(hSelectStmt, 1);
				LogAction(client, -1, "[LOAD]: \"%L\" loaded the record successfully! Points: \"%d\"", client, db_points);
			}
			else //INSERT
			{
				// if the user is not existed in the database, insert new one.
				Handle hInsertStmt = INVALID_HANDLE;
				if ((hInsertStmt = SQL_PrepareQuery(db, "INSERT INTO Shop(steamId, points) VALUES(?,?)", error, sizeof(error))) == INVALID_HANDLE)
				{
					LogError("[ERROR]: INSERT SQL_PrepareQuery: \"%s\"", error);
				}
				else
				{
					SQL_BindParamString(hInsertStmt, 0, steamId, false);
					SQL_BindParamInt(hInsertStmt, 1, 0, false); // Default point is 0
					if (!SQL_Execute(hInsertStmt))
					{
						LogError("[ERROR]: INSERT error Error: \"%s\"", error);
					}
					int rs = SQL_GetAffectedRows(hInsertStmt);
					if(rs>0)
					{
						LogAction(client, -1, "[INSERT]: \"%L\" is a new user!!", client);
					}else
					{
						LogError("[ERROR]: \"%L\" made insert error \"%s\"", client, error);
					}
				}
	  		    delete hInsertStmt;
			}

		}
	    delete hSelectStmt;
	}
	delete db;
	return db_points;

}
Thank you for pointing up this, I have added delete statements.

Last edited by pan0s; 03-16-2022 at 10:45.
pan0s is offline
VYRNACH_GAMING
Member
Join Date: Sep 2021
Old 03-17-2022 , 03:54   Re: [L4D2] Shop [v4.2 | 16 March 2022]
Reply With Quote #103

thank you so much pan0s and Psyk0tik for the quick response. Will upgrade and test it out
Edit: totally resolved. Longstanding and frustrating lag issue finally resolved! I really can't thank you guys enough
__________________

Last edited by VYRNACH_GAMING; 03-17-2022 at 06:05. Reason: memory leak issue resolved
VYRNACH_GAMING is offline
VYRNACH_GAMING
Member
Join Date: Sep 2021
Old 03-17-2022 , 06:57   Re: [L4D2] Shop [v4.2 | 16 March 2022]
Reply With Quote #104

Here's a version of the latest 4.2 version but with the airstrike (new airstrike menu) and extinguisher (guns->others) plugins as used on my servers. Only l4d2_shop.sp are updated. Included the other 2 files for convenience. The Chinese translation is likely broken so make sure to correct it

Airstrike: https://forums.alliedmods.net/showthread.php?t=187567
Extinguisher/Flamethrower: https://forums.alliedmods.net/showthread.php?t=160232

new shortcuts: (can be used as !buy air or !air)
RegConsoleCmd("sm_airstrike", HandleCmdAirstrike);
RegConsoleCmd("sm_air", HandleCmdAirstrike);
RegConsoleCmd("sm_extinguisher", HandleCmdExtinguisher);
RegConsoleCmd("sm_ext", HandleCmdExtinguisher);
RegConsoleCmd("sm_flamethrower", HandleCmdExtinguisher);
RegConsoleCmd("sm_flamer", HandleCmdExtinguisher);
RegConsoleCmd("sm_fire", HandleCmdExtinguisher);
Attached Files
File Type: zip shop_v.4.2_airstrike_extinguisher.zip (104.5 KB, 49 views)
__________________

Last edited by VYRNACH_GAMING; 03-17-2022 at 07:01. Reason: links
VYRNACH_GAMING is offline
pan0s
Senior Member
Join Date: Nov 2017
Old 03-17-2022 , 23:12   Re: [L4D2] Shop [v4.2 | 16 March 2022]
Reply With Quote #105

Quote:
Originally Posted by VYRNACH_GAMING View Post
Here's a version of the latest 4.2 version but with the airstrike (new airstrike menu) and extinguisher (guns->others) plugins as used on my servers. Only l4d2_shop.sp are updated. Included the other 2 files for convenience. The Chinese translation is likely broken so make sure to correct it

Airstrike: https://forums.alliedmods.net/showthread.php?t=187567
Extinguisher/Flamethrower: https://forums.alliedmods.net/showthread.php?t=160232

new shortcuts: (can be used as !buy air or !air)
RegConsoleCmd("sm_airstrike", HandleCmdAirstrike);
RegConsoleCmd("sm_air", HandleCmdAirstrike);
RegConsoleCmd("sm_extinguisher", HandleCmdExtinguisher);
RegConsoleCmd("sm_ext", HandleCmdExtinguisher);
RegConsoleCmd("sm_flamethrower", HandleCmdExtinguisher);
RegConsoleCmd("sm_flamer", HandleCmdExtinguisher);
RegConsoleCmd("sm_fire", HandleCmdExtinguisher);
Thank you for adding this, I have merged to v4.3.

Code:
v4.3 (18 March 2022)
- Added airstrike and extinguisher(Thanks VYRNACH_GAMING for adding this)
- Added more shop on checking.
- Moved some global variables to shop_cv.inc
- Simplified adding a new item. Adding cost convar is not necessary now as you will set the price in shop_cv.inc
- Rename ConVar in .cfg (you may need to delete old l4d2_shop.cfg to get the latest one)
- Fixed Transfer Point title
pan0s is offline
DARG367
AlliedModders Donor
Join Date: Aug 2018
Old 03-18-2022 , 05:40   Re: [L4D2] Shop [v4.3 | 18 March 2022]
Reply With Quote #106

Tried the latest update (4.3) airstrike works as intended but the flamethrower/extinguisher looks like it may have a problem where there is no flames (particles) or damage being done when holding down left click. The extinguisher part of the plugin works, so does back blast but not the flamethrower part.

Any ideas?
DARG367 is offline
VYRNACH_GAMING
Member
Join Date: Sep 2021
Old 03-18-2022 , 15:08   Re: [L4D2] Shop [v4.3 | 18 March 2022]
Reply With Quote #107

Quote:
Originally Posted by DARG367 View Post
Tried the latest update (4.3) airstrike works as intended but the flamethrower/extinguisher looks like it may have a problem where there is no flames (particles) or damage being done when holding down left click. The extinguisher part of the plugin works, so does back blast but not the flamethrower part.

Any ideas?
That issue has nothing to do with the shop plugin I think. Check if you're using this plugin or other plugins similar to it. It totally broke the flamethrower particle for me. My only current solution is removing it
https://forums.alliedmods.net/showthread.php?t=315405
__________________

Last edited by VYRNACH_GAMING; 03-18-2022 at 15:09. Reason: edit
VYRNACH_GAMING is offline
DARG367
AlliedModders Donor
Join Date: Aug 2018
Old 03-18-2022 , 16:21   Re: [L4D2] Shop [v4.3 | 18 March 2022]
Reply With Quote #108

Quote:
Originally Posted by VYRNACH_GAMING View Post
That issue has nothing to do with the shop plugin I think. Check if you're using this plugin or other plugins similar to it. It totally broke the flamethrower particle for me. My only current solution is removing it
https://forums.alliedmods.net/showthread.php?t=315405
My server is actually quite vanilla and only contains mainly crucial bug fixes for a multi slot server. I don't have anything that "should" be interfering with the flamethrower. Also yah I know it has nothing to do with the actual shop plugin but because it's integrated into the shop rather then posting on Silvers thread I thought to put it here instead. I'll try Silvers version alone without the shop and see if it is just the Extinguisher and Flamethrower plugin or has todo with the integration.

PHP Code:
[SMListing 49 plugins:
  
01 "Automatic Campaign Switcher (ACS)" (v2.3.0by Rikka0w0Chris Pringle
  02 
"Admin File Reader" (1.11.0.6861by AlliedModders LLC
  03 
"Admin Help" (1.11.0.6861by AlliedModders LLC
  04 
"Admin Menu" (1.11.0.6861by AlliedModders LLC
  05 
"Anti-Flood" (1.11.0.6861by AlliedModders LLC
  06 
"Basic Ban Commands" (1.11.0.6861by AlliedModders LLC
  07 
"Basic Chat" (1.11.0.6861by AlliedModders LLC
  08 
"Basic Comm Control" (1.11.0.6861by AlliedModders LLC
  09 
"Basic Commands" (1.11.0.6861by AlliedModders LLC
  10 
"Basic Info Triggers" (1.11.0.6861by AlliedModders LLC
  11 
"Basic Votes" (1.11.0.6861by AlliedModders LLC
  12 
"Client Preferences" (1.11.0.6861by AlliedModders LLC
  13 
"[L4D2]Defib_Fix" (2.0.1by Lux
  14 
"Fun Commands" (1.11.0.6861by AlliedModders LLC
  15 
"Fun Votes" (1.11.0.6861by AlliedModders LLC
  16 
"[ANY] Hostname - Display Map Name" (1.0.1by Mart
  17 
"[L4D2] F-18 Airstrike" (1.8by SilverShot
  18 
"[L4D2] F-18 Airstrike - Dead Air" (1.3-daby SilverShot
  19 
"[L4D2] F-18 Airstrike - No Mercy" (1.3-nmby SilverShot
  20 
"[L4D2] F-18 Airstrike - Triggers" (1.3-trby SilverShot
  21 
"l4d2_changelevel" (1.2.0by Lux
  22 
"[L4D2]Character_manager" (1.4.1by Lux$atanic $pirit
  23 
"[L4D2] CreateSurvivorBot Test" (1.0.0.0by MicroLeo (port by Dragokas)
  
24 "[L4D2] Custom admin commands" (1.3.9bby honorcode23Shadowysn (improvements)
  
25 "L4D2 Mission Manager" (v1.0.0by Rikka0w0
  26 
"L4D2 MissionManager AdminMenu" (v1.0.0by Rikka0w0
  27 
"[L4D2] Points and Gift System" (v4.3by v2.0Updated by pan0sOriginal authorDrakcol Fixed by AXIS_ASAKI
  28 
"l4d2_shop_bhop.smx"
  
29 "l4d2_shop_lasertag.smx"
  
30 "[L4D2] Zoey Unlock" (1.2by SilverShot
  31 
"[L4D2] 4+ Survivor Afk dead bot Fix" (1.1by MI 5HarryPotter
  32 
"[L4D/L4D2] Infected Bots (Coop/Versus/Realism/Scavenge/Survival)" (2.6.8by djromero (SkyDavid), MI 5Harry Potter
  33 
"[L4D(2)] MultiSlots Improved" (4.7by SwiftRealMI 5ururuKhMaIBQHarryPotter
  34 
"[L4D1 & L4D2] CreateSurvivorBot" (1.0by MicroLeo (port by Dragokas)
  
35 "[L4D & L4D2] Extinguisher and Flamethrower" (1.19by SilverShot
  36 
"[L4D1 & L4D2] SM Respawn Improved" (3.6by AtomicStryker Ivailosp (Modified by CrasherSilverShot), fork by Dragokas
  37 
"[L4D & L4D2] Left 4 DHooks Direct" (1.89by SilverShot
  38 
"Upgrade Pack Fixes" (1.4by bullet28V10SilversHarry
  39 
"Missile" (1.5 Mi.Cura DARG367by Mart
  40 Disabled
"Nextmap" (1.11.0.6861by AlliedModders LLC
  41 
"PlayerAddCountryTag" (2.5.0-1fby n3wton
  42 
"Player Commands" (1.11.0.6861by AlliedModders LLC
  43 
"Reserved Slots" (1.11.0.6861by AlliedModders LLC
  44 
"Sound Commands" (1.11.0.6861by AlliedModders LLC
  45 
"[L4D2]Survivor_AFK_Fix" (1.0.4by Lux
  46 
"Survivor Chat Select" (1.6.1by DeatChaos25Mi123456 Merudo
  47 
"[L4D2]Witch_Double_Start_Fix" (1.0by Lux
  48 
"[L4D1/2]witch_prevent_target_loss" (1.1.1by Lux
  49 
"[L4D1/2]Witch_Target_Patch" (1.4by Lux 
DARG367 is offline
pan0s
Senior Member
Join Date: Nov 2017
Old 03-18-2022 , 17:01   Re: [L4D2] Shop [v2.9 | 25 Feb 2022]
Reply With Quote #109

Quote:
Originally Posted by Thefollors View Post
Hello, how can I disable the store in cooperative mode?
Code:
// Shop is on for coop mode? 0=OFF, 1=On
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
shop_coop_on "1
pan0s is offline
pan0s
Senior Member
Join Date: Nov 2017
Old 03-18-2022 , 17:03   Re: [L4D2] Shop [v4.3 | 18 March 2022]
Reply With Quote #110

Quote:
Originally Posted by DARG367 View Post
My server is actually quite vanilla and only contains mainly crucial bug fixes for a multi slot server. I don't have anything that "should" be interfering with the flamethrower. Also yah I know it has nothing to do with the actual shop plugin but because it's integrated into the shop rather then posting on Silvers thread I thought to put it here instead. I'll try Silvers version alone without the shop and see if it is just the Extinguisher and Flamethrower plugin or has todo with the integration.

PHP Code:
[SMListing 49 plugins:
  
01 "Automatic Campaign Switcher (ACS)" (v2.3.0by Rikka0w0Chris Pringle
  02 
"Admin File Reader" (1.11.0.6861by AlliedModders LLC
  03 
"Admin Help" (1.11.0.6861by AlliedModders LLC
  04 
"Admin Menu" (1.11.0.6861by AlliedModders LLC
  05 
"Anti-Flood" (1.11.0.6861by AlliedModders LLC
  06 
"Basic Ban Commands" (1.11.0.6861by AlliedModders LLC
  07 
"Basic Chat" (1.11.0.6861by AlliedModders LLC
  08 
"Basic Comm Control" (1.11.0.6861by AlliedModders LLC
  09 
"Basic Commands" (1.11.0.6861by AlliedModders LLC
  10 
"Basic Info Triggers" (1.11.0.6861by AlliedModders LLC
  11 
"Basic Votes" (1.11.0.6861by AlliedModders LLC
  12 
"Client Preferences" (1.11.0.6861by AlliedModders LLC
  13 
"[L4D2]Defib_Fix" (2.0.1by Lux
  14 
"Fun Commands" (1.11.0.6861by AlliedModders LLC
  15 
"Fun Votes" (1.11.0.6861by AlliedModders LLC
  16 
"[ANY] Hostname - Display Map Name" (1.0.1by Mart
  17 
"[L4D2] F-18 Airstrike" (1.8by SilverShot
  18 
"[L4D2] F-18 Airstrike - Dead Air" (1.3-daby SilverShot
  19 
"[L4D2] F-18 Airstrike - No Mercy" (1.3-nmby SilverShot
  20 
"[L4D2] F-18 Airstrike - Triggers" (1.3-trby SilverShot
  21 
"l4d2_changelevel" (1.2.0by Lux
  22 
"[L4D2]Character_manager" (1.4.1by Lux$atanic $pirit
  23 
"[L4D2] CreateSurvivorBot Test" (1.0.0.0by MicroLeo (port by Dragokas)
  
24 "[L4D2] Custom admin commands" (1.3.9bby honorcode23Shadowysn (improvements)
  
25 "L4D2 Mission Manager" (v1.0.0by Rikka0w0
  26 
"L4D2 MissionManager AdminMenu" (v1.0.0by Rikka0w0
  27 
"[L4D2] Points and Gift System" (v4.3by v2.0Updated by pan0sOriginal authorDrakcol Fixed by AXIS_ASAKI
  28 
"l4d2_shop_bhop.smx"
  
29 "l4d2_shop_lasertag.smx"
  
30 "[L4D2] Zoey Unlock" (1.2by SilverShot
  31 
"[L4D2] 4+ Survivor Afk dead bot Fix" (1.1by MI 5HarryPotter
  32 
"[L4D/L4D2] Infected Bots (Coop/Versus/Realism/Scavenge/Survival)" (2.6.8by djromero (SkyDavid), MI 5Harry Potter
  33 
"[L4D(2)] MultiSlots Improved" (4.7by SwiftRealMI 5ururuKhMaIBQHarryPotter
  34 
"[L4D1 & L4D2] CreateSurvivorBot" (1.0by MicroLeo (port by Dragokas)
  
35 "[L4D & L4D2] Extinguisher and Flamethrower" (1.19by SilverShot
  36 
"[L4D1 & L4D2] SM Respawn Improved" (3.6by AtomicStryker Ivailosp (Modified by CrasherSilverShot), fork by Dragokas
  37 
"[L4D & L4D2] Left 4 DHooks Direct" (1.89by SilverShot
  38 
"Upgrade Pack Fixes" (1.4by bullet28V10SilversHarry
  39 
"Missile" (1.5 Mi.Cura DARG367by Mart
  40 Disabled
"Nextmap" (1.11.0.6861by AlliedModders LLC
  41 
"PlayerAddCountryTag" (2.5.0-1fby n3wton
  42 
"Player Commands" (1.11.0.6861by AlliedModders LLC
  43 
"Reserved Slots" (1.11.0.6861by AlliedModders LLC
  44 
"Sound Commands" (1.11.0.6861by AlliedModders LLC
  45 
"[L4D2]Survivor_AFK_Fix" (1.0.4by Lux
  46 
"Survivor Chat Select" (1.6.1by DeatChaos25Mi123456 Merudo
  47 
"[L4D2]Witch_Double_Start_Fix" (1.0by Lux
  48 
"[L4D1/2]witch_prevent_target_loss" (1.1.1by Lux
  49 
"[L4D1/2]Witch_Target_Patch" (1.4by Lux 
You may try removing all other plugins, and installing shop and the related plugins. Then, try again.
pan0s is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:07.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode