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

TF2 Class Restrictions 0.6 (Updated 08/13/09)


Post New Thread Reply   
 
Thread Tools Display Modes
KingOfHeart
Junior Member
Join Date: Dec 2014
Old 04-06-2015 , 00:37   Re: TF2 Class Restrictions 0.6 (Updated 08/13/09)
Reply With Quote #471

UPDATE... I believe I fixed the issue!

Code:
PickClass(iClient)
{
    // Loop through all classes, starting at random class
    for(new i = GetRandomInt(TF_CLASS_SCOUT, TF_CLASS_ENGINEER), iClass = i, iTeam = GetClientTeam(iClient);;)
    {
        // If team's class is not full, set client's class
        if(!IsFull(iTeam, i))
        {
            TF2_SetPlayerClass(iClient, TFClassType:i);
            TF2_RespawnPlayer(iClient);
            g_iClass[iClient] = i;
            break;
        }
        // If next class index is invalid, start at first class
        else if(++i > TF_CLASS_ENGINEER)
            i = TF_CLASS_SCOUT;
        // If loop has finished, stop searching
        else if(i == iClass)
        {
            ChangeClientTeam(iClient, 1);
            break;
        }
    }
}
All I added was the line ChangeClientTeam(iClient, 1);
Now if all classes are filled, it forces the person into spectate(If all works smoothly & so far it works fine)

Last edited by asherkin; 04-07-2015 at 07:47. Reason: Removed binary, no source code.
KingOfHeart is offline
Phaiz
AlliedModders Donor
Join Date: Feb 2014
Location: USA
Old 04-06-2015 , 08:24   Re: TF2 Class Restrictions 0.6 (Updated 08/13/09)
Reply With Quote #472

Quote:
Originally Posted by KingOfHeart View Post
UPDATE... I believe I fixed the issue!

Code:
PickClass(iClient)
{
    // Loop through all classes, starting at random class
    for(new i = GetRandomInt(TF_CLASS_SCOUT, TF_CLASS_ENGINEER), iClass = i, iTeam = GetClientTeam(iClient);;)
    {
        // If team's class is not full, set client's class
        if(!IsFull(iTeam, i))
        {
            TF2_SetPlayerClass(iClient, TFClassType:i);
            TF2_RespawnPlayer(iClient);
            g_iClass[iClient] = i;
            break;
        }
        // If next class index is invalid, start at first class
        else if(++i > TF_CLASS_ENGINEER)
            i = TF_CLASS_SCOUT;
        // If loop has finished, stop searching
        else if(i == iClass)
        {
            ChangeClientTeam(iClient, 1);
            break;
        }
    }
}
All I added was the line ChangeClientTeam(iClient, 1);
Now if all classes are filled, it forces the person into spectate(If all works smoothly & so far it works fine)

I think you still need to add the source file
__________________
Phaiz is offline
TheMightyMat
New Member
Join Date: May 2015
Old 05-26-2015 , 09:51   Re: TF2 Class Restrictions 0.6 (Updated 08/13/09)
Reply With Quote #473

Really great plugin, but is there any way of having it say (1 of 2), or (1 of MAX) etc. above the selection screen, since it can be quite confusing when it just goes "No!" and you don't really know why. I have seen it on some servers, such as a "Stop that tank!" server that I play on.
TheMightyMat is offline
goodBEan
Senior Member
Join Date: Jul 2010
Location: St. Louis Mo USA
Old 06-07-2015 , 18:06   Re: TF2 Class Restrictions 0.6 (Updated 08/13/09)
Reply With Quote #474

Does this plugin still work? Seeing "(Updated 08/13/09)" does make a bit hesitant.
goodBEan is offline
goosmurf
Junior Member
Join Date: Oct 2012
Location: Sydney, Australia
Old 06-08-2015 , 01:44   Re: TF2 Class Restrictions 0.6 (Updated 08/13/09)
Reply With Quote #475

Quote:
Originally Posted by goodBEan View Post
Does this plugin still work? Seeing "(Updated 08/13/09)" does make a bit hesitant.
Works fine.

The migration from .wav to .mp3 a few months back affected the sounds in this plugin but didn't break the core functionality. But you should probably use https://forums.alliedmods.net/showpo...&postcount=467 so that the sounds work.

In general plugins only require updates for two main reasons.

1. New functionality/features - not really much to add to this.

2. TF2 updates breaking functionality - tends not to affect simpler plugins like this one.

Hence the lack of updates - they're simply not needed.
goosmurf is offline
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 06-15-2015 , 18:02   Re: TF2 Class Restrictions 0.6 (Updated 08/13/09)
Reply With Quote #476

I've been implementing my own class limits for stt and I've found a few bugs in this plugin. The code in player_team simply does not work. When player_team is called, GetClientTeam() will report the client's old team. That causes a problem for IsFull and PickClass.

Thankfully, the code in player_spawn works fine and will catch the above problems.
__________________

Last edited by pheadxdll; 06-15-2015 at 18:03.
pheadxdll is offline
Argos
Member
Join Date: Apr 2015
Old 11-15-2015 , 14:17   Re: TF2 Class Restrictions 0.6 (Updated 08/13/09)
Reply With Quote #477

I was having serious trouble in the server, with each death, it forced class selection again, and all players frozen for more than 5 seconds. I see this error in console, disable classrestriction and the problems are over. any chance of an upgrade?

L 11/15/2015 - 15:552: [SM] Plugin encountered error 30: Script execution timed out
L 11/15/2015 - 15:552: [SM] Displaying call stack trace for plugin "classrestrict.smx":
L 11/15/2015 - 15:552: [SM] [0] Line 153, /home/forums/content/files/3/4/6/6/8/27957.attach::IsFull()
L 11/15/2015 - 15:552: [SM] [1] Line 178, /home/forums/content/files/3/4/6/6/8/27957.attach:ickClass()
L 11/15/2015 - 15:552: [SM] [2] Line 109, /home/forums/content/files/3/4/6/6/8/27957.attach::Event_PlayerSpawn
()
Argos is offline
Fearts
ferts of daeth
Join Date: Oct 2008
Old 12-10-2017 , 23:13   Re: TF2 Class Restrictions 0.6 (Updated 08/13/09)
Reply With Quote #478

There is something in this plugin that conflicts with FF2 and causes the server to crash once a day. This started happening after the big TF2 update.

https://crash.limetech.org/stats/a48...14f22b8fca7edb

^Here is the crash where multiple server owners are getting it.
__________________
Fearts is offline
ratawar
BANNED
Join Date: Dec 2017
Location: GB
Old 04-29-2020 , 09:52   Re: TF2 Class Restrictions 0.6 (Updated 08/13/09)
Reply With Quote #479

With Tsunami's permission, I did some small updates to the plugin:

v1.0
  • Added sm_classrestrict_sounds cvar to toggle on/off sound effects (Default: 1)
  • Updated syntax
  • Changed sound files format to .mp3
Attached Files
File Type: sp Get Plugin or Get Source (classrestrict.sp - 509 views - 8.5 KB)

Last edited by ratawar; 04-29-2020 at 10:02.
ratawar is offline
Send a message via ICQ to ratawar Send a message via AIM to ratawar Send a message via Yahoo to ratawar Send a message via Skype™ to ratawar
venter25
Member
Join Date: Jul 2019
Old 05-08-2020 , 22:16   Re: TF2 Class Restrictions 0.6 (Updated 08/13/09)
Reply With Quote #480

Is there anyway we can use this so it turns off after a player threshold is reached? I would like to limit the demoman until a certain amount of players get on the server.
venter25 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 01:54.


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