Author Topic: Set clan tags on join  (Read 1685 times)

Say you have a server, and have a group of friends.

You want everyone in that group of friends to have some cool colorful clan tags that say "frnd" in blue letters.  (This is just an example)

I need something like this. So when my friends join, i dont gotta findclientbyname("Person").clanpref-blah. This way all my friends can have the tags i want em to. Kinda like the AoKE tags in sanctus' server.

Edit: Do you want it for everyone that joins, or like a special group of people to only have these clan tags?



//When the player joins, the can tags will be set to this
//NOTE: This is untested, and it changes the tags for everyone.
//Change the values to change what the tag becomes

$Pref::Server::ClanPrefixOverride = "ASDF"
$Pref::Server::ClanSuffixOverride = "qwer"

package ClanTagsOverride
{

function GameConnection::autoAdminCheck(%this)
{
    
    %this.clanPrefix = $Pref::Server::ClanPrefixOverride;
    %this.clanSuffix = $Pref::Server::ClanSuffixOverride;
    return parent::autoAdminCheck(%this);
}
};
activatePackage(ClanTagsOverride);
« Last Edit: May 18, 2014, 10:51:37 PM by Ninjaman 4 »

Let's fix that code in case someone comes across this topic in the future.
$Pref::Server::ClanPrefixOverride = "ASDF";
$Pref::Server::ClanSuffixOverride = "qwer";

package ClanTagsOverride
{
    function GameConnection::AutoAdminCheck(%this)
    {
        %this.clanPrefix = $Pref::Server::ClanPrefixOverride;
        %this.clanSuffix = $Pref::Server::ClanSuffixOverride;
        return parent::AutoAdminCheck(%this);
    }
};
activatePackage(ClanTagsOverride);


Edit: Do you want it for everyone that joins, or like a special group of people to only have these clan tags?



//When the player joins, the can tags will be set to this
//NOTE: This is untested, and it changes the tags for everyone.
//Change the values to change what the tag becomes

$Pref::Server::ClanPrefixOverride = "ASDF"
$Pref::Server::ClanSuffixOverride = "qwer"

package ClanTags
{

function GameConnection::autoAdminCheck(%this)
{
    Parent::autoAdminCheck(%this);
    %this.clanPrefix = $Pref::Server::ClanPrefixOverride;
    %this.clanSuffix = $Pref::Server::ClanSuffixOverride;
}
};
activatePackage(ClanTags);
Always return the parent when packaging GameConnection::autoAdminCheck.

Always return the parent when packaging GameConnection::autoAdminCheck.
And don't forget ;

And don't forget ;
Oh yeah, didn't notice those.

Also, as Zeblote did, always use non-generic package names. "ClanTags" has probably been used in many add-ons.

Always return the parent when packaging GameConnection::autoAdminCheck.
Quick question - why do you need to do this? Is it just good practice, or will not returning the parent break the function?

Quick question - why do you need to do this? Is it just good practice, or will not returning the parent break the function?
The game code uses the return value of that function to determine if someone should be admin. If you break it, auto admin does not work.

Do you want it for everyone that joins, or like a special group of people


a group of friends.
  Only a group of friends. If you use my name as an example, im sure i could probably edit it to include my friend' names and tags too.

It wou-d be great if someone made the console commabd findclientbyname("hurr").clanprefix("hurrdurr") permanent, or create a command for it...
Yea, that would be great...

Quick question - why do you need to do this? Is it just good practice, or will not returning the parent break the function?
If you don't return it, auto admin will break.
It wou-d be great if someone made the console commabd findclientbyname("hurr").clanprefix("hurrdurr") permanent, or create a command for it...
Yea, that would be great...
clanPrefix is a variable, not a function

Example: Any time an AoKE member joins Sanctus' Server they automatically get AoKE clan tags in dark red. This is exactly what im trying to do.

If you've seen it, you know what i mean.

Just like owning a clan, and when a member joins your server, it gives them special "Member" clan tags.  An add-on like this is what i need

If you don't return it, auto admin will break.clanPrefix is a variable, not a function
If its a variable, can you use a function to change it? For certain names only?

You can expand the code to change it for specific names only:
Quote
$Pref::Server::ClanPrefixOverride = "<color:990808>AoKE";
$Pref::Server::ClanSuffixOverride = "";

package ClanTagsOverride
{
    function GameConnection::AutoAdminCheck(%this)
    {
        %name = %this.getPlayerName();

        if(%name $= "Blockhead100000"
        || %name $= "Blockhead102030"
        || %name $= "Blockhead116333"
        || %name $= "Blockhead100203")
        {
            %this.clanPrefix = $Pref::Server::ClanPrefixOverride;
            %this.clanSuffix = $Pref::Server::ClanSuffixOverride;
        }

        return parent::AutoAdminCheck(%this);
    }
};

activatePackage(ClanTagsOverride);

Of course when you reach a certain number of names that you want it to change the tags it might get a bit ugly like that, but if it's just for a few friends this is how I'd do it

You can expand the code to change it for specific names only:Of course when you reach a certain number of names that you want it to change the tags it might get a bit ugly like that, but if it's just for a few friends this is how I'd do it
  Thank you so much, its gonna be for a total of 16 people btw