Colored Names
#1

Say someone with VIP logs in, instead of doing something like /togvip /togvip for the script to change his name to yellow, is there a way to make it like, if someone logs in it detects they are vip and their color changes? If so this is what I want it as:

Код:
if(Player[playerid][VipRank] >= 1) ((White))
if(Player[playerid][VipRank] >= 2) ((Grey))
if(Player[playerid][VipRank] >= 3) ((Yellow))
Also, is there a way to change the name of the vip levels? Like for now you can do /changeviplevel [id] [level]
Can it be set to bronze, silver & gold?, just the 3 levels? I'm using vortex roleplay incase you needed to know.
-Thanks in advance.
Reply
#2

You can do that check in the login command. For the ((White)) and such you can use SetPlayerColor(playerid, 0xFFFFFFAA); (grey is 777777AA and yellow is FFFF00 iirc, not sure)

You can set the name to a value. The rest of the script would stay unchanged but you can change the way it gets and sets the value. E.g. taking a string in /changeviplevel and then setting the string to an int and changing that int to a string when the player requests the level.
Reply
#3

pawn Код:
if(Player[playerid][VipRank] >= 1)
{
SetPlayerColor(playerid,0xFFFFFFFF); //White
}
else if(Player[playerid][VipRank] >= 2)
{
SetPlayerColor(playerid, 0xFFFFFFAA);//grey
}
else if(Player[playerid][VipRank] >= 3)
{
SetPlayerColor(playerid,0xFFFF00AA); //yellow
}
hope that helps
Reply
#4

Quote:
Originally Posted by XtremeR
Посмотреть сообщение
pawn Код:
if(Player[playerid][VipRank] >= 1)
{
SetPlayerColor(playerid,0xFFFFFFFF); //White
}
else if(Player[playerid][VipRank] >= 2)
{
SetPlayerColor(playerid, 0xFFFFFFAA);//grey
}
else if(Player[playerid][VipRank] >= 3)
{
SetPlayerColor(playerid,0xFFFF00AA); //yellow
}
hope that helps
If I add that to... playerconnect, spawn etc. It will do it each time right?
Reply
#5

yes that will work everytime for VIP u can also do like
pawn Код:
if(Player[playerid][VipRank] >= 0) //level 0
{
SetPlayerColor(playerid,colorhere);
}
Reply
#6

Quote:
Originally Posted by XtremeR
Посмотреть сообщение
yes that will work everytime for VIP u can also do like
pawn Код:
if(Player[playerid][VipRank] >= 0) //level 0
{
SetPlayerColor(playerid,colorhere);
}
Sweet, thanks man +1
Reply
#7

Quote:
Originally Posted by XtremeR
Посмотреть сообщение
pawn Код:
if(Player[playerid][VipRank] >= 1)
{
SetPlayerColor(playerid,0xFFFFFFFF); //White
}
else if(Player[playerid][VipRank] >= 2)
{
SetPlayerColor(playerid, 0xFFFFFFAA);//grey
}
else if(Player[playerid][VipRank] >= 3)
{
SetPlayerColor(playerid,0xFFFF00AA); //yellow
}
hope that helps
Please note that this grey is not grey but has just the white colour with the opacity changed. Change to 777777, 666666 or CCCCCC or something near that. A0A0A0 is cool too.
Reply
#8

Quote:
Originally Posted by mamorunl
Посмотреть сообщение
You can do that check in the login command. For the ((White)) and such you can use SetPlayerColor(playerid, 0xFFFFFFAA); (grey is 777777AA and yellow is FFFF00 iirc, not sure)

You can set the name to a value. The rest of the script would stay unchanged but you can change the way it gets and sets the value. E.g. taking a string in /changeviplevel and then setting the string to an int and changing that int to a string when the player requests the level.
And how the hell would I do that? Ahaha.
Reply
#9

At the moment (I assume you are talking about the second paragraph) you use an integer. You can do it simply and map that integer to a string (or actually just the other way around):
pawn Код:
CMD:bla(playerid, params[]) {
  sscanf(params, "is[128]", id, rank);
  if(!strcmp(rank, "Bronze")) {
    // Set the rank to int 0
  } // do the same for silver and gold
  else {
    // Not bronze, not silver, not gold so false.. deliver an error
  }
}
In your showing command you can then use it like this:
pawn Код:
CMD:getvip(playerid, params[]) {
 switch(vipid) {
  case 0: // no lvl
  case 1: SendClientMessage(playerid, 0xFFFFFF00, "Bronze");
  case 2: SCM("silver"); // shortened above
  case 3: SCM("Gold");
  default: "Error"
 }
}
And the rest can stay the same
Reply
#10

Quote:
Originally Posted by mamorunl
Посмотреть сообщение
At the moment (I assume you are talking about the second paragraph) you use an integer. You can do it simply and map that integer to a string (or actually just the other way around):
pawn Код:
CMD:bla(playerid, params[]) {
  sscanf(params, "is[128]", id, rank);
  if(!strcmp(rank, "Bronze")) {
    // Set the rank to int 0
  } // do the same for silver and gold
  else {
    // Not bronze, not silver, not gold so false.. deliver an error
  }
}
In your showing command you can then use it like this:
pawn Код:
CMD:getvip(playerid, params[]) {
 switch(vipid) {
  case 0: // no lvl
  case 1: SendClientMessage(playerid, 0xFFFFFF00, "Bronze");
  case 2: SCM("silver"); // shortened above
  case 3: SCM("Gold");
  default: "Error"
 }
}
And the rest can stay the same
Umm, I just want to do /changeviplevel [id] [gold/silver/bronze]
So when a player does /stats it shows VIP: Gold.

This is the current /changeviplevel command:
pawn Код:
command(changeviplevel, playerid, params[])
{
    new level, id, string[128];
    if(sscanf(params, "ud", id, level))
    {
        if(Player[playerid][AdminLevel] >= 1)
        {
            SendClientMessage(playerid, WHITE, "SYNTAX: /changeviplevel [playerid] [level]");
        }
    }
    else
    {
        if(Player[playerid][AdminLevel] >= 5)
        {
            if(IsPlayerConnectedEx(id))
            {
                Player[id][VipRank] = level;

                format(string, sizeof(string), "%s's VIP level has been changed to %d, by %s.", GetName(id), level, GetName(playerid));
                for(new i = 0; i < MAX_PLAYERS; i++)
                {
                    if(IsPlayerConnectedEx(i) && Player[i][VipRank] >= 1)
                    {
                        SendClientMessage(i, YELLOW, string);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, WHITE, "That player is not connected or isn't logged in.");
            }
        }
    }
    return 1;
}
And in stats:
pawn Код:
format(string, sizeof(string), "Name: %s | Admin Level: %d | Last IP: %s | Last Login: %d/%d/%d | Time: %d:%d | Status: Unbanned.", Name, dini_Int(string2, "AdminLevel"), dini_Get(string2, "LastIP"), dini_Int(string2, "LastLoginDay"), dini_Int(string2, "LastLoginMonth"), dini_Int(string2, "LastLoginYear"), dini_Int(string2, "LastLoginHour"), dini_Int(string2, "LastLoginMinute"));
                                    SendClientMessage(playerid, GREY, string);
                                    format(string, sizeof(string), "Geographical Location: %s | Playing Hours: %d | Materials: %d | House: %d | Business: %d", GetIPCountry(dini_Get(string2, "LastIP")) , dini_Int(string2, "PlayingHours"),  dini_Int(string2, "Materials"), dini_Int(string2, "House"), dini_Int(string2, "Business"));
                                    SendClientMessage(playerid, GREY, string);
                                    format(string, sizeof(string), "Cocaine: %d grams | Pot: %d grams | Group: %d (%s)", dini_Int(string2, "Crack"), dini_Int(string2, "Pot"), dini_Int(string2, "Group"), Groups[dini_Int(string2, "Group")][GroupName]);
                                    SendClientMessage(playerid, GREY, string);
How would I be able to show the vip level in with those lines.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)