Guys I need help with my vips
#1

Quote:
Originally Posted by donhu789
Посмотреть сообщение
pawn Код:
CMD:vips(playerid,params[])
{
    new Count = 0;
    new n[MAX_PLAYER_NAME];
    new string[2000];
    new VipDuty[1000];
//    SendClientMessage(playerid, 0x00FF00FF, "__________|Admins|__________");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        if(PlayerInfo[i][dRank] < 1) continue;
        GetPlayerName(i,n,sizeof(n));
        switch(PlayerInfo[i][OnDuty])
        {
                case 0: VipDuty = "Playing!";
                case 1: VipDuty = "OnDuty!";
        }
        format(string,sizeof(string),"Level: %d - %s(ID:%d) | %s | %s\n", PlayerInfo[i][dRank], PlayerName2(i), i, GetRankFromAdmin(i), VipDuty);
        Count++;
    }
    if(Count == 0)
    {
        ShowPlayerDialog(playerid, DIALOG_VIPS,DIALOG_STYLE_MSGBOX, "|__|YG Online VIPs List|__|", "No VIPs Online In The List \n VIPs Are Also watching From console And IRC.", "ok", "");
        return 1;
    }
    ShowPlayerDialog(playerid, DIALOG_VIPS,DIALOG_STYLE_MSGBOX, "|__|YG Online VIPs List|__|", string, "ok", "");
    return 1;
}
stock GetRankFromAdmin(playerid)
{
    new VipRank[900];
    switch(PlayerInfo[playerid][dRank])
    {
        case 0:
        {
            VipRank = "Regular Player";
        }
        case 1:
        {
            VipRank = "Silver";
        }
        case 2:
        {
            VipRank = "Gold";
        }
        case 3:
        {
            VipRank = "Premium";
        }
    }
    return VipRank;
}

guys help this is my Vip code is have a error let my explain:


First i set my self to level 3 is work fine
Second i set another level 3 Of Another Player but went i preass /vips is only show my

If That Not A Problem Please Fix my /setvip code


pawn Код:
CMD:setvip(playerid,params[]) {
if(PlayerInfo[playerid][Level] >= 10) {
        new tmp4[256], tmp3[256], Index; tmp4 = strtok(params,Index), tmp3 = strtok(params,Index);
        if(isnull(tmp4) || isnull(tmp3) || !IsNumeric2(tmp3)) return SendClientMessage(playerid, red, "USAGE: /setvip [playerid] [Level] | Note : Max Levels = 3 |");
        new player1 = strval(tmp4), skin = strval(tmp3), string[128];
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
            CMDMessageToAdmins(playerid,"Setvip");
            format(string, sizeof(string), "You have set \"%s's\" Vip Level to '%d", pName(player1), skin); SendClientMessage(playerid,blue,string);
            if(player1 != playerid) { format(string,sizeof(string),"Manager \"%s\" has set your Vip Level to '%d'", pName(playerid), skin); SendClientMessage(player1,blue,string); }
            return PlayerInfo[player1][dRank] = skin;
        } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
    } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}

I show you both code now please help REP REP REP

I want to fix this but i dont know what wrong please Help !!!!!!!!!!!!!!!
Reply
#2

pawn Код:
switch(PlayerInfo[i][OnDuty])
{
    case 0: VipDuty = "Playing!";
    case 1: VipDuty = "OnDuty!";
}
format(string,sizeof(string),"Level: %d - %s(ID:%d) | %s | %s\n", PlayerInfo[i][dRank], PlayerName2(i), i, GetRankFromAdmin(i), VipDuty);
Also you can change VipDuty[1000] to VipDuty[60]
pawn Код:
switch(PlayerInfo[i][OnDuty])
{
    case 0: format(VipDuty, sizeof(VipDuty), "Level: %d - %s(ID:%d) | %s | Playing\n", PlayerInfo[i][dRank], PlayerName2(i), i, GetRankFromAdmin(i));
    case 1: format(VipDuty, sizeof(VipDuty), "Level: %d - %s(ID:%d) | %s | OnDuty\n", PlayerInfo[i][dRank], PlayerName2(i), i, GetRankFromAdmin(i));
}
strcat(string, VipDuty);
Your using format with string, but as another admin is found it re-formats the string and then erases what you had before. What I have done is used strcat to attach the new string your formatting with VipDuty and adding it to string.

More info on strcat: https://sampwiki.blast.hk/wiki/Strcat
Reply
#3

Or just change

pawn Код:
format(string,sizeof(string),"Level: %d - %s(ID:%d) | %s | %s\n", PlayerInfo[i][dRank], PlayerName2(i), i, GetRankFromAdmin(i), VipDuty);
to

pawn Код:
format(string,sizeof(string),"%sLevel: %d - %s(ID:%d) | %s | %s\n", string, PlayerInfo[i][dRank], PlayerName2(i), i, GetRankFromAdmin(i), VipDuty);
and next time don't post 2 threads for the same exact thing.
Reply
#4

SuperViper (y)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)