Raised This Month: $32 Target: $400
 8% 

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


Post New Thread Reply   
 
Thread Tools Display Modes
emorr
Junior Member
Join Date: May 2021
Location: Turkey/istanbul/kartal
Old 05-01-2021 , 10:17   Re: [L4D2] Shop v2.3 (30 April 2021)
Reply With Quote #11

Listen server supported?

Last edited by emorr; 05-02-2021 at 10:27. Reason: Bad behavior
emorr is offline
pan0s
Senior Member
Join Date: Nov 2017
Old 05-01-2021 , 11:13   Re: [L4D2] Shop v2.3 (30 April 2021)
Reply With Quote #12

Quote:
Originally Posted by emorr View Post
Listen server supported?
Yes, it does
pan0s is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 05-01-2021 , 11:58   Re: [L4D2] Shop v2.4 (1 May 2021)
Reply With Quote #13

You shouldn't be using a #define to set MaxClients to 18.
As a good practice, use MAXPLAYERS+1 instead. (it will create an array with 64 size)
L4D2 can have up to 32 clients, a lot of modded servers has 20+ players slots.
__________________
Marttt is offline
emorr
Junior Member
Join Date: May 2021
Location: Turkey/istanbul/kartal
Old 05-01-2021 , 12:03   Re: [L4D2] Shop v2.3 (30 April 2021)
Reply With Quote #14

Quote:
Originally Posted by pan0s View Post
Yes, it does
How can i learn a plugin supports listen server or not?
emorr is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 05-01-2021 , 12:14   Re: [L4D2] Shop v2.4 (1 May 2021)
Reply With Quote #15

Usually, plugins work on listen/local servers unless the author made some "hard-code" to block it. (IsDedicatedServer(), as I already have found in some plugins around the forum).

What won't work, is being the host and typing plugin commands in the console that uses the client as a parameter to do something, since in listen servers, it will read as being client index = "0" (server). [Anyway there is a workaround for that I do in my plugins]
The same happens when you try typing plugin commands through console rcon in a dedicated server, for example.

Also, SM doesn't support listen servers (but I never had any problem with that in 2 years+).
__________________

Last edited by Marttt; 05-01-2021 at 12:42.
Marttt is offline
pan0s
Senior Member
Join Date: Nov 2017
Old 05-01-2021 , 16:45   Re: [L4D2] Shop v2.4 (1 May 2021)
Reply With Quote #16

Quote:
Originally Posted by Marttt View Post
You shouldn't be using a #define to set MaxClients to 18.
As a good practice, use MAXPLAYERS+1 instead. (it will create an array with 64 size)
L4D2 can have up to 32 clients, a lot of modded servers has 20+ players slots.
For the listen server, client index over 18 will have the exception "Client index 19 is invalid", so I define it to 18.
Of course, for the server who have 20+ players, they can change it back to 20+ because the dedicated server has no this problem.
pan0s is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 05-01-2021 , 20:32   Re: [L4D2] Shop v2.4 (1 May 2021)
Reply With Quote #17

Quote:
Originally Posted by pan0s View Post
For the listen server, client index over 18 will have the exception "Client index 19 is invalid", so I define it to 18.
Of course, for the server who have 20+ players, they can change it back to 20+ because the dedicated server has no this problem.
That's not how you fix that error. The variable MaxClients is dynamic and can change depending on how many players a server can handle. MAXPLAYERS + 1 handles up to 64 players + world/server index which is what you use for global variables.

To fix the "Client X is invalid" error you usually include this check:
PHP Code:
if (client <= MaxClients
It will make sure that only clients between index 1 to MaxClients will be affected.

You also need to loop through clients consistently. Even on listen servers, this is still the ideal loop:
PHP Code:
for (int i 1<= MaxClientsi++) 
In your current code, I see loops like this:
PHP Code:
for (int i 0MaxClients 1i++) 
There are only certain cases where you would need to directly affect index 0 for listen servers, but most of the time, index 1 still works.
__________________
Psyk0tik is offline
pan0s
Senior Member
Join Date: Nov 2017
Old 05-02-2021 , 08:31   Re: [L4D2] Shop v2.4 (1 May 2021)
Reply With Quote #18

Quote:
Originally Posted by Crasher_3637 View Post
That's not how you fix that error. The variable MaxClients is dynamic and can change depending on how many players a server can handle. MAXPLAYERS + 1 handles up to 64 players + world/server index which is what you use for global variables.

To fix the "Client X is invalid" error you usually include this check:
PHP Code:
if (client <= MaxClients
It will make sure that only clients between index 1 to MaxClients will be affected.

You also need to loop through clients consistently. Even on listen servers, this is still the ideal loop:
PHP Code:
for (int i 1<= MaxClientsi++) 
In your current code, I see loops like this:
PHP Code:
for (int i 0MaxClients 1i++) 
There are only certain cases where you would need to directly affect index 0 for listen servers, but most of the time, index 1 still works.
Thank you for your suggestion, I will apply it to next version.
pan0s is offline
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 05-04-2021 , 08:53   Re: [L4D2] Shop v2.3 (30 April 2021)
Reply With Quote #19

Quote:
Originally Posted by pan0s View Post
Quote:
Originally Posted by emorr View Post
Listen server supported?
Yes, it does
[CS:GO] Sourcemod on Listen Server (private lobby)
Dedicated or Listen server to test plugins?

I quote:

Quote:
Originally Posted by asherkin View Post
SourceMod does not support Listen Servers, so your choice is effectively made for you. Install SRCDS locally.
As plugins obviously depend on SourceMod, and as SourceMod literally doesn't support Listen Servers, I would say that no plugins can technically "support Listen Servers" either, since they depend on something that doesn't.


And with your vague response, you're potentially giving people the impression that SourceMod also supports such things, which it doesn't.

I would therefore suggest ...
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].
DarkDeviL is offline
mikaelangelis
Senior Member
Join Date: Oct 2017
Old 05-15-2021 , 07:10   Re: [L4D2] Shop [v2.6 | 4 May 2021]
Reply With Quote #20

I have an idea. Do you know how to force to create buying area only in safe room?
mikaelangelis is offline
Reply


Thread Tools
Display Modes

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:15.


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