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

client index invalid error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JLmelenchon
Senior Member
Join Date: Mar 2019
Old 06-11-2022 , 23:19   client index invalid error
Reply With Quote #1

Code:
L 06/12/2022 - 02:36:04: SourceMod error session started
L 06/12/2022 - 02:36:04: Info (map "c2m1_highway") (file "/home/container/left4dead2/addons/sourcemod/logs/errors_20220612.log")
L 06/12/2022 - 02:36:04: [SM] Exception reported: Client index -1 is invalid
L 06/12/2022 - 02:36:04: [SM] Blaming: teamshuffle.smx
L 06/12/2022 - 02:36:04: [SM] Call stack trace:
L 06/12/2022 - 02:36:04: [SM]   [0] GetClientTeam
L 06/12/2022 - 02:36:04: [SM]   [1] Line 205, plugin.sp::ShuffleTeams
L 06/12/2022 - 02:36:04: [SM]   [2] Line 200, plugin.sp::Timer_ShuffleTeams
L 06/12/2022 - 02:51:48: Error log file session closed.
https://github.com/Tabbernaut/L4D2-P...teamshuffle.sp
JLmelenchon is offline
DiogoOnAir
Senior Member
Join Date: Jul 2018
Location: Portugal
Old 06-12-2022 , 18:06   Re: client index invalid error
Reply With Quote #2

That s because the client is invalid, do an if client > 0 check or just use the isvalidclient stock
__________________
I accept Private(Paid) plugins requests
If you like my job donate me Here
Feel free to add me on Steam
Feel free to add me on Discord DiogoOnAir | Config & Developer#7961
Check my website
If you want to buy any server, you can buy it from here!
Datacenters around the world!
DiogoOnAir is offline
JLmelenchon
Senior Member
Join Date: Mar 2019
Old 06-13-2022 , 16:43   Re: client index invalid error
Reply With Quote #3

Why the client is invalid ? Was in game. And where will you place that?
JLmelenchon is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 06-13-2022 , 17:18   Re: client index invalid error
Reply With Quote #4

Your code doesn't match the github file.

Timer_ShuffleTeams is called on line 198, not 200

Are you sure you using the same code? (or have you modified it?)
__________________

Last edited by Marttt; 06-13-2022 at 17:19.
Marttt is online now
JLmelenchon
Senior Member
Join Date: Mar 2019
Old 06-13-2022 , 17:40   Re: client index invalid error
Reply With Quote #5

Had to change some includes files.

https://pastebin.com/Ds8nv0JJ

L 06/13/2022 - 21:52:55: [SM] Blaming: teamshuffle.smx
L 06/13/2022 - 21:52:55: [SM] Call stack trace:
L 06/13/2022 - 21:52:55: [SM] [0] GetClientTeam
L 06/13/2022 - 21:52:55: [SM] [1] Line 208, plugin.sp::ShuffleTeams
L 06/13/2022 - 21:52:55: [SM] [2] Line 203, plugin.sp::Timer_ShuffleTeams
L 06/13/2022 - 21:539: [SM] Exception reported: Client index -1 is invalid

Last edited by JLmelenchon; 06-13-2022 at 17:42.
JLmelenchon is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 06-13-2022 , 18:03   Re: client index invalid error
Reply With Quote #6

Well, you changed more stuff than that.

And is because that you are getting an error:

Original:
PHP Code:
stock ShuffleTeams client = -)
{
    if ( 
g_bRoundIsLive 
Yours:
PHP Code:
stock ShuffleTeams client = -)
{
    if ( 
g_bRoundIsLive || L4D_IsFirstMapInScenario() == false || InSecondHalfOfRound() || GetClientTeam(client) == 1
If ShuffleTeams is called without a parameter (line 203),
by default it will have a "-1" value.
And you are trying to GetClientTeam in these cases

Just do a client != -1 check in the if.

PHP Code:
stock ShuffleTeams client = -)
{
    if ( 
g_bRoundIsLive || L4D_IsFirstMapInScenario() == false || InSecondHalfOfRound() || (client && IsClientInGame(client) && GetClientTeam(client) == 1)) 
__________________

Last edited by Marttt; 06-13-2022 at 18:05.
Marttt is online now
JLmelenchon
Senior Member
Join Date: Mar 2019
Old 06-13-2022 , 20:47   Re: client index invalid error
Reply With Quote #7

Removed and getclienteam and it works thanks.
JLmelenchon 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 22:59.


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