DIALOG is showing ONE result.
#1

pawn Code:
CMD:faction(playerid, params[])
{
    new szDialog[256];
    if(!PermissionCheck(playerid, 6)) return ShowPlayerDialog(playerid, EDITFACTION_FAC_LEADER, DIALOG_STYLE_LIST, "Select a Option", "Name\nRank0\nRank1\nRank2\nRank3\nRank4\nRank5\nRank6\nRank7\nRank8\nRank9\nRank10", "Select", "Quit");
    //ShowPlayerDialog(playerid, EDITFACTION_FACID, DIALOG_STYLE_INPUT, "Editfaction", "Enter the faction id you want to edit:", "Select", "Close");
    for(new i = 0; i < MAX_FACTIONS; i++)
    {
        if(GroupInfo[i][gActive] == 1)
        {
            format(szDialog, sizeof(szDialog), "Name: %s - Type: %i - ID: %i", GroupInfo[i][gName], GroupInfo[i][gType], GroupInfo[i][gGroupID]-1);
            ShowPlayerDialog(playerid, EDITFACTION_LISTFACS, DIALOG_STYLE_LIST, "List of Factions", szDialog, "Select", "Close");
        }
    }
    return 1;
}
Why is it only showing one faction.

pawn Code:
for(new i = 0; i < MAX_FACTIONS; i++)
    {
        if(GroupInfo[i][gActive] == 1)
        {
            format(szDialog, sizeof(szDialog), "Name: %s - Type: %i - ID: %i", GroupInfo[i][gName], GroupInfo[i][gType], GroupInfo[i][gGroupID]-1);
            ShowPlayerDialog(playerid, EDITFACTION_LISTFACS, DIALOG_STYLE_LIST, "List of Factions", szDialog, "Select", "Close");
        }
    }
Reply
#2

Because it's in a loop. Because of that the dialog is shown for each iteration, BUT as they're very fast and SA:MP only allows one dialog to be open you will probably only see the last one.

pawn Code:
for(new i = 0; i < MAX_FACTIONS; i++)
    {
        if(GroupInfo[i][gActive] == 1)
        {
            format(szDialog, sizeof(szDialog), "%sName: %s - Type: %i - ID: %i",szDialog, GroupInfo[i][gName], GroupInfo[i][gType], GroupInfo[i][gGroupID]-1);
         
        }
    }
    ShowPlayerDialog(playerid, EDITFACTION_LISTFACS, DIALOG_STYLE_LIST, "List of Factions", szDialog, "Select", "Close");
Reply
#3

Quote:
Originally Posted by dusk
View Post
Because it's in a loop. Because of that the dialog is shown for each iteration, BUT as they're very fast and SA:MP only allows one dialog to be open you will probably only see the last one.

pawn Code:
for(new i = 0; i < MAX_FACTIONS; i++)
    {
        if(GroupInfo[i][gActive] == 1)
        {
            format(szDialog, sizeof(szDialog), "%sName: %s - Type: %i - ID: %i",szDialog, GroupInfo[i][gName], GroupInfo[i][gType], GroupInfo[i][gGroupID]-1);
         
        }
    }
    ShowPlayerDialog(playerid, EDITFACTION_LISTFACS, DIALOG_STYLE_LIST, "List of Factions", szDialog, "Select", "Close");
Thank you but how can I make this check if a player is online

pawn Code:
CMD:osetadminname(playerid, params[])
{
    if(!PermissionCheck(playerid, 7)) return SendClientMessageEx(playerid, COLOR_GREY, "You are not authourized to use this command.");
    new szName[MAX_PLAYER_NAME], szQuery[256], DBResult:szResult, szString[128], AdminName[24];
    GetPlayerName(playerid, szName, MAX_PLAYER_NAME);
    if(sscanf(params, "s[24]s[128]", szName, AdminName)) return SendClientMessage(playerid, -1, "USAGE: /osetadminname [Name] [AdminName]");
    format(szQuery, sizeof(szQuery), "SELECT Username FROM Accounts WHERE Username = '%s'", szName);
    szResult = db_query(Database, szQuery);
    if(!db_num_rows(szResult))
    {
        SendClientMessage(playerid, -1, "That name doesnt Exist in the database.");
    }
    else {
        format(PlayerInfo[playerid][pAdminName], 24, "%s", AdminName);
        format(szQuery, sizeof(szQuery), "UPDATE `Accounts` SET `pAdminName`='%s' WHERE `Username`='%s'", AdminName, szName);
        db_free_result(db_query(Database, szQuery));
        format(szString, sizeof(szString), "You have set %s's to admin name to %s.", szName, AdminName);
        SendClientMessage(playerid, -1, szString);
        print(szQuery);
        return 1;
    }
    return 1;
}
Reply
#4

Quote:
Originally Posted by MillenniumG
View Post
Thank you but how can I make this check if a player is online

pawn Code:
CMD:osetadminname(playerid, params[])
{
    if(!PermissionCheck(playerid, 7)) return SendClientMessageEx(playerid, COLOR_GREY, "You are not authourized to use this command.");
    new szName[MAX_PLAYER_NAME], szQuery[256], DBResult:szResult, szString[128], AdminName[24];
    GetPlayerName(playerid, szName, MAX_PLAYER_NAME);
    if(sscanf(params, "s[24]s[128]", szName, AdminName)) return SendClientMessage(playerid, -1, "USAGE: /osetadminname [Name] [AdminName]");
    format(szQuery, sizeof(szQuery), "SELECT Username FROM Accounts WHERE Username = '%s'", szName);
    szResult = db_query(Database, szQuery);
    if(!db_num_rows(szResult))
    {
        SendClientMessage(playerid, -1, "That name doesnt Exist in the database.");
    }
    else {
        format(PlayerInfo[playerid][pAdminName], 24, "%s", AdminName);
        format(szQuery, sizeof(szQuery), "UPDATE `Accounts` SET `pAdminName`='%s' WHERE `Username`='%s'", AdminName, szName);
        db_free_result(db_query(Database, szQuery));
        format(szString, sizeof(szString), "You have set %s's to admin name to %s.", szName, AdminName);
        SendClientMessage(playerid, -1, szString);
        print(szQuery);
        return 1;
    }
    return 1;
}
anyone?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)