SA-MP Forums Archive
Dialog isn't showing... - 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: Dialog isn't showing... (/showthread.php?tid=604225)



Dialog isn't showing... - Tass007 - 02.04.2016

Hi guys, could you please help me? I type the command /request in the server but nothing happens, the server registers it because it's displayed on the server.log but no dialog appears. Could you help me?

P.S I get no warnings or errors when compiling. Here is my command code.

PHP код:
CMD:request(playerid,params[])
{
    new 
OrgsCount dini_Int(AddDirFile(dir_orgfilesFILE_OSTATS), "max_org");
    if(
isnull(params))
    {
        new 
string[1000], fstring[128], dstring[1028];
        for(new 
org =1OrgsCount 1org++)
        {
            
format(fstring,sizeof(fstring),"ORG%d"org);
            
strcat(string,fstring,sizeof(string));
            if(!
dini_Exists(AddDirFile(dir_orgfilesfstring)))
            if(
adlvl[playerid]>= 3format(dstringsizeof(dstring), "%s\n{%s}%s (%d)\n"dstringdini_Get(AddDirFile(dir_orgfiles,fstring), "color"), dini_Get(AddDirFile(dir_orgfiles,fstring), "name"), org);
            else 
format(fstringsizeof(fstring), "%s\n{%s}%s\n"dstringdini_Get(AddDirFile(dir_orgfilesfstring), "color"), dini_Get(AddDirFile(dir_orgfilesfstring), "name"), org);
        }
        
ShowPlayerDialog(playeridDIALOG_ORG_REQUESTDIALOG_STYLE_LIST"Select an organization to join."string"Select""Cancel");
    }
    else
    {
        if(
orgReq[playerid] > 0) return SendClientMessage(playeridCOLOR_ORANGE"You already requesting to join an organization.");
        if(
GetPVarInt(playerid"playerorg") != 0) return SendClientMessage(playeridCOLOR_ORANGE"You already belong to an organization.");
        if(
DoesPlayerHaveMenuOpen(playerid) || GetPlayerDialog(playerid) != -1) return SendClientMessage(playeridCOLOR_WHITE"SERVER: Please exit your current menu first.");
        if(
OrgsCount == 0) return SendClientMessage(playeridCOLOR_SILVER"There are currently no existing organizations.");
    }
    return 
1;

As always who ever helps will get +1 Rep. Thanks for your time.


Re: Dialog isn't showing... - fuckingcruse - 02.04.2016

Try this :
Код:
CMD:request(playerid,params[])
{
    new OrgsCount = dini_Int(AddDirFile(dir_orgfiles, FILE_OSTATS), "max_org");
    if(isnull(params))
    {
        new string[1000], fstring[128], dstring[1028];
        for(new org =1; 1 < OrgsCount + 1; org++)
        {
            format(fstring,sizeof(fstring),"ORG%d", org);
            strcat(string,fstring,sizeof(string));
            if(!dini_Exists(AddDirFile(dir_orgfiles, fstring)))
            if(adlvl[playerid]>= 3) format(dstring, sizeof(dstring), "%s\n{%s}%s (%d)\n", dstring, dini_Get(AddDirFile(dir_orgfiles,fstring), "color"), dini_Get(AddDirFile(dir_orgfiles,fstring), "name"), org);
            else format(fstring, sizeof(fstring), "%s\n{%s}%s\n", dstring, dini_Get(AddDirFile(dir_orgfiles, fstring), "color"), dini_Get(AddDirFile(dir_orgfiles, fstring), "name"), org);
            ShowPlayerDialog(playerid, DIALOG_ORG_REQUEST, DIALOG_STYLE_LIST, "Select an organization to join.", string, "Select", "Cancel");
        }
    }
    else
    {
        if(orgReq[playerid] > 0) return SendClientMessage(playerid, COLOR_ORANGE, "You already requesting to join an organization.");
        if(GetPVarInt(playerid, "playerorg") != 0) return SendClientMessage(playerid, COLOR_ORANGE, "You already belong to an organization.");
        if(DoesPlayerHaveMenuOpen(playerid) || GetPlayerDialog(playerid) != -1) return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Please exit your current menu first.");
        if(OrgsCount == 0) return SendClientMessage(playerid, COLOR_SILVER, "There are currently no existing organizations.");
    }
    return 1;
}



Re: Dialog isn't showing... - Tass007 - 02.04.2016

Hi, Thanks for replying but that still doesn't work... :\


Re: Dialog isn't showing... - Vince - 02.04.2016

You have an infinite loop. This condition:
PHP код:
OrgsCount 
Will always be true for any value of "OrgsCount" greater than 0.


Re: Dialog isn't showing... - Tass007 - 02.04.2016

Quote:
Originally Posted by Vince
Посмотреть сообщение
You have an infinite loop. This condition:
PHP код:
OrgsCount 
Will always be true for any value of "OrgsCount" greater than 0.
What would you advise me to do?


Re: Dialog isn't showing... - SamJust - 02.04.2016

Try this
Код:
for(new org =1; org < OrgsCount + 1; org++)



Re: Dialog isn't showing... - Tass007 - 02.04.2016

That still doesn't work...