PDA

View Full Version : Renaming people if they have same name as admins, if they don't have same GUID



Uppah
7th September 2020, 00:56
I'm currently working with Eaeliboy's "Multiple unknown soldier renamer". Here I'm trying to make it impossible for people to use our names if they don't have the same GUID as us.

But I just can't get the following script to work:



//This script was made by Earliboy
//You are free to use or edit this file.
//Do not forget to credit me.
//Any help you get at: xfire: earliboy skype: earliboy

//Adding new rename:
//level.unkNames[level.unkNames.size] = "NAME";
//Example: level.unkNames[level.unkNames.size] = "US Guest #000";

//Adding a new name player should renamed to:
//level.unkRename[level.unkRename.size] = "NAME";
//Example: level.unkRename[level.unkRename.size] = "Unknown Player#" + num;

init()
{
level.adminNames = [];
level.adminNames[level.adminNames.size] = "Uppah";
level.adminNames[level.adminNames.size] = "sdrifle#Uppah";
level.adminNames[level.adminNames.size] = "sdrifle # Uppah";
level.adminNames[level.adminNames.size] = "loser | Uppah";
level.adminNames[level.adminNames.size] = "[UdSSR] Uppah";
level.adminNames[level.adminNames.size] = "Nerty_";
level.adminNames[level.adminNames.size] = "sdrifle.com#Nerty";
level.adminNames[level.adminNames.size] = "sdr.yt#Nerty";
level.adminNames[level.adminNames.size] = "n3rty";
level.adminNames[level.adminNames.size] = "n e r t y";
level.adminNames[level.adminNames.size] = "Nerty";
level.adminNames[level.adminNames.size] = "``Air Savage ! :>";
level.adminNames[level.adminNames.size] = "Mr Savage !";
level.adminNames[level.adminNames.size] = "too high for this shit :>";
level.adminNames[level.adminNames.size] = "savage the director";

/**
* 884750 = Uppah | 249816 = Wolft
* 892561 = Nerty | 956379 = Maeva
* 796907 = Savage | 726220 = Mehdi
* 705330 = Blaadje | 782511 = Blitz
* 880271 = Miki | 805143 = Matt
* 881431 = Vuzqii | 726901 = redwhite
* 962969 = pablito | 924561 = Hannie
* 750925 = kRis | 217313 = T-REX
* 748044 = Haaveilen | 743819 = Dano
* 732746 = F4RE | 802977 = Rocc
* 922866 = admin lies |
*/
level.adminGUIDs = []
level.adminGUIDs[level.adminGUIDs.size] = 884750;
level.adminGUIDs[level.adminGUIDs.size] = 892561;
level.adminGUIDs[level.adminGUIDs.size] = 796907;
level.adminGUIDs[level.adminGUIDs.size] = 705330;
level.adminGUIDs[level.adminGUIDs.size] = 249816;
level.adminGUIDs[level.adminGUIDs.size] = 956379;
level.adminGUIDs[level.adminGUIDs.size] = 726220;
level.adminGUIDs[level.adminGUIDs.size] = 782511;
level.adminGUIDs[level.adminGUIDs.size] = 880271;
level.adminGUIDs[level.adminGUIDs.size] = 805143;
level.adminGUIDs[level.adminGUIDs.size] = 881431;
level.adminGUIDs[level.adminGUIDs.size] = 726901;
level.adminGUIDs[level.adminGUIDs.size] = 962969;
level.adminGUIDs[level.adminGUIDs.size] = 924561;
level.adminGUIDs[level.adminGUIDs.size] = 750925;
level.adminGUIDs[level.adminGUIDs.size] = 217313;
level.adminGUIDs[level.adminGUIDs.size] = 748044;
level.adminGUIDs[level.adminGUIDs.size] = 743819;
level.adminGUIDs[level.adminGUIDs.size] = 732746;
level.adminGUIDs[level.adminGUIDs.size] = 802977;
level.adminGUIDs[level.adminGUIDs.size] = 922866;

thread waitConnect();
}

waitConnect()
{
for(;;)
{
level waittill("connecting", player);
player thread checkMe();
}
}

checkMe()
{
for(i = 0; i < level.adminNames.size; i++)
{
if(self.name == level.adminNames[i])
{
for(j = 0; j < level.adminGUIDs.size; j++)
{
if(self getGuid() == level.adminGUIDs[j]){
self setClientCvar("name", level.adminNames[i]);
break;
}

if(j == level.adminGUIDs.size - 1 && self getGuid() != level.adminGUIDs[j]){
sdname = "^8sdrifle.com^3#^9F@n^1:^7" + randomInt(9999);
self setClientCvar("name", sdname);
}
}
}
}
}


Regards,
Uppah

IzNoGoD
7th September 2020, 15:36
checkme()
{
adminname = undefined;
for(i = 0; i < level.adminnames.size; i++)
{
if(level.adminnames[i] == self.name)
{
adminname = i;
break;
}
}
if(!isdefined(adminname))
return;

admin = undefined;
for(i = 0; i < level.adminguids.size; i++)
{
if(level.adminguids[i] == self getguid())
admin = i;
}

if(!isdefined(admin))
{
self setclientcvar("name", "^8sdrifle.com^3#^9F@n^1:^7" + randomInt(9999));
}
else if(admin != adminname)
{
self setclientcvar("name", level.adminnames[admin]);
}
}

Uppah
7th September 2020, 16:35
******* script compile error *******
bad syntax: (file 'maps/mp/gametypes/_unkrn.gsc', line 47)
level.adminGUIDs[level.adminGUIDs.size] = 884750;

IzNoGoD
7th September 2020, 16:52
Line 46, add a ; at the end.

Uppah
8th September 2020, 13:18
Line 46, add a ; at the end.

Works! Thank you so much!

Another question:
If I want it to check if a player change a name into the names in the adminNames array all the time - from when they connect till they disconnect. How do I tackle that problem?

Again, thank you so much for your help!

maxdamage99
9th September 2020, 10:45
if you using libcod:


/* your callback script (callbacksetup) */
CodeCallback_UserInfoChanged(num)
{
name = self get_userinfo("name");
if (self.name != name && !self isBot())
{
self.name = name;
return self thread scripts\_names::checkme();
}

self clientuserinfochanged();
}

This is not very good code, it is best to rework the renaming functions with the return of the result (yes / no) in case of success (good nickname) / failure (nickname is not allowed) -> then update / do not update userinfo

if you not using libcod, create loop for checking name != oldname with delay: 0.5 - 1 sec.
Or insert checking-code into exist loop.

Uppah
9th September 2020, 18:44
Yeah, I'm using libcod.

I totally forgot about the callback script! I actually used it for when I did anti-namesteal.
I'll go play a little around with it. Thank you pointing me in the right direction, I really appreciate it!