SA-MP Forums Archive
List Command Help (+Rep) - 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: List Command Help (+Rep) (/showthread.php?tid=324044)



List Command Help (+Rep) - _DownLoaD_ - 07.03.2012

I have problem in my VipList Command:
pawn Код:
if(strcmp(cmdtext,"/VipList",true) == 0)
{
    printf("[INFO]: \"%s\" Typed /VipList",GetName(playerid));
    if(IsPlayerConnected(playerid))
{
    new count = 0;
    for(new i=0; i < MAX_PLAYERS; i++)
{
    if(IsPlayerConnected(i))
{
    if(IsPViP(i))
{
    SendClientMessage(playerid,COLOR_WHITE,"--- ViP ---");
    format(string,sizeof(string),"%d) \"%s\" [id: %d | ViP Level: %d]",i,GetName(i),i,GetVipLevel(i));
    SendClientMessage(playerid,COLOR_YELLOW,string);
    count++;
    SendClientMessage(playerid,COLOR_WHITE,"--- ViP  ---");
}}}
    if(count == 0) return SendClientMessage(playerid,COLOR_RED,"! no VIP");
}
return 1;
}
if there is more than 2 players its show:

--- Vip ----
---- Vip ----
2)DownLoaD
---- vip -----
4)SingelOut
---- vip -----


Re: List Command Help (+Rep) - SnG.Scot_MisCuDI - 07.03.2012

Whats the problem?


Re: List Command Help (+Rep) - _DownLoaD_ - 07.03.2012

if there is more than 2 players its show:

--- Vip ----
---- Vip ----
2)DownLoaD
---- vip -----
4)SingelOut
---- vip ----


Re: List Command Help (+Rep) - Mike_Peterson - 07.03.2012

err

pawn Код:
if(strcmp(cmdtext,"/VipList",true) == 0)
{
    printf("[INFO]: \"%s\" Typed /VipList",GetName(playerid));
    if(IsPlayerConnected(playerid))
{
    new count = 0;
    SendClientMessage(playerid,COLOR_WHITE,"--- ViP ---");
    for(new i=0; i < MAX_PLAYERS; i++)
{
    if(IsPlayerConnected(i))
{
    if(IsPViP(i))
{
    SendClientMessage(playerid,COLOR_WHITE,"--- ViP ---");
    format(string,sizeof(string),"%d) \"%s\" [id: %d | ViP Level: %d]",i,GetName(i),i,GetVipLevel(i));
    SendClientMessage(playerid,COLOR_YELLOW,string);
    count++;
}
}
}
    SendClientMessage(playerid,COLOR_WHITE,"--- ViP  ---");
    if(count == 0) return SendClientMessage(playerid,COLOR_RED,"! no VIP");
}
return 1;
}



Re: List Command Help (+Rep) - _DownLoaD_ - 08.03.2012

Still not.
its show:
--- VIP ---
--- VIP ---
DownLoaD
--- VIP ---
SingelOut
--- VIP ---


Re: List Command Help (+Rep) - _DownLoaD_ - 08.03.2012

Its fixed half of the command
when there is more than 2 Vip's online its works fine.
but if there is no online VIP its show:
--- vip ---
--- vip ---
no VIPS !

here's the command:

pawn Код:
if(strcmp(cmdtext,"/VipList",true) == 0)
{
    printf("[INFO]: \"%s\" Typed /VipList",GetName(playerid));
    if(IsPlayerConnected(playerid))
    {
        new count = 0;
        SendClientMessage(playerid,COLOR_WHITE,"--- ViP ---");
        for(new i=0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(IsPViP(i))
                {
                    format(string,sizeof(string),"%d) \"%s\" [id: %d | ViP Level: %d]",i,GetName(i),i,GetVipLevel(i));
                    SendClientMessage(playerid,COLOR_YELLOW,string);
                    count++;
                }
            }
        }
    SendClientMessage(playerid,COLOR_WHITE,"--- ViP  ---");
    if(count == 0) return SendClientMessage(playerid,COLOR_RED,"! no VIP");
    }
return 1;
}



Re: List Command Help (+Rep) - Shabi RoxX - 08.03.2012

Try This:
pawn Код:
if(strcmp(cmdtext,"/VipList",true) == 0)
    {
        printf("[INFO]: \"%s\" Typed /VipList",GetName(playerid));
        if(IsPlayerConnected(playerid))
        {
            new count = 0;
            SendClientMessage(playerid,COLOR_WHITE,"--- ViP ---");
            for(new i=0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(IsPViP(i))
                    {
                        format(string,sizeof(string),"%d) \"%s\" [id: %d | ViP Level: %d]",i,GetName(i),i,GetVipLevel(i));
                        SendClientMessage(playerid,COLOR_YELLOW,string);
                        count++;
                    }
                }
            }
            if(count == 0) return SendClientMessage(playerid,COLOR_RED,"! no VIP");
        }
        return 1;
    }



Re: List Command Help (+Rep) - _DownLoaD_ - 08.03.2012

but i want it to show:
-- vips ---
players..
--- vips ---


Re: List Command Help (+Rep) - Shabi RoxX - 08.03.2012

Here you go:
pawn Код:
if(strcmp(cmdtext,"/VipList",true) == 0)
    {
        printf("[INFO]: \"%s\" Typed /VipList",GetName(playerid));
        if(IsPlayerConnected(playerid))
        {
            new count = 0;
            SendClientMessage(playerid,COLOR_WHITE,"--- ViP ---");
            for(new i=0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(IsPViP(i))
                    {
                        format(string,sizeof(string),"%d) \"%s\" [id: %d | ViP Level: %d]",i,GetName(i),i,GetVipLevel(i));
                        SendClientMessage(playerid,COLOR_YELLOW,string);
                        count++;
                    }
                }
            }
            if(count == 0) return SendClientMessage(playerid,COLOR_RED,"! no VIP");
           SendClientMessage(playerid,COLOR_WHITE,"--- ViP ---");
        }
        return 1;
    }
Now Out put will be :
Код:
-- vips ---
 players..
 --- vips ---
AND ifcount =0;

Код:
-- vips ---
 no vip
 --- vips ---



Re: List Command Help (+Rep) - _DownLoaD_ - 08.03.2012

i want it to show,
out put will show:
- VIPS -
player.
- VIPS -
and if Count = 0
no online VIPS.