GM && VIP tag

07/28/2013 06:17 pounder#1
in this release im going to share a simple code called [tag]. eg. when a player reach VIP LV 1-6 i prefer 5 gets a [VIP] tag in the left or right side of their name. whatever.

paste this in your entity.cs or character.cs
Code:
public void viptag(string oldName, string newName)
        {
            new Database.MySqlCommand(Database.MySqlCommandType.UPDATE).Update("entities").Set(oldName, newName).Where("UID", UID).Execute();
        }
paste this in your Program.cs this is for the GMs && PMs tag
Code:
#region PMtag
                            
                            if ((int)client.Account.State == 4)
                            {
                                if (!client.Entity.Name.Contains("[PM]"))
                                {
                                    if (!(client.Entity.Name.Length >= 15))
                                    {
                                        client.Entity.viptag("Name", "[PM]" + client.Entity.Name);
                                        client.Disconnect();
                                    }
                                    else
                                    {
                                        client.Entity.Name.Substring(0, 10);
                                        client.Entity.viptag("Name", "[PM]" + client.Entity.Name);
                                        client.Disconnect();
                                    }
								
                            }
							}
                            else
                            {
                                if (client.Entity.Name.Contains("[PM]"))
                                {
                                    string viptag = client.Entity.Name;
                                    viptag = viptag.Replace("[PM]", "");
                                    client.Entity.viptag("Name", viptag);
                                    client.Disconnect();
                                }
								
                            }
                            
                            #endregion PMtag
This is the VIP tag paste this in your program.cs
Code:
#region VIP
                            
                            if (client.Entity.VIPLevel > 4 && (int)client.Account.State != 4)
                            {
                                if (!client.Entity.Name.Contains("[VIP]"))
                                {
                                    if (!(client.Entity.Name.Length >= 15))
                                    {
                                        client.Entity.viptag("Name", "[VIP]" + client.Entity.Name);
                                        client.Disconnect();
                                    }
                                    else
                                    {
                                        client.Entity.Name.Substring(0, 10);
                                        client.Entity.viptag("Name", "[VIP]" + client.Entity.Name );
                                        client.Disconnect();
                                    }

                                }
								
							
                            }

                            else if ((int)client.Account.State == 4)
                            
							
							{
                                if (client.Entity.Name.Contains("[VIP]") && !client.Entity.Name.Contains("[PM]") && !(client.Entity.Name.Length >= 15))
                                {
                                    string viptag = client.Entity.Name;
                                    viptag = viptag.Replace("[VIP]", "");
                                    client.Entity.viptag("Name", viptag);
                                    client.Disconnect();
                                  
						}
						}
							else if (client.Entity.VIPLevel < 5)
							{
                                if (client.Entity.Name.Contains("[VIP]"))
                                {
                                    string viptag = client.Entity.Name;
                                    viptag = viptag.Replace("[VIP]", "");
                                    client.Entity.viptag("Name", viptag);
									client.Disconnect();
                                }
							
							}
							 
                            #endregion VIP

BTW if youre wondering why not just combine the codes together. answer is i tried combining it but i get alot of conflicts i dunno y. if you guys figured that out post it here so everyone will know especially me :awesome:

and one last thing the "oldName" && "newName" is the thing when you change your name in namechanger in the game.
07/30/2013 02:43 Mero.El.Omda#2
AHAHAHAH, copied from egy forum, try to make the code by your own don't copy paste again
07/30/2013 09:01 Super Aids#3
Wow some horrible codes.
07/30/2013 09:36 pounder#4
Quote:
Originally Posted by Mero.El.Omda View Post
AHAHAHAH, copied from egy forum, try to make the code by your own don't copy paste again
i didnt copy it.. sorry to disappoint you.

Quote:
Originally Posted by Super Aids View Post
Wow some horrible codes.
appreciated it. :D
07/31/2013 16:06 KraHen#5
why... how... I don`t even wanna know.
07/31/2013 16:20 nTL3fTy#6
Personally, I like the way we handled 'tags' in Albetros -- add new entries to the existing ini/title.ini file and use the title system.
03/27/2025 06:57 inyourdreams17#7
Can someone convert this to NewestCoServer for me please " #region VIP

if (client.Entity.VIPLevel > 4 && (int)client.Account.State != 4)
{
if (!client.Entity.Name.Contains("[VIP]"))
{
if (!(client.Entity.Name.Length >= 15))
{
client.Entity.viptag("Name", "[VIP]" + client.Entity.Name);
client.Disconnect();
}
else
{
client.Entity.Name.Substring(0, 10);
client.Entity.viptag("Name", "[VIP]" + client.Entity.Name );
client.Disconnect();
}

}


}

else if ((int)client.Account.State == 4)


{
if (client.Entity.Name.Contains("[VIP]") && !client.Entity.Name.Contains("[PM]") && !(client.Entity.Name.Length >= 15))
{
string viptag = client.Entity.Name;
viptag = viptag.Replace("[VIP]", "");
client.Entity.viptag("Name", viptag);
client.Disconnect();

}
}
else if (client.Entity.VIPLevel < 5)
{
if (client.Entity.Name.Contains("[VIP]"))
{
string viptag = client.Entity.Name;
viptag = viptag.Replace("[VIP]", "");
client.Entity.viptag("Name", viptag);
client.Disconnect();
}

}

#endregion VIP "
03/27/2025 07:45 Spirited#8
Quote:
Originally Posted by inyourdreams17 View Post
Can someone convert this to NewestCoServer for me please " #region VIP

if (client.Entity.VIPLevel > 4 && (int)client.Account.State != 4)
{
if (!client.Entity.Name.Contains("[VIP]"))
{
if (!(client.Entity.Name.Length >= 15))
{
client.Entity.viptag("Name", "[VIP]" + client.Entity.Name);
client.Disconnect();
}
else
{
client.Entity.Name.Substring(0, 10);
client.Entity.viptag("Name", "[VIP]" + client.Entity.Name );
client.Disconnect();
}

}


}

else if ((int)client.Account.State == 4)


{
if (client.Entity.Name.Contains("[VIP]") && !client.Entity.Name.Contains("[PM]") && !(client.Entity.Name.Length >= 15))
{
string viptag = client.Entity.Name;
viptag = viptag.Replace("[VIP]", "");
client.Entity.viptag("Name", viptag);
client.Disconnect();

}
}
else if (client.Entity.VIPLevel < 5)
{
if (client.Entity.Name.Contains("[VIP]"))
{
string viptag = client.Entity.Name;
viptag = viptag.Replace("[VIP]", "");
client.Entity.viptag("Name", viptag);
client.Disconnect();
}

}

#endregion VIP "
You should never copy / "convert" code without understanding what it does and what vulnerabilities it may introduce your server to.
03/30/2025 20:33 Arcо#9
The good ole days of checking for substrings instead of an account having permission level attributes. Simpler times.