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

Show bans


Post New Thread Reply   
 
Thread Tools Display Modes
allienaded
AlliedModders Donor
Join Date: Feb 2013
Old 10-21-2014 , 16:01   Re: Show SMAC BAN to non admins
Reply With Quote #21

Quote:
Originally Posted by nomy View Post
Lets try Tony's suggestion.

Use original unmodified smac and use this instead:

PHP Code:
#pragma semicolon 1

#include <sourcemod>

public Action:OnBanClient(clienttimeflags, const String:reason[], const String:kick_message[], const String:command[], any:admin)
{
    
ServerCommand("sm_banip #%d %s \"%s\""GetClientUserId(client), timereason);
    
PrintToChatAll("\x04[SMAC] \x01Player \x03%N \x01has been banned for a cheating infraction."client);

But wouldn't this affect every plugin along with manual banning using the sm_ban command?
allienaded is offline
GoD-Tony
Veteran Member
Join Date: Jul 2005
Old 10-21-2014 , 17:04   Re: Show SMAC BAN to non admins
Reply With Quote #22

Quote:
Originally Posted by allienaded View Post
But wouldn't this affect every plugin along with manual banning using the sm_ban command?
Yes. Here is what I was thinking:
PHP Code:
public Action:OnBanClient(clienttimeflags, const String:reason[], const String:kick_message[], const String:command[], any:admin)
{
    if (
StrEqual(command"SMAC") && flags != BANFLAG_IP)
    {
        
// IP ban and print to chat.
        
BanClient(clienttimeBANFLAG_IPreasonkick_message);
        
PrintToChatAll("Banned %N. (%s)"clientreason);
        
        return 
Plugin_Stop;
    }
    
    return 
Plugin_Continue;

__________________

Last edited by GoD-Tony; 10-21-2014 at 17:07.
GoD-Tony is offline
Sdg
BANNED
Join Date: Mar 2014
Old 10-21-2014 , 18:15   Re: Show SMAC BAN to non admins
Reply With Quote #23

Wait.. Tony, I do not know you're talking about, but this works fine for me..

What is the problem?



Quote:

// native SMAC_Ban(client, const String:reason[], any:...);
public Native_Ban(Handle:plugin, numParams)
{
decl String:sVersion[16], String:sReason[256];
new
client = GetNativeCell(1);
new
duration = GetConVarInt(g_hCvarBanDuration);

GetPluginInfo(plugin, PlInfo_Version, sVersion, sizeof(sVersion));
FormatNativeString(0, 2, 3, sizeof(sReason), _, sReason);
Format(sReason, sizeof(sReason), "SMAC %s: %s", sVersion, sReason);

if (
SOURCEBANS_AVAILABLE())
{
SBBanPlayer(0, client, duration, sReason);
ServerCommand("sm_banip #%d %s \"%s\"", GetClientUserId(client), duration, sReason);
PrintToChatAll("\x04[SMAC] \x01Player \x03%N \x01has been banned for a cheating infraction.", client);
}
else
{
decl String:sKickMsg[256];
FormatEx(sKickMsg, sizeof(sKickMsg), "%T", "SMAC_Banned", client);
BanClient(client, duration, BANFLAG_AUTO, sReason, sKickMsg, "SMAC");
ServerCommand("sm_banip #%d %s \"%s\"", GetClientUserId(client), duration, sReason);
PrintToChatAll("\x04[SMAC] \x01Player \x03%N \x01has been banned for a cheating infraction.", client);
}

KickClient(client, sReason);
}



Last edited by Sdg; 10-21-2014 at 18:19.
Sdg is offline
allienaded
AlliedModders Donor
Join Date: Feb 2013
Old 10-21-2014 , 22:22   Re: Show SMAC BAN to non admins
Reply With Quote #24

Quote:
Originally Posted by Sdg View Post
Wait.. Tony, I do not know you're talking about, but this works fine for me..

What is the problem?





There's no problem with that but what tony posted is a cleaner solution and doesn't require editing the SMAC source (meaning you can update SMAC in the future without the need to re-apply any custom patches).
allienaded is offline
Sdg
BANNED
Join Date: Mar 2014
Old 10-21-2014 , 23:12   Re: Show SMAC BAN to non admins
Reply With Quote #25

Quote:
Originally Posted by allienaded View Post
There's no problem with that but what tony posted is a cleaner solution and doesn't require editing the SMAC source (meaning you can update SMAC in the future without the need to re-apply any custom patches).

Ok, I see.

So.. for that i need use original smac.smx and create a new plugin with this?

and, it only bans the ip..

Quote:
public Action:OnBanClient(client, time, flags, const String:reason[], const String:kick_message[], const String:command[], any:admin)
{
if (
StrEqual(command, "SMAC") && flags != BANFLAG_IP)
{
// IP ban and print to chat.
BanClient(client, time, BANFLAG_IP, reason, kick_message);
PrintToChatAll("Banned %N. (%s)", client, reason);

return
Plugin_Stop;
}

return
Plugin_Continue;
}

Last edited by Sdg; 10-21-2014 at 23:44.
Sdg is offline
nomy
Senior Member
Join Date: Dec 2009
Location: United Kingdom
Old 10-21-2014 , 23:38   Re: Show SMAC BAN to non admins
Reply With Quote #26

Yes.
nomy is offline
Sdg
BANNED
Join Date: Mar 2014
Old 10-22-2014 , 13:39   Re: Show SMAC BAN to non admins
Reply With Quote #27

The other way, editing the smac.sp possible ban ip and id.. (code from nomy)

Tony, Any way to get ban ip and id here?


Quote:
public Action:OnBanClient(client, time, flags, const String:reason[], const String:kick_message[], const String:command[], any:admin)
{
if (
StrEqual(command, "SMAC") && flags != BANFLAG_IP)
{
// IP ban and print to chat.
BanClient(client, time, BANFLAG_IP, reason, kick_message);
PrintToChatAll("Banned %N. (%s)", client, reason);

return
Plugin_Stop;
}

return
Plugin_Continue;
}
Thanks to all.
Sdg is offline
GoD-Tony
Veteran Member
Join Date: Jul 2005
Old 10-22-2014 , 13:49   Re: Show SMAC BAN to non admins
Reply With Quote #28

Quote:
Originally Posted by Sdg View Post
Tony, Any way to get ban ip and id here?
Untested...
Code:
public Action:OnBanClient(client, time, flags, const String:reason[], const String:kick_message[], const String:command[], any:admin)
{
	if (StrEqual(command, "SMAC"))
	{
		// Ban IP and ID.
		BanClient(client, time, BANFLAG_AUTHID|BANFLAG_NOKICK, reason, kick_message);
		BanClient(client, time, BANFLAG_IP, reason, kick_message);
		
		PrintToChatAll("Banned %N. (%s)", client, reason);
		
		return Plugin_Stop;
	}

	return Plugin_Continue;
}
__________________

Last edited by GoD-Tony; 10-22-2014 at 13:50.
GoD-Tony is offline
nomy
Senior Member
Join Date: Dec 2009
Location: United Kingdom
Old 10-22-2014 , 17:00   Re: Show SMAC BAN to non admins
Reply With Quote #29

Tony, removing "return Plugin_Stop;" shouldn't have blocked the actual banning by SMAC?
nomy is offline
GoD-Tony
Veteran Member
Join Date: Jul 2005
Old 10-22-2014 , 17:17   Re: Show SMAC BAN to non admins
Reply With Quote #30

Quote:
Originally Posted by nomy View Post
Tony, removing "return Plugin_Stop;" shouldn't have blocked the actual banning by SMAC?
It will block SMAC's ban and then re-ban the client using the custom logic.
__________________
GoD-Tony 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 13:05.


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