Raised This Month: $32 Target: $400
 8% 

[CS:GO] Ban opon game reason


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
einsfuhrer
Member
Join Date: Jun 2019
Old 09-08-2019 , 13:31   [CS:GO] Ban opon game reason
Reply With Quote #1

Hay! So I came up with this cool idea, I got some help with it here before on this thread: https://forums.alliedmods.net/showthread.php?t=318291

But now I also want to convert teamdamage bans (the ban you get when you teamkill in the start or deal to much damage to teammates) into a Sourceban ban. But I'm having some issues to find the reason for each ban.

So here is what I need help with: In the code on the thread I showed, the plugin checks for the reason 'Kicked by Console', but all kind of kick reasons (votekicked, to much damage, damage on start of round) has the reason 'Kicked by Console' so I want to get a more specified reason on each reason to get kicked.

I tried this...
PHP Code:
            if (StrContains(sReason"You have been voted off"false) != -1)
            {
                
SBPP_BanPlayer0client30"Votekicked");
            }
            else if (
StrContains(sReason"For doing too much team damage"false) != -1)
            {
                
SBPP_BanPlayer0client30"Teamdamage/killing");
            } 
but that didnt work. So does someone know what the specific reason are when you get votekicked, dealing to much damage and kill on round start?

This is the console outputs when you get kicked for each way to get kicked:


Votekicked:
Code:
Dropped Player from server: Kicked by Console : You have been voted off
Dealing to much damage:
Code:
Dropped Player from server: Kicked by Console : For doing too much team damage
Kill on round start:
Code:
Dropped Player from server: Kicked by Console : For killing a teammate at round start

To sum it up: How do i specify these three kick reasons so I can set different length and reasons?

Thanks in advance
einsfuhrer is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 09-15-2019 , 08:52   Re: [CS:GO] Ban opon game reason
Reply With Quote #2

Code:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		// Player Disconnect Reasons
		// Used as the second argument in the message "Player %s1 left the game (%s2)" which gets added to the hud chat when another player disconnects
		////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

		"Player_DisconnectReason_TeamKilling"				"For killing too many teammates"
		"Player_DisconnectReason_TK_Start"					"For killing a teammate at round start"
		"Player_DisconnectReason_UntrustedAccount"			"Account is Untrusted"
		"Player_DisconnectReason_ConvictedAccount"			"Account is Convicted"
		"Player_DisconnectReason_CompetitiveCooldown"		"Player has competitive matchmaking cooldown"
		"Player_DisconnectReason_TeamHurting"				"For doing too much team damage"
		"Player_DisconnectReason_HostageKilling"			"For killing too many hostages"
		"Player_DisconnectReason_ServerTimeout"				"Connection to server timed out"
		"Player_DisconnectReason_AddBan"					"Added to banned list"
		"Player_DisconnectReason_KickedBanned"				"Kicked and banned"
		"Player_DisconnectReason_VotedOff"					"Voted off"
		"Player_DisconnectReason_VAC"						"VAC authentication error"
		"Player_DisconnectReason_Idle"						"Player idle"
		"Player_DisconnectReason_Suicide"					"For suiciding too many times"
		"Player_DisconnectReason_MustUseMatchmaking"		"Attempted to connect without using official matchmaking"
		"Player_DisconnectReason_ServerLanRestricted"		"Attempted to connect from outside local area network"
		"Player_DisconnectReason_Kicked"					"Kicked from the session"
		"Player_DisconnectReason_Disconnect"				"Disconnected"
		"Player_DisconnectReason_TimedOut"					"timed out"
		"Player_DisconnectReason_NoSteamLogin"				"no user logon"
		"Player_DisconnectReason_NoSteamTicket"				"Game authentication failed"
		"Player_DisconnectReason_ConnectionClosing"			"connection closing"
Use usermessages for checking disconnect reasons (admins can write "teamkill" reason for sm_kick command).

PHP Code:
public void OnPluginStart()
{
    
HookUserMessage(GetUserMessageId("TextMsg"), Hook_TextMsgtrue); // idk if its TextMsg for these messages
}

public 
Action Hook_TextMsg(UserMsg msg_idProtobuf msg, const int[] playersint playersNumbool reliablebool init)
{
    
char buffer[64];
    
int client msg.ReadInt("params"0); // idk if its working

    
msg.ReadString("params"buffersizeof(buffer), 1);

    if (
StrEqual(buffer"#Player_DisconnectReason_TeamKilling"))
    {
        
// teamkill
    
}

    else if (
StrEqual(buffer"#Player_DisconnectReason_TK_Start"))
    {
        
// kill round start
    
}

__________________
Ilusion9 is offline
einsfuhrer
Member
Join Date: Jun 2019
Old 09-16-2019 , 13:13   Re: [CS:GO] Ban opon game reason
Reply With Quote #3

Quote:
Originally Posted by Ilusion9 View Post
Code:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		// Player Disconnect Reasons
		// Used as the second argument in the message "Player %s1 left the game (%s2)" which gets added to the hud chat when another player disconnects
		////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

		"Player_DisconnectReason_TeamKilling"				"For killing too many teammates"
		"Player_DisconnectReason_TK_Start"					"For killing a teammate at round start"
		"Player_DisconnectReason_UntrustedAccount"			"Account is Untrusted"
		"Player_DisconnectReason_ConvictedAccount"			"Account is Convicted"
		"Player_DisconnectReason_CompetitiveCooldown"		"Player has competitive matchmaking cooldown"
		"Player_DisconnectReason_TeamHurting"				"For doing too much team damage"
		"Player_DisconnectReason_HostageKilling"			"For killing too many hostages"
		"Player_DisconnectReason_ServerTimeout"				"Connection to server timed out"
		"Player_DisconnectReason_AddBan"					"Added to banned list"
		"Player_DisconnectReason_KickedBanned"				"Kicked and banned"
		"Player_DisconnectReason_VotedOff"					"Voted off"
		"Player_DisconnectReason_VAC"						"VAC authentication error"
		"Player_DisconnectReason_Idle"						"Player idle"
		"Player_DisconnectReason_Suicide"					"For suiciding too many times"
		"Player_DisconnectReason_MustUseMatchmaking"		"Attempted to connect without using official matchmaking"
		"Player_DisconnectReason_ServerLanRestricted"		"Attempted to connect from outside local area network"
		"Player_DisconnectReason_Kicked"					"Kicked from the session"
		"Player_DisconnectReason_Disconnect"				"Disconnected"
		"Player_DisconnectReason_TimedOut"					"timed out"
		"Player_DisconnectReason_NoSteamLogin"				"no user logon"
		"Player_DisconnectReason_NoSteamTicket"				"Game authentication failed"
		"Player_DisconnectReason_ConnectionClosing"			"connection closing"
Use usermessages for checking disconnect reasons (admins can write "teamkill" reason for sm_kick command).

PHP Code:
public void OnPluginStart()
{
    
HookUserMessage(GetUserMessageId("TextMsg"), Hook_TextMsgtrue); // idk if its TextMsg for these messages
}

public 
Action Hook_TextMsg(UserMsg msg_idProtobuf msg, const int[] playersint playersNumbool reliablebool init)
{
    
char buffer[64];
    
int client msg.ReadInt("params"0); // idk if its working

    
msg.ReadString("params"buffersizeof(buffer), 1);

    if (
StrEqual(buffer"#Player_DisconnectReason_TeamKilling"))
    {
        
// teamkill
    
}

    else if (
StrEqual(buffer"#Player_DisconnectReason_TK_Start"))
    {
        
// kill round start
    
}

Worked to compile, however, it doesn't ban on Sourcebans. Here is my error log:

Code:
L 09/16/2019 - 19:06:57: [SM] Exception reported: Invalid field "params"[0] for message "CCSUsrMsg_TextMsg"
L 09/16/2019 - 19:06:57: [SM] Blaming: turf_banconverter.smx
L 09/16/2019 - 19:06:57: [SM] Call stack trace:
L 09/16/2019 - 19:06:57: [SM]   [0] Protobuf.ReadInt
L 09/16/2019 - 19:06:57: [SM]   [1] Line 23, D:\TURF\TURF\TURF\Scripting\Plugin Sourcecodes\scripting\turf_banconverter.sp::Hook_TextMsg
L 09/16/2019 - 19:06:57: [SM]   [3] PrintCenterText
L 09/16/2019 - 19:06:57: [SM]   [4] Line 128, E:\TURF\TURF!3\TURF!3\TURF!\Scripting\Plugin Sourcecodes\scripting\turf_advertise.sp::Timer_DisplayAd
Is this something you can fix?
einsfuhrer is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 09-17-2019 , 08:08   Re: [CS:GO] Ban opon game reason
Reply With Quote #4

You should test the code, avoid using directly in your plugin.
TextMsg doesn't trigger the message of players disconnecting, not even SayText or SayText2.

Check for spawn kills and team damage in a custom plugin and kick/ban players.
__________________
Ilusion9 is offline
einsfuhrer
Member
Join Date: Jun 2019
Old 09-17-2019 , 15:28   Re: [CS:GO] Ban opon game reason
Reply With Quote #5

Quote:
Originally Posted by Ilusion9 View Post
You should test the code, avoid using directly in your plugin.
TextMsg doesn't trigger the message of players disconnecting, not even SayText or SayText2.

Check for spawn kills and team damage in a custom plugin and kick/ban players.
I don't understand what I should do. Could you please explain a bit detailed?
einsfuhrer 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 07:31.


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