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

[L4D2] Block choose team menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JLmelenchon
Senior Member
Join Date: Mar 2019
Old 11-16-2020 , 03:17   [L4D2] Block choose team menu
Reply With Quote #1

Is it possible to block the choose team menu and when player press the key who trigger the command, PrintToChat a message who says instead he can use various commands in the chat to change team.
JLmelenchon is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 11-16-2020 , 03:57   Re: [L4D2] Block choose team menu
Reply With Quote #2

PHP Code:
public void OnPluginStart()
{
    
AddCommandListener(OnTeamSwitchCmd"chooseteam");
    
AddCommandListener(OnTeamSwitchCmd"jointeam"); // in case of vocalizer addons
}

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


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

plugin.sp(3) : error 100: function prototypes do not match
plugin.sp(4) : error 100: function prototypes do not match
JLmelenchon is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 11-16-2020 , 05:30   Re: [L4D2] Block choose team menu
Reply With Quote #4

Quote:
Originally Posted by JLmelenchon View Post
plugin.sp(3) : error 100: function prototypes do not match
plugin.sp(4) : error 100: function prototypes do not match
Change "void" to "Action". The command listener callback needs to be an Action function.
__________________
Psyk0tik is offline
JLmelenchon
Senior Member
Join Date: Mar 2019
Old 11-16-2020 , 06:22   Re: [L4D2] Block choose team menu
Reply With Quote #5

plugin.sp(1) : error 139: could not find type "action"

Or maybe more easy simply trigger a chat message when he open chooseteam menu, don't need to block the command.

Last edited by JLmelenchon; 11-16-2020 at 06:22.
JLmelenchon is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 11-16-2020 , 06:38   Re: [L4D2] Block choose team menu
Reply With Quote #6

Quote:
Originally Posted by JLmelenchon View Post
plugin.sp(1) : error 139: could not find type "action"

Or maybe more easy simply trigger a chat message when he open chooseteam menu, don't need to block the command.
You didn't capitalize "Action"...

PHP Code:
public void OnPluginStart()
{
    
AddCommandListener(OnTeamSwitchCmd"chooseteam");
    
AddCommandListener(OnTeamSwitchCmd"jointeam"); // in case of vocalizer addons
}

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

__________________

Last edited by Psyk0tik; 11-16-2020 at 06:39.
Psyk0tik is offline
JLmelenchon
Senior Member
Join Date: Mar 2019
Old 11-16-2020 , 07:14   Re: [L4D2] Block choose team menu
Reply With Quote #7

Ok like that :

Quote:
public void OnPluginStart()
{
AddCommandListener(OnTeamSwitchCmd, "chooseteam");
AddCommandListener(OnTeamSwitchCmd, "jointeam"); // in case of vocalizer addons
}

public Action OnTeamSwitchCmd(int client, const char[] command, int argc)
{
// do stuff here
PrintToChat(client, "You can change team with !infected or !survivor.")
return Plugin_Stop; // cuz Plugin_Handled still doesn't block these particular commands from being processed
}
I am going to try it. What should i add if want to implement translations ?

Last edited by JLmelenchon; 11-16-2020 at 07:16.
JLmelenchon is offline
JLmelenchon
Senior Member
Join Date: Mar 2019
Old 11-16-2020 , 07:30   Re: [L4D2] Block choose team menu
Reply With Quote #8

Does nothing unfortunately, with the key to open the change team menu or with "chooseteam" in console.
JLmelenchon is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 11-16-2020 , 09:12   Re: [L4D2] Block choose team menu
Reply With Quote #9

If the team switch panel doesn't appear, it means it's working.
About translations, you will need to make a .txt file and put them there.
Example:

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

The team menu panel still appear but it is not a big deal, just it does not trigger a message in the chat. Did i miss something in printtochat?
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 09:27.


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