Created
October 21, 2022 07:36
-
-
Save zudsniper/ccb2fe6c7b4d1ca21ce5007116447e8c to your computer and use it in GitHub Desktop.
Another bad, unfinished SourceMod plugin to permanently rename a player (ie re-rename them when they join again)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this all originated from this AlliedModders thread | |
# https://forums.alliedmods.net/showthread.php?t=183146 | |
#include <sourcemod> | |
#pragma semicolon 1 | |
#pragma newdecls required | |
public Plugin myinfo = { | |
name = "permaRename", | |
author = "GoD-Tony...zodsuper", | |
description = "mod", | |
version = "0.0.0", | |
url = "" | |
}; | |
public void OnPluginStart() | |
{ | |
PrintToServer("permarename on"); | |
} | |
/** | |
* Changes a clients name | |
* | |
* @param client A client index. | |
* @param name Set to false to skip the IsClientConnected check | |
* @param silent Set to true to not broadcast the name change | |
* @noreturn | |
*/ | |
stock SetClientName(client, const String:name[], bool:silent=false) | |
{ | |
decl String:oldname[MAX_NAME_LENGTH]; | |
GetClientName(client, oldname, sizeof(oldname)); | |
SetClientInfo(client, "name", name); | |
SetEntPropString(client, Prop_Data, "m_szNetname", name); | |
new Handle:event = CreateEvent("player_changename"); | |
if (event != INVALID_HANDLE) | |
{ | |
SetEventInt(event, "userid", GetClientUserId(client)); | |
SetEventString(event, "oldname", oldname); | |
SetEventString(event, "newname", name); | |
FireEvent(event); | |
} | |
if (silent) | |
return; | |
new Handle:msg = StartMessageAll("SayText2"); | |
if (msg != INVALID_HANDLE) | |
{ | |
BfWriteByte(msg, client); | |
BfWriteByte(msg, true); | |
BfWriteString(msg, "Cstrike_Name_Change"); | |
BfWriteString(msg, oldname); | |
BfWriteString(msg, name); | |
EndMessage(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment