Jump to content
  • 0

Problema /leaders Pe Dialog.


HuZuM

Question

Problemă întâlnită (descriere): Am incercat sa pun comanda /leaders pe dialog dar nu stiu de ce imi apare doar ultima factiune pe dialog

Ero(area / rile) / warning-(ul / urile): Asa imi apare: http://i.imgur.com/WjN66pd.png 

Liniile de cod / sursa / script-ul:

CMD:leaders(playerid, params[])

{

for(new xf = 0; xf <= MAX_GROUPS; xf++)

{

if(strlen(groupVariables[xf][gGroupName]) >= 1 && strcmp(groupVariables[xf][gGroupName], "None", true))

{

new query[256];

format(query, 256, "SELECT * FROM `playeraccounts` WHERE `playerGroup` = '%d' AND `playerGroupRank` = '7'", xf);

mysql_query(query); 

new lead[MAX_PLAYER_NAME];

format(lead, MAX_PLAYER_NAME, "None");

mysql_store_result();

if(mysql_retrieve_row())

{

mysql_fetch_field_row(query, "playerName");

format(lead, MAX_PLAYER_NAME, "%s", query);

}

new on;

if(strcmp(lead, "None", true))

{

new on2;

on2 = GetPlayerID(lead);

if(IsPlayerConnected(on2))

{

on = 1;

}

else on = 0;

}

mysql_free_result();

new memb;

foreach(Player, xf)

{

if(playerVariables[playerid][pGroup] == xf)

{

memb++;

}

}

format(query, sizeof(query), "SELECT * FROM `playeraccounts` WHERE `playerGroup` = '%d'", xf);

mysql_query(query);

mysql_store_result();

new membs;

membs = mysql_num_rows();

mysql_free_result();

new string[256];

string[ 0 ] = EOS ;

if(on == 1)

{

format(string, sizeof(string), "%s - Leader: %s (online) - Members online: %d - Total members: %dn", groupVariables[xf][gGroupName], membs, memb);

}

else

{

format(string, sizeof(string), "%s - Leader: %s (offline) - Members online: %d - Total members: %dn", groupVariables[xf][gGroupName], membs, memb);

}

ShowPlayerDialog(playerid, 64, DIALOG_STYLE_LIST, "Leaders", string, "Close" , "Ok");

}

}

   return 1;

}

Imagini / Video (optional): Mai sus.

Aţi încercat să rezolvaţi singur?: Da

 

PS: Ma scuzati, nu am fost atent cand am gresit sectiunea unde sa postez.

 

 

 

Edited by HuZuM
Link to comment
Share on other sites

5 answers to this question

Recommended Posts

CMD:leaders(playerid, params[])
{
    for(new xf = 0; xf <= MAX_GROUPS; xf++)
    {
        if(strlen(groupVariables[xf][gGroupName]) >= 1 && strcmp(groupVariables[xf][gGroupName], "None", true))
                {
                        new query[256];
                        format(query, 256, "SELECT * FROM `playeraccounts` WHERE `playerGroup` = '%d' AND `playerGroupRank` = '7'", xf);
                        mysql_query(query); 
                        new lead[MAX_PLAYER_NAME];
                        format(lead, MAX_PLAYER_NAME, "None");
                        mysql_store_result();
                        if(mysql_retrieve_row())
                        {
                                mysql_fetch_field_row(query, "playerName");
                                format(lead, MAX_PLAYER_NAME, "%s", query);
                        }
                        new on;
                        if(strcmp(lead, "None", true) != 0)
                        {
                                new on2;
                                on2 = GetPlayerID(lead);
                                if(IsPlayerConnected(on2))
                                {
                                        on = 1;
                                }
                                else on = 0;
                        }
                        mysql_free_result();
                        new memb;
                        foreach(Player, xf)
                        {
                                if(playerVariables[playerid][pGroup] == xf)
                                {
                                        memb++;
                                }
                        }
                        format(query, sizeof(query), "SELECT * FROM `playeraccounts` WHERE `playerGroup` = '%d'", xf);
                        mysql_query(query);
                        mysql_store_result();
                        new membs;
                        membs = mysql_num_rows();
                        mysql_free_result();
                        new string[256];
                        string[ 0 ] = EOS ;
                        if(on == 1)
                        {

                                format(string, sizeof(string), "%s - Leader: %s (online) - Members online: %d - Total members: %dn", groupVariables[xf][gGroupName], membs, memb);
                        }
                        else
                        {
                                format(string, sizeof(string), "%s - Leader: %s (offline) - Members online: %d - Total members: %dn", groupVariables[xf][gGroupName], membs, memb);
                                }
                                ShowPlayerDialog(playerid, 64, DIALOG_STYLE_LIST, "Leaders", string, "Close" , "Ok");
                        }

    }
   return 1;
}
Link to comment
Share on other sites

1. Asta [pawn]mysql_fetch_field_row(query, "playerName");
format(lead, MAX_PLAYER_NAME, "%s", query);[/pawn] poate sa fie doar [pawn]mysql_fetch_field_row(lead, "playerName");[/pawn]

 

2. on si on2 pot sa fie doar o singura variabila.

 

3. Problema este aici [pawn]if(strcmp(lead, "None", true) != 0)
{
new on2;
on2 = GetPlayerID(lead);
if(IsPlayerConnected(on2))
{
on = 1;
}
else on = 0;
}[/pawn]

 

pune [pawn]print("#1");[/pawn] in primul if si [pawn]print("#2");[/pawn] in al doilea if sa vedem daca intra in el. Dupa uita-te in log-ul serverului si spune-ne daca intra.

  • Upvote 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.