Raised This Month: $404 Target: $400
 101% 

Name change kicker


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AuricYoutube
Senior Member
Join Date: Aug 2016
Location: Here
Old 09-15-2018 , 10:49   Name change kicker
Reply With Quote #1

So, I am bad at coding, so bad I can't do anything with events, basically, I need a script that, when a player changes username in-game, would kick the player, and tell them the reason of why they got kicked. I tried to do this with NameChecker, but the minimum changes to kick was 3 and not 1, I tried editing it to make the minimum 1, but it just wouldn't change.

Last edited by AuricYoutube; 09-16-2018 at 09:08.
AuricYoutube is offline
dustinandband
Senior Member
Join Date: May 2015
Old 09-15-2018 , 13:02   Re: Name change kicker
Reply With Quote #2

Lemme know if this compiles / works. Copied some code on my iPhone since I’m unable to get to pc for a few days

PHP Code:
#include <sourcemod>

public Plugin myinfo =
{
    
name "Name Change kicker",
    
author "dustin",
    
description "",
    
version "1.0",
    
url "",
};

public 
OnPluginStart()
{
    
HookEvent("player_changename"Event_OnNameChange);
}

public 
Action:Event_OnNameChange(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    if (!
IsClientInGame(client) || IsFakeClient(client)) return Plugin_Handled;
    
    
KickClient(client, &#8220;name changes aren’t allowed.”);
    
return Plugin_Handled;

Edit: the symbols after KickClient(client, - should be a quotation mark
No idea why it did that

Last edited by dustinandband; 09-15-2018 at 13:06.
dustinandband is offline
Ilusion9
Senior Member
Join Date: Jun 2018
Old 09-15-2018 , 13:28   Re: Name change kicker
Reply With Quote #3

PHP Code:
#include <sourcemod>

public OnPluginStart()
{
    
HookEvent("player_changename"OnNameChanged);
}

public 
void OnNameChanged(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid"));
    
    if (
client)
    {
        
KickClient(client"Name changes are not allowed");
    }


Last edited by Ilusion9; 09-15-2018 at 13:28.
Ilusion9 is offline
AuricYoutube
Senior Member
Join Date: Aug 2016
Location: Here
Old 09-16-2018 , 08:35   Re: Name change kicker
Reply With Quote #4

nvm

Last edited by AuricYoutube; 09-16-2018 at 09:22.
AuricYoutube 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 15:18.


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