/viplist - is there any thing wrong?
#4

Yes there is:
  • Consider my vip level is 4 then

    Код:
    if(PlayerInfo[i][pVIP] >= 1) 
        { 
        format(string, sizeof(string),"- {ffff00}%s{00ff00}| {0066ff}(ID:%s) {00ff00}| {996600}Bronze V.I.P\n", GetName(i), i); 
        count++; 
        } 
        if(PlayerInfo[i][pVIP] >= 2) 
        { 
        format(string, sizeof(string),"- {ffff00}%s {00ff00}| {0066ff}(ID:%d) {00ff00}| {adad85}Silver V.I.P\n", GetName(i), i); 
        count++; 
        } 
        if(PlayerInfo[i][pVIP] >= 3) 
        { 
        format(string, sizeof(string),"- {ffff00}%s {00ff00}| {0066ff}(ID:%d) {00ff00}| {e68a00}GOLD V.I.P\n", GetName(i), i); 
        count++; 
        }
    The all that if condition is true for me you can use else ifs in this case or use switch to check values of variable PlayerInfo[i][pVIP] rather putting ranges (cause that better in this case i believe).

  • Next thing is use of general looping mechanism use foreach with Player iterator instead.

  • Код:
    if(IsPlayerConnected(i)) 
        { 
        if(PlayerInfo[i][pVIP] >= 1) 
        { 
        format(string, sizeof(string),"- {ffff00}%s{00ff00}| {0066ff}(ID:%s) {00ff00}| {996600}Bronze V.I.P\n", GetName(i), i); 
        count++; 
        } 
        if(PlayerInfo[i][pVIP] >= 2) 
        { 
        format(string, sizeof(string),"- {ffff00}%s {00ff00}| {0066ff}(ID:%d) {00ff00}| {adad85}Silver V.I.P\n", GetName(i), i); 
        count++; 
        } 
        if(PlayerInfo[i][pVIP] >= 3) 
        { 
        format(string, sizeof(string),"- {ffff00}%s {00ff00}| {0066ff}(ID:%d) {00ff00}| {e68a00}GOLD V.I.P\n", GetName(i), i); 
        count++; 
        }
    That will reset the string variable use strcat to concatenate strings

  • Код:
    if(count == 0) 
        { 
        ShowPlayerDialog(playerid, 18, DIALOG_STYLE_MSGBOX,"{00ff00}Online V.I.P(s):",string, "Ok", ""); 
        } 
        else 
        { 
        ShowPlayerDialog(playerid, 18, DIALOG_STYLE_MSGBOX,"{00ff00}Online V.I.P(s):","There isn't any online V.I.P", "Ok", ""); 
        }
    You mismatched conditions.
Reply


Messages In This Thread
/viplist - is there any thing wrong? - by RyderX - 06.02.2017, 10:47
Re: /viplist - is there any thing wrong? - by AndreiWow - 06.02.2017, 10:55
Re: /viplist - is there any thing wrong? - by RyderX - 06.02.2017, 10:56
Re: /viplist - is there any thing wrong? - by SyS - 06.02.2017, 10:59
Re: /viplist - is there any thing wrong? - by iLearner - 06.02.2017, 11:00
Re: /viplist - is there any thing wrong? - by Logic_ - 06.02.2017, 11:23
Re: /viplist - is there any thing wrong? - by RyderX - 06.02.2017, 11:37

Forum Jump:


Users browsing this thread: 2 Guest(s)