SA-MP Forums Archive
A small glitch in this cmd - 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: A small glitch in this cmd (/showthread.php?tid=558671)



A small glitch in this cmd - Bondage - 18.01.2015

Got a problem regarding this command, this is use to view the total number of vip level 1 but this is just showing one single name, ain't showing further list of people who are vip level 1.

pawn Код:
CMD:viplevel1(playerid, params[])
{
    new query[80];
    new
        ID,
        output[800];
    mysql_format(mysql, query, sizeof(query), "SELECT user FROM players WHERE level = 1");
    new Cache:result = mysql_query(mysql, query);

    new rows, fields;
    cache_get_data(rows, fields, mysql);
    if(rows)
    {
        new
            username[24];
        ID ++;
        cache_get_field_content(0, "user",username, mysql, 24);

        format(output, sizeof(output), "%s"ccwhite"%d. %s\n", output, ID, username);
        ShowPlayerDialog(playerid, 212, DIALOG_STYLE_MSGBOX, "Level 1 Admins", output, "OK", "Cancel");}
    else {
        ShowPlayerDialog(playerid, 212, DIALOG_STYLE_MSGBOX, "Level 1 Admins", "No vip of this level.", "OK", "Cancel");}
    cache_delete(result);
    return 1;
}



Re: A small glitch in this cmd - Bondage - 19.01.2015

bump


Re: A small glitch in this cmd - CalvinC - 19.01.2015

You can make a loop to loop through all VIP players, and display each string for each VIP-player.


Re: A small glitch in this cmd - Bondage - 19.01.2015

Quote:
Originally Posted by CalvinC
Посмотреть сообщение
You can make a loop to loop through all VIP players, and display each string for each VIP-player.
There are no other way of listing all the vip level 1?


Re: A small glitch in this cmd - Bondage - 19.01.2015

bump


Re: A small glitch in this cmd - Matess - 19.01.2015

I am not sure if it is best idea but try:
PHP код:
CMD:viplevel1(playeridparams[])
{
    new 
query[80];
    new
        
ID,
        
output[800];
    
mysql_format(mysqlquerysizeof(query), "SELECT user FROM players WHERE level = 1");
    new 
Cache:result mysql_query(mysqlquery);
    new 
rowsfields;
    
cache_get_data(rowsfieldsmysql);
    while(
rows != 0)
    {
        new
            
username[24];
        
rows --;
        
cache_get_field_content(ID"user",usernamemysql24);
ID ++;
        
format(outputsizeof(output), "%s"ccwhite"%d. %s\n"outputIDusername);
        
ShowPlayerDialog(playerid212DIALOG_STYLE_MSGBOX"Level 1 Admins"output"OK""Cancel");}
    else {
        
ShowPlayerDialog(playerid212DIALOG_STYLE_MSGBOX"Level 1 Admins""No vip of this level.""OK""Cancel");}
    
cache_delete(result);
    return 
1;