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

[REQ] [TF2] Can someone help me rewrite this plugin?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Flimbo
New Member
Join Date: Apr 2022
Old 04-11-2022 , 08:19   [REQ] [TF2] Can someone help me rewrite this plugin?
Reply With Quote #1

I found a plugin called "instantautoassign" it automatically assigns someone to a team as soon as they enter the server but I would love for it to also put them in a class too.

https://forums.alliedmods.net/showthread.php?t=213521 I found it here but I have no clue how to code for this
Flimbo is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-11-2022 , 12:24   Re: [REQ] [TF2] Can someone help me rewrite this plugin?
Reply With Quote #2

I forgot:
Use cvar = mp_forceautoteam 1

PHP Code:



#include <sdktools>


public void OnPluginStart()
{
    
HookEvent("player_activate"player_activate);
    
HookEvent("player_team"player_team);
}


public 
void player_activate(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid"));

    
// Bots, SourceTV, Replay
    
if(IsFakeClient(client))
        return;

    if(
GetTeamClientCount(2) <= GetTeamClientCount(3)) {
        
ChangeClientTeam(client2);
    } else {
        
ChangeClientTeam(client3);
    }
}


public 
void player_team(Event event, const char[] namebool dontBroadcast)
{
/*
Server event "player_team", Tick 6012:
- "userid" = "3"
- "team" = "3"
- "oldteam" = "0"
- "disconnect" = "0"
- "autoteam" = "1"
- "silent" = "0"
- "name" = "'Bacardi"
*/
    
static ConVar mp_forceautoteam;

    if(
mp_forceautoteam == null)
    {
        
mp_forceautoteam FindConVar("mp_forceautoteam");
    }

    if(
mp_forceautoteam == null || !mp_forceautoteam.BoolValue || event.GetBool("disconnect") || event.GetInt("oldteam") != 0)
        return;

    
int client GetClientOfUserId(event.GetInt("userid"));
    
ClientCommand(client"joinclass random");


__________________
Do not Private Message @me

Last edited by Bacardi; 04-11-2022 at 13:58. Reason: updated
Bacardi is offline
Kuumi
New Member
Join Date: Apr 2022
Old 04-11-2022 , 13:42   Re: [REQ] [TF2] Can someone help me rewrite this plugin?
Reply With Quote #3

@Bacardi do you mind compiling it and making it a smx for me please? I'd really appreciate it.
Kuumi is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-11-2022 , 13:44   Re: [REQ] [TF2] Can someone help me rewrite this plugin?
Reply With Quote #4

...I could,
but maybe it is better you to learn, how it is maded.
And I don't want to be a as whole, you could try to search (even with google) how you compile SourceMod plugin.



It is very easy.
__________________
Do not Private Message @me
Bacardi is offline
Kuumi
New Member
Join Date: Apr 2022
Old 04-11-2022 , 13:51   Re: [REQ] [TF2] Can someone help me rewrite this plugin?
Reply With Quote #5

Compileing spits this error at me

instantautoassign.sp(16) : error 076: syntax error in the expression, or invalid function call

Last edited by Kuumi; 04-11-2022 at 13:56.
Kuumi is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 04-11-2022 , 13:56   Re: [REQ] [TF2] Can someone help me rewrite this plugin?
Reply With Quote #6

updated, forget add client in IsFakeClient

*edit
Use cvar mp_forceautoteam 1
__________________
Do not Private Message @me

Last edited by Bacardi; 04-11-2022 at 13:58.
Bacardi is offline
Kuumi
New Member
Join Date: Apr 2022
Old 04-11-2022 , 13:57   Re: [REQ] [TF2] Can someone help me rewrite this plugin?
Reply With Quote #7

The compile worked thanks a ton!
Kuumi 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 23:06.


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