Help: vip command!
#1

Hello!

I need a little help with my /vcoloroff command...So I already have a /vcoloron which enable a Vip Color..But now I need to know, how to make that when a Vip player do /vcoloroff, then he will have the same color as he had beffore he did a /vcoloron...

Code for /vcoloron:

PHP код:
CMD:vcoloron(playeridparams[])
{
    for(new 
0MAX_PLAYERS++)
    {
    if(
gPlayerInfo[playerid][PLAYER_VIP] < 1)return SendClientMessage(playeridCOLOR_RED"You are Not Allowed To Use This Command!");
    if(
gPlayerInfo[i][PLAYER_VIP] == 1)return SetPlayerColor(playeridCOLOR_BRONZE);
    if(
gPlayerInfo[i][PLAYER_VIP] == 2)return SetPlayerColor(playeridCOLOR_SILVER);
    if(
gPlayerInfo[i][PLAYER_VIP] == 3)return SetPlayerColor(playeridCOLOR_GOLD);
    
SendClientMessage(playeridCOLOR_LIGHTBLUE"[VIP]: You Have Enabled a Vip Color!");
    }
      return 
1;

Thanks for your help
Reply
#2

Use this command GetPlayerColor(playerid), to be trigered when a player enables his vip color. Save the value to a global [MAX_PLAYERS] variable and use it to load color when disabling vip color
Reply
#3

Quote:
Originally Posted by HurtLocker
Посмотреть сообщение
Use this command GetPlayerColor(playerid, "color"), to be trigered when a player enables his vip color. Save the value to a global [MAX_PLAYERS] variable and use it to load color when disabling vip color
Can you show me in a code please?
Reply
#4

I am not sure how and why you use those loops. You want to be only you that will set all vips' colors? Anyway this is what it is with loop. If it doesnt work, tell me to make the commands personal.
pawn Код:
new SavedColor[MAX_PLAYERS];

CMD:vcoloron(playerid, params[])
{
    for(new i = 0; i < MAX_PLAYERS; i ++)
    {
        if(gPlayerInfo[i][PLAYER_VIP] < 1)return SendClientMessage(i, COLOR_RED, "You are Not Allowed To Use This Command!");
        if(gPlayerInfo[i][PLAYER_VIP] == 1)
        {
            SavedColor[i]=GetPlayerColor(i);
            SetPlayerColor(i, COLOR_BRONZE);
        }
        else if(gPlayerInfo[i][PLAYER_VIP] == 2)
        {
            SavedColor[i]=GetPlayerColor(i);
            SetPlayerColor(i, COLOR_SILVER);
        }
        else
        {
            SavedColor[i]=GetPlayerColor(i);
            SetPlayerColor(i, COLOR_GOLD);
        }
        SendClientMessage(i, COLOR_LIGHTBLUE, "[VIP]: You Have Enabled a Vip Color!");
    }
    return 1;
}



CMD:vcoloroff(playerid, params[])
{
    for(new i = 0; i < MAX_PLAYERS; i ++)
    {
        SetPlayerColor(i, SavedColor[i]);
    }
    return 1;
}
Reply
#5

Quote:
Originally Posted by HurtLocker
Посмотреть сообщение
I am not sure how and why you use that loops. You want to be only you that will set all vips' colors? Anyway this is what it is with loop. If it doesnt work, tell me to make the commands personal.
pawn Код:
new SavedColor[MAX_PLAYERS];

CMD:vcoloron(playerid, params[])
{
    for(new i = 0; i < MAX_PLAYERS; i ++)
    {
        if(gPlayerInfo[i][PLAYER_VIP] < 1)return SendClientMessage(i, COLOR_RED, "You are Not Allowed To Use This Command!");
        if(gPlayerInfo[i][PLAYER_VIP] == 1)
        {
            SavedColor[i]=GetPlayerColor(i);
            SetPlayerColor(i, COLOR_BRONZE);
        }
        else if(gPlayerInfo[i][PLAYER_VIP] == 2)
        {
            SavedColor[i]=GetPlayerColor(i);
            SetPlayerColor(i, COLOR_SILVER);
        }
        else
        {
            SavedColor[i]=GetPlayerColor(i);
            SetPlayerColor(i, COLOR_GOLD);
        }
        SendClientMessage(i, COLOR_LIGHTBLUE, "[VIP]: You Have Enabled a Vip Color!");
    }
    return 1;
}



CMD:vcoloroff(playerid, params[])
{
    for(new i = 0; i < MAX_PLAYERS; i ++)
    {
        SetPlayerColor(i, SavedColor[i]);
    }
    return 1;
}
Thanks, let me try..
Reply
#6

Well, I am sure those loops are useless and wrong. This is the fresh, cool and correct new supply:
pawn Код:
new SavedColor[MAX_PLAYERS];

CMD:vcoloron(playerid, params[])
{
    if(gPlayerInfo[playerid][PLAYER_VIP] < 1)return SendClientMessage(playerid, COLOR_RED, "You are Not Allowed To Use This Command!");
    if(gPlayerInfo[playerid][PLAYER_VIP] == 1)
    {
    SavedColor[playerid]=GetPlayerColor(playerid);
    SetPlayerColor(playerid, COLOR_BRONZE);
    }
    else if(gPlayerInfo[playerid][PLAYER_VIP] == 2)
    {
    SavedColor[playerid]=GetPlayerColor(playerid);
    SetPlayerColor(playerid, COLOR_SILVER);
    }
    else
    {
    SavedColor[playerid]=GetPlayerColor(playerid);
    SetPlayerColor(playerid, COLOR_GOLD);
    }
    SendClientMessage(playerid, COLOR_LIGHTBLUE, "[VIP]: You Have Enabled a Vip Color!");
    return 1;
}



CMD:vcoloroff(playerid, params[])
{
    if(gPlayerInfo[playerid][PLAYER_VIP] >= 1)
    {
    SetPlayerColor(playerid, SavedColor[playerid]);
    }
    else return SendClientMessage(playerid, COLOR_RED, "You are Not Allowed To Use This Command!");
    return 1;
}
Reply
#7

Quote:
Originally Posted by HurtLocker
Посмотреть сообщение
Well, I am sure those loops are useless and wrong. This is the fresh, cool and correct new supply:
pawn Код:
new SavedColor[MAX_PLAYERS];

CMD:vcoloron(playerid, params[])
{
    if(gPlayerInfo[playerid][PLAYER_VIP] < 1)return SendClientMessage(playerid, COLOR_RED, "You are Not Allowed To Use This Command!");
    if(gPlayerInfo[playerid][PLAYER_VIP] == 1)
    {
    SavedColor[playerid]=GetPlayerColor(playerid);
    SetPlayerColor(playerid, COLOR_BRONZE);
    }
    else if(gPlayerInfo[playerid][PLAYER_VIP] == 2)
    {
    SavedColor[playerid]=GetPlayerColor(playerid);
    SetPlayerColor(playerid, COLOR_SILVER);
    }
    else
    {
    SavedColor[playerid]=GetPlayerColor(playerid);
    SetPlayerColor(playerid, COLOR_GOLD);
    }
    SendClientMessage(playerid, COLOR_LIGHTBLUE, "[VIP]: You Have Enabled a Vip Color!");
    return 1;
}



CMD:vcoloroff(playerid, params[])
{
    if(gPlayerInfo[playerid][PLAYER_VIP] >= 1)
    {
    SetPlayerColor(playerid, SavedColor[playerid]);
    }
    else return SendClientMessage(playerid, COLOR_RED, "You are Not Allowed To Use This Command!");
    return 1;
}
When I type /vcoloroff it should be Orange color, but it's black...Anyway, thank you.
Reply
#8

oh, then just experiment this yourself, play with pawno
Reply
#9

#define COLOR_ORANGE 0xFF9900AA

CMD:vcoloroff(playerid, params[])
{
if(gPlayerInfo[playerid][PLAYER_VIP] >= 1)
{
SetPlayerColor(playerid, COLOR_ORANGE, SavedColor[playerid]);
}
else return SendClientMessage(playerid, COLOR_RED, "You are Not Allowed To Use This Command!");
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)