AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   Remember Spectators v1.2.5 (https://forums.alliedmods.net/showthread.php?t=100978)

bman87 08-19-2009 17:41

Remember Spectators v1.2.5
 
10 Attachment(s)
*Only tested in L4D*

This will remember who is on the spectator team when the map changes. Once the new maps loads it will move the players back into the spectator team.

CVAR: remember_spec_version

Version 1.0.0: Initial Release
Version 1.1.0: Minor bug fixing (validating clients). Thanks olj!
Version 1.1.1: Stupid bugs... hopefully fixed validation..
Version 1.2.0: Added a check when player changes teams
Version 1.2.1: Forgot to add client validation again... :shock:
Version 1.2.2: Testing Version...
Version 1.2.3: More minor bug fixes
Version 1.2.4: Smashing tiny bugs
Version 1.2.5: Bug fix.

Visual77 08-19-2009 19:16

Re: [L4D] Remember Spectators
 
Nice work, bman.

I always had the problem when a player would go spectate right about the time the map would change. It would force the player to join the infected or the survivor team while still being afk, thus ruining the game for everyone. This will save me a lot of trouble. Thanks.

Btw, got some error logs.

Code:

L 08/20/2009 - 00:01:39: SourceMod error session started
L 08/20/2009 - 00:01:39: Info (map "l4d_vs_hospital01_apartment") (file "errors_20090820.log")
L 08/20/2009 - 00:01:39: [SM] Native "GetClientTeam" reported: Client 6 is not in game
L 08/20/2009 - 00:01:39: [SM] Displaying call stack trace for plugin "l4d_spec_remember.smx":
L 08/20/2009 - 00:01:39: [SM] [0] Line 38, /home/groups/alliedmodders/forums/files/4/4/5/7/4/47874.attach::Event_RoundEnd()
L 08/20/2009 - 00:01:55: [SM] Native "GetClientTeam" reported: Client 6 is not in game
L 08/20/2009 - 00:01:55: [SM] Displaying call stack trace for plugin "l4d_spec_remember.smx":
L 08/20/2009 - 00:01:55: [SM] [0] Line 38, /home/groups/alliedmodders/forums/files/4/4/5/7/4/47874.attach::Event_RoundEnd()
L 08/20/2009 - 00:02:00: [SM] Native "GetClientTeam" reported: Client 3 is not in game
L 08/20/2009 - 00:02:00: [SM] Displaying call stack trace for plugin "l4d_spec_remember.smx":
L 08/20/2009 - 00:02:00: [SM] [0] Line 38, /home/groups/alliedmodders/forums/files/4/4/5/7/4/47874.attach::Event_RoundEnd()
L 08/20/2009 - 00:02:15: [SM] Native "GetClientTeam" reported: Client 3 is not in game
L 08/20/2009 - 00:02:15: [SM] Displaying call stack trace for plugin "l4d_spec_remember.smx":
L 08/20/2009 - 00:02:15: [SM] [0] Line 38, /home/groups/alliedmodders/forums/files/4/4/5/7/4/47874.attach::Event_RoundEnd()
L 08/20/2009 - 00:02:53: Error log file session closed.


olj 08-19-2009 19:30

Re: [L4D] Remember Spectators
 
This should work in other mods, but team numbers would be totally different, so you will have to adjust this.

Add this function somewhere in code, then use IsValidClient check before GetClientTeam on 38 line
EDIT: we dont want to do IsPlayerAlive check, so comment this out.
PHP Code:

public IsValidClient (client)
  
{
    if (
client == 0)
        return 
false;
    
    if (!
IsClientConnected(client))
        return 
false;
    
    if (
IsFakeClient(client))
        return 
false;
    
    if (!
IsClientInGame(client))
        return 
false;
   
// if (!IsPlayerAlive(client))
    //    return false;
    
return true;



Visual77 08-20-2009 03:46

Re: [L4D] Remember Spectators *v1.1*
 
Thanks. But the error message is still their with the new version.
Code:

L 08/20/2009 - 10:21:56: SourceMod error session started
L 08/20/2009 - 10:21:56: Info (map "l4d_vs_hospital05_rooftop") (file "errors_20090820.log")
L 08/20/2009 - 10:21:56: [SM] Native "GetClientTeam" reported: Client 14 is not in game
L 08/20/2009 - 10:21:56: [SM] Displaying call stack trace for plugin "l4d_spec_remember.smx":
L 08/20/2009 - 10:21:56: [SM] [0] Line 38, /home/groups/alliedmodders/forums/files/4/4/5/7/4/47874.attach::Event_RoundEnd()
L 08/20/2009 - 10:22:11: [SM] Native "GetClientTeam" reported: Client 14 is not in game
L 08/20/2009 - 10:22:11: [SM] Displaying call stack trace for plugin "l4d_spec_remember.smx":
L 08/20/2009 - 10:22:11: [SM] [0] Line 38, /home/groups/alliedmodders/forums/files/4/4/5/7/4/47874.attach::Event_RoundEnd()


olj 08-20-2009 04:30

Re: [L4D] Remember Spectators *v1.1*
 
There is no reason why adding valid client checking would screw this. Was there any other changes form 1.0?

Visual77 08-20-2009 04:35

Re: [L4D] Remember Spectators *v1.1*
 
Don't know either. The plugin works but those error messages needs to be taken care of.
I think he only did what you said yesterday, can't see anything different from 1.0 and 1.1

olj 08-20-2009 04:39

Re: [L4D] Remember Spectators *v1.1*
 
Quote:

Originally Posted by Visual77 (Post 906432)
Don't know either. The plugin works but those error messages needs to be taken care of.
I think he only did what you said yesterday, can't see anything different from 1.0 and 1.1

So, it works but there is still erors?
EDIT: OH, well, validation check should be put BEFORE Any other checks. Can you swap this on your self? I cant edit 1st post.

Visual77 08-20-2009 04:41

Re: [L4D] Remember Spectators *v1.1*
 
Yeah.

Visual77 08-20-2009 04:46

Re: [L4D] Remember Spectators *v1.1*
 
You mean at line 38?

olj 08-20-2009 04:54

Re: [L4D] Remember Spectators *v1.1*
 
Quote:

Originally Posted by Visual77 (Post 906439)
Yeah.

Ofcourse.


All times are GMT -4. The time now is 19:35.

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