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

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


Post New Thread Reply   
 
Thread Tools Display Modes
GoGetSomeSleep
Senior Member
Join Date: Dec 2018
Location: Miami/Florida
Old 01-02-2023 , 15:16   Re: [L4D2] Shop [v4.5 | 20 March 2022]
Reply With Quote #141

Quote:
Originally Posted by pan0s View Post
Search KillPoints

Replace
Code:
			if(AddPoints(client, points))
				CPrintToChat(client, "%T%T%T%T","SYSTEM", client, "KILLED_INFECTED", client, cvar_earn_infected_num.IntValue, "REWARD_POINTS", client, cvar_earn_infected.IntValue, "ADVERTISEMENT", client);
To:
Code:
AddPoints(client, points);
Code:
//SourceMod Batch Compiler
// by the SourceMod Dev Team


//// l4d2_shop.sp
//
// l4d2_shop.sp(545) : error 001: expected token: ";", but found ","
// l4d2_shop.sp(545) : error 029: invalid expression, assumed zero
// l4d2_shop.sp(545) : warning 215: expression has no effect
// l4d2_shop.sp(645) : error 001: expected token: ";", but found ","
// l4d2_shop.sp(645) : error 029: invalid expression, assumed zero
// l4d2_shop.sp(645) : warning 215: expression has no effect
// l4d2_shop.sp(1640) : warning 204: symbol is assigned a value that is never used: "attacker"
//
// 4 Errors.
//
// Compilation Time: 0,44 sec
// ----------------------------------------

Press enter to exit ...
GoGetSomeSleep is offline
kimonl
Junior Member
Join Date: Nov 2022
Old 01-26-2023 , 13:27   Re: [L4D2] Shop [v4.5 | 20 March 2022]
Reply With Quote #142

How can i sell or remove item i bought ?
kimonl is offline
Jasonex
Junior Member
Join Date: Aug 2023
Old 09-09-2023 , 00:55   Re: [L4D2] Shop [v4.5 | 20 March 2022]
Reply With Quote #143

1 error


L 09/09/2023 - 12:51:05: [l4d2_shop.smx] [INSERT]: "JasoneX<2><STEAM_1:1:516462955><>" is a new user!!

Last edited by Jasonex; 09-09-2023 at 00:56.
Jasonex is offline
NoroHime
Veteran Member
Join Date: Aug 2016
Location: bed
Old 09-09-2023 , 01:25   Re: [L4D2] Shop [v4.5 | 20 March 2022]
Reply With Quote #144

Quote:
Originally Posted by Jasonex View Post
1 error


L 09/09/2023 - 12:51:05: [l4d2_shop.smx] [INSERT]: "JasoneX<2><STEAM_1:1:516462955><>" is a new user!!
here just a normal log, to find error go read errors_YYYYMMDD.log
__________________
NoroHime is offline
Jasonex
Junior Member
Join Date: Aug 2023
Old 09-09-2023 , 04:57   Re: [L4D2] Shop [v4.5 | 20 March 2022]
Reply With Quote #145

Quote:
Originally Posted by NoroHime View Post
here just a normal log, to find error go read errors_YYYYMMDD.log
Thank you
Jasonex is offline
S.A.S
Member
Join Date: Jul 2023
Old 10-13-2023 , 19:15   Re: [L4D2] Shop [v4.5 | 20 March 2022]
Reply With Quote #146

There is no need to edit l4d2_shop.sp, open l4d2_shop.cfg and edit the purchases you need/unneed there.
Where the cost is indicated, set -1 and this purchase will not be in the store.
As a variation, use the trial store to purchase for one round, and for a permanent store, disable this purchase.
Use the standard l4d2_shop.sp and everything will work correctly for you.
S.A.S is offline
ForTheSakura
Junior Member
Join Date: Dec 2022
Old 10-13-2023 , 21:16   Re: [L4D2] Shop [v4.5 | 20 March 2022]
Reply With Quote #147

Thanks a lot for helping S.A.S.
Quote:
Originally Posted by S.A.S View Post
Where the cost is indicated, set -1 and this purchase will not be in the store.
I missed that somehow !
ForTheSakura is offline
ForTheSakura
Junior Member
Join Date: Dec 2022
Old 10-14-2023 , 00:22   Re: [L4D2] Shop [v4.5 | 20 March 2022]
Reply With Quote #148

I'm having trouble saving trial special functions if a player hasn't died yet and making them carry over to the next round. I edited the SP file to save points and reset trial special functions when a player dies, instead of at the end of a round. I commented out RoundReset() in RoundStart and RoundEnd and added the code under Event_PlayerDeath:
Code:
public Action Event_PlayerDeath(Event event, char[] event_name, bool dontBroadcast)
{
	if(!g_bPointsOn) return Plugin_Continue;

	int client = GetClientOfUserId(event.GetInt("userid"));
	int attacker = GetClientOfUserId(event.GetInt("attacker"));

	if (IsSurvivor(attacker) && IsInfected(client))
	{
		int points = cvar_earn_special.IntValue;
		if(AddPoints(attacker, points))
			CPrintToChat(attacker, "%T%T%T%T", "SYSTEM", attacker, "KILLED_SPECIAL_INFECTED", attacker, "REWARD_POINTS", attacker, points, "ADVERTISEMENT", attacker);
	}
	else if(IsInfected(attacker) && IsSurvivor(client))
	{
		int points = cvar_iearn_survivor.IntValue;
		if(AddPoints(attacker, points))
			CPrintToChat(attacker, "%T%T%T%T", "SYSTEM", attacker, "KILLED_SURVIVOR", attacker, "REWARD_POINTS", attacker, points, "ADVERTISEMENT", attacker);
	}
	
	if (client && IsValidClient(client) && !IsFakeClient(client))
	{
		SaveToDB(client);
		RoundResetClient(client);
	}

	return Plugin_Continue;
}
But, the trial special functions don't transfer to the next round. I'd appreciate any help with fixing this as well.

Last edited by ForTheSakura; 10-14-2023 at 01:07.
ForTheSakura is offline
pan0s
Senior Member
Join Date: Nov 2017
Old 10-14-2023 , 10:37   Re: [L4D2] Shop [v4.5 | 20 March 2022]
Reply With Quote #149

Quote:
Originally Posted by ForTheSakura View Post
I'm having trouble saving trial special functions if a player hasn't died yet and making them carry over to the next round. I edited the SP file to save points and reset trial special functions when a player dies, instead of at the end of a round. I commented out RoundReset() in RoundStart and RoundEnd and added the code under Event_PlayerDeath:
Code:
public Action Event_PlayerDeath(Event event, char[] event_name, bool dontBroadcast)
{
	if(!g_bPointsOn) return Plugin_Continue;

	int client = GetClientOfUserId(event.GetInt("userid"));
	int attacker = GetClientOfUserId(event.GetInt("attacker"));

	if (IsSurvivor(attacker) && IsInfected(client))
	{
		int points = cvar_earn_special.IntValue;
		if(AddPoints(attacker, points))
			CPrintToChat(attacker, "%T%T%T%T", "SYSTEM", attacker, "KILLED_SPECIAL_INFECTED", attacker, "REWARD_POINTS", attacker, points, "ADVERTISEMENT", attacker);
	}
	else if(IsInfected(attacker) && IsSurvivor(client))
	{
		int points = cvar_iearn_survivor.IntValue;
		if(AddPoints(attacker, points))
			CPrintToChat(attacker, "%T%T%T%T", "SYSTEM", attacker, "KILLED_SURVIVOR", attacker, "REWARD_POINTS", attacker, points, "ADVERTISEMENT", attacker);
	}
	
	if (client && IsValidClient(client) && !IsFakeClient(client))
	{
		SaveToDB(client);
		RoundResetClient(client);
	}

	return Plugin_Continue;
}
But, the trial special functions don't transfer to the next round. I'd appreciate any help with fixing this as well.
Your logic is almost correct, but there is also a situation (LoadPoints) to reset the player's SF.
If you want to keep the player's SF (round) until the player dies, just comment the line
Code:
int LoadPoints(int client)
{
...
    // g_bClientSF[client][0][i] = false;
...
}
and correct this
PHP Code:
// add steam id for clients to check whether they are the same.
char g_sClientSteamId[MAXPLAYERS 1][32],

// how to open the above shops by cmd

public void OnClientPostAdminCheck(int client)
{
     
// reset the points after connect
     
if(IsValidClient(client) && !IsFakeClient(client) && cvar_db_on.BoolValue)
     {
          
char steamId[32];
          
GetClientAuthId(clientAuthId_Steam2steamIdsizeof(steamId));
          if(!
StrEqual(steamIdg_sClientSteamId[client]))
          {
               
ResetClient(client); // <--- Reset client here
               
for(int i=0i<32i++)
                    
g_sClientSteamId[client][i] = '\0';
               
strcopy(g_sClientSteamId[client], sizeof(steamId), steamIdsizeof(steamId));
          }

          
g_iPoints[client] = LoadPoints(client);
     }
}

public 
void OnClientDisconnect(int client)
{
    
g_bIsShown[client] = false;
    if(
IsValidClient(client)) g_iKilledInfectedCount[client] = 0;
    
SaveToDB(client);
    
// ResetClient(client); // <--- Comment it
    
for(int i =0i<2i++) g_iBuyItem[client][i] = 0;

__________________

Last edited by pan0s; 10-14-2023 at 16:20.
pan0s is offline
Jerry_21
Member
Join Date: Jun 2017
Old 10-15-2023 , 00:17   Re: [L4D2] Shop [v4.5 | 20 March 2022]
Reply With Quote #150

Hello pan0s, first of all congratulations for a very good complement, it is one of my favorites, I just have a slight detail, Could you help me either by creating a cvar to activate or deactivate annoying notices when you eliminate common or special infected?
or, if applicable, guide me to deactivate said chat messages. Sorry for my English, I use Google translator.
Jerry_21 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 04:21.


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