SA-MP Forums Archive
/viplist - is there any thing wrong? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /viplist - is there any thing wrong? (/showthread.php?tid=628125)



/viplist - is there any thing wrong? - RyderX - 06.02.2017

PHP код:
CMD:viplist(playeridparams[])
{
    new 
count 0string[128];
    for(new 
0MAX_PLAYERS++)
    {
    if(
IsPlayerConnected(i))
    {
    if(
PlayerInfo[i][pVIP] >= 1)
    {
    
format(stringsizeof(string),"- {ffff00}%s{00ff00}| {0066ff}(ID:%s) {00ff00}| {996600}Bronze V.I.P\n"GetName(i), i);
    
count++;
    }
    if(
PlayerInfo[i][pVIP] >= 2)
    {
    
format(stringsizeof(string),"- {ffff00}%s {00ff00}| {0066ff}(ID:%d) {00ff00}| {adad85}Silver V.I.P\n"GetName(i), i);
    
count++;
    }
    if(
PlayerInfo[i][pVIP] >= 3)
    {
    
format(stringsizeof(string),"- {ffff00}%s {00ff00}| {0066ff}(ID:%d) {00ff00}| {e68a00}GOLD V.I.P\n"GetName(i), i);
    
count++;
    }
    }
    }
    if(
count == 0)
    {
    
ShowPlayerDialog(playerid18DIALOG_STYLE_MSGBOX,"{00ff00}Online V.I.P(s):",string"Ok""");
    }
    else
    {
    
ShowPlayerDialog(playerid18DIALOG_STYLE_MSGBOX,"{00ff00}Online V.I.P(s):","There isn't any online V.I.P""Ok""");
    }
    return 
1;

is there any error anything something not normal with this code? if so hope you correct it for me


Re: /viplist - is there any thing wrong? - AndreiWow - 06.02.2017

Why didn't you compile it? The compiler would have told you.. anyway, I don't see anything wrong.


Re: /viplist - is there any thing wrong? - RyderX - 06.02.2017

Yes, that's the point i have compiled it, no errors no warnings allthings is clean...

but when i types it it show

There isn't any online vip... while there are..


Re: /viplist - is there any thing wrong? - SyS - 06.02.2017

Yes there is:


Re: /viplist - is there any thing wrong? - iLearner - 06.02.2017

PHP код:
if(count == 0
    { 
    
ShowPlayerDialog(playerid18DIALOG_STYLE_MSGBOX,"{00ff00}Online V.I.P(s):",string"Ok"""); 
    } 
    else 
    { 
    
ShowPlayerDialog(playerid18DIALOG_STYLE_MSGBOX,"{00ff00}Online V.I.P(s):","There isn't any online V.I.P""Ok"""); 
    } 



Re: /viplist - is there any thing wrong? - Logic_ - 06.02.2017

PHP код:
#if defined Loop
    #undef Loop(%1)
#endif
#define Loop(%1) for(new %1 = GetPlayerPoolSize(); %1 != -1; %1 --) if(IsPlayerConnected(%1))
CMD:viplist(playerid)
{
    new 
count;
    
Loop(i)
    {
        if(
PlayerInfo[i][pVIP])
        {
            
format(stringsizeof string"- {ffff00}%s{00ff00}| {0066ff}(ID:%s) {00ff00}| %x %s\n"GetName(i), iGetVipColor(i), GetVipLevel(i));
            
strcat(stringstringsizeof string);
            
count += 1;
        }
    }
    if(!
count) return ShowPlayerDialog(playerid18DIALOG_STYLE_MSGBOX"{00ff00}Online VIPs:","There isn't any online V.I.P""Ok""");
    else return 
ShowPlayerDialog(playerid18DIALOG_STYLE_MSGBOX"{00ff00}Online VIPs:",string"Okay""");
}
GetVipLevel(playerid)
{
    new 
str[10];
    switch(
PlayerInfo[playerid][pVIP])
    {
        case 
0str "None";
        case 
1str "Bronze";
        case 
2str "Silver";
        case 
3str "Gold";
    }
    return 
str;
}
GetVipColor(playerid)
{
    new 
str[10];
    switch(
PlayerInfo[playerid][pVIP])
    {
        case 
1str "{996600}";
        case 
2str "{adad85}";
        case 
3str "{e68a00}";
    }
    return 
str;




Re: /viplist - is there any thing wrong? - RyderX - 06.02.2017

Fixed.

Thanks for you support