Raised This Month: $ Target: $400
 0% 

[L4D2] Block choose team menu


Post New Thread Reply   
 
Thread Tools Display Modes
HarryPotter
Veteran Member
Join Date: Sep 2017
Location: Taiwan, Asia
Old 11-16-2020 , 09:49   Re: [L4D2] Block choose team menu
Reply With Quote #11

Quote:
Originally Posted by JLmelenchon View Post
Does nothing unfortunately, with the key to open the change team menu or with "chooseteam" in console.
It seems that can't block the menu.
Although client can still open menu, it can't be allowed to change team.
__________________

Last edited by HarryPotter; 11-16-2020 at 09:50.
HarryPotter is offline
JLmelenchon
Senior Member
Join Date: Mar 2019
Old 11-17-2020 , 04:52   Re: [L4D2] Block choose team menu
Reply With Quote #12

I have the log of commands used by clients on my server, when i press change team menu (chooseteam) it does not register it. This is probably why it does not send the chat message, how to fix that ?

Last edited by JLmelenchon; 11-17-2020 at 04:53.
JLmelenchon is offline
HarryPotter
Veteran Member
Join Date: Sep 2017
Location: Taiwan, Asia
Old 11-17-2020 , 07:17   Re: [L4D2] Block choose team menu
Reply With Quote #13

Quote:
Originally Posted by JLmelenchon View Post
I have the log of commands used by clients on my server, when i press change team menu (chooseteam) it does not register it. This is probably why it does not send the chat message, how to fix that ?
sp
PHP Code:
#include <sourcemod>
#include <sdktools>

#pragma semicolon 1
#pragma newdecls required

#define PLUGIN_VERSION "0.00"

public Plugin myinfo 
{
    
name "Name of plugin here!",
    
author "Your name here!",
    
description "Brief description of plugin functionality here!",
    
version PLUGIN_VERSION,
    
url "Your website URL/AlliedModders profile URL"
};

public 
void OnPluginStart()
{
    
LoadTranslations("BlockChooseTeam.phrases");
    
    
AddCommandListener(OnTeamSwitchCmd"chooseteam");
    
AddCommandListener(OnTeamSwitchCmd"jointeam"); // in case of vocalizer addons
}

public 
Action OnTeamSwitchCmd(int client, const char[] commandint argc)
{
    
// do stuff here
    
PrintToChat(client"%T""Manual_Team_Change_Blocked"client);
    return 
Plugin_Stop// cuz Plugin_Handled still doesn't block these particular commands from being processed

translation file (put in addons\sourcemod\translations\)
PHP Code:
"Phrases"
{
    
"Manual_Team_Change_Blocked"
    
{
        
"en"        "You can change team with !infected or !survivor."
        "chi"       "请使用 !infected 或 !survivor 换队"
        "zho"       "請使用 !infected 或 !survivor 換隊."
    
}

__________________

Last edited by HarryPotter; 11-17-2020 at 07:19.
HarryPotter is offline
JLmelenchon
Senior Member
Join Date: Mar 2019
Old 11-17-2020 , 09:49   Re: [L4D2] Block choose team menu
Reply With Quote #14

It works fine the chat message trigger once the player click on the team where he want to switch inside the menu (jointeam), just it seems sourcemod is not able to detect directly when the player simply open the menu (chooseteam). I'm using that with your plugin "AFK commands" good job man.

Last edited by JLmelenchon; 11-17-2020 at 09:49.
JLmelenchon is offline
JLmelenchon
Senior Member
Join Date: Mar 2019
Old 11-18-2020 , 18:29   Re: [L4D2] Block choose team menu
Reply With Quote #15

I don't want to create another post for that, but what i should add to the code if i want to disable temporarily these commands only when survivors are still inside the saferoom ?
JLmelenchon is offline
HarryPotter
Veteran Member
Join Date: Sep 2017
Location: Taiwan, Asia
Old 11-18-2020 , 21:25   Re: [L4D2] Block choose team menu
Reply With Quote #16

Quote:
Originally Posted by JLmelenchon View Post
I don't want to create another post for that, but what i should add to the code if i want to disable temporarily these commands only when survivors are still inside the saferoom ?
PHP Code:
#include <left4dhooks>
.
.
.
.
public 
Action OnTeamSwitchCmd(int client, const char[] commandint argc)
{
    if (
L4D_HasAnySurvivorLeftSafeArea() == false)
    {
        
PrintToChat(client"%T""Manual_Team_Change_Blocked"client);
        return 
Plugin_Stop;
    }
    return 
Plugin_Continue;

__________________

Last edited by HarryPotter; 11-18-2020 at 21:26.
HarryPotter is offline
JLmelenchon
Senior Member
Join Date: Mar 2019
Old 11-19-2020 , 10:15   Re: [L4D2] Block choose team menu
Reply With Quote #17

Thank you, i added that on your afk commands plugin for Public action "turnclientoninfected" and survivor and it works like a charm.

Code:
if (L4D_HasAnySurvivorLeftSafeArea() == false)
    {
        PrintToChat(client, "%T", "Manual_Team_Change_Saferoom", client);
        return Plugin_Handled;
    }

Last edited by DarkDeviL; 11-20-2020 at 04:19. Reason: Added CODE tags
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 05:44.


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