SA-MP Forums Archive
Dialog crashing server? - 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 crashing server? (/showthread.php?tid=294369)



Dialog crashing server? - sekol - 01.11.2011

Hello.
I just found an old map of mine while cleaning up my hard drive. Lead by curiosity I tried to launch it to check what features are there and such... How dissapointed I was when I noticed my map being crashed just after showing register dialog! What could be a reason of this?

PHP код:
public OnPlayerConnect(playerid)
{
    new 
str[128], secondstring[128], accname[128];
     
format(secondstringsizeof(secondstring), "Map By:"AUTHOR" || Vehicles %d|"VEHICLE_COUNT);
    
SendClientMessage(playeridCOLOR_WHITEsecondstring); printf("second string message");
    
format(accnamesizeof(accname), "FILES/ACCOUNTS/%s.ini"GetName(playerid)); printf("Accname formating");
     if(!
fexist(accname)) printf("Checking if there's a file for defined player");
     {
         
format(strsizeof(str), "{FFFFFF}Hello. {FBFF00}%s \n\n{FFFFFF}Register!"GetName(playerid)); printf("register dialog formating");
        
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT"Register"str"Register""Quit"); printf("Showed dialog");
    return 
1;

It looks like it crashes on bottom lines...
PHP код:
if(dialogid == DIALOG_REGISTER)
    {
        if(!
response) return Kick(playerid);
        if(
response)
        {
            if(
strlen(inputtext) == 0)
            {
                
format(stringsizeof(string), "{FFFFFF}Hello {FBFF00}%s \n\n{FFFFFF}Register"GetName(playerid));
                
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT"Register"string"Register""Quit");
                return 
0;
            } 



Re: Dialog crashing server? - IstuntmanI - 01.11.2011

You forget a } .

Add a } after
Код:
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register", str, "Register", "Quit"); printf("Showed dialog");
And post all response for dialog.


Re: Dialog crashing server? - sekol - 01.11.2011

PHP код:
if(!fexist(accname))
            {
                
djCreateFile(accname);
                
djSetInt(accname,"Password",udb_hash(inputtext));
                
OnPlayerRegister(playerid);
                
ShowPlayerDialog(playeridDIALOG_SEXDIALOG_STYLE_LIST"Man or Woman?""Man\nWoman""Select""Cancel");
            }
        }
    } 



Re: Dialog crashing server? - sekol - 01.11.2011

It crashes directly after showing register dialog. I checked it with ExecutionLogger...


Re: Dialog crashing server? - sekol - 02.11.2011

bump


Re: Dialog crashing server? - sekol - 04.11.2011

BUMP!! <cry>


Re: Dialog crashing server? - PowerPC603 - 10.11.2011

Try this:
pawn Код:
public OnPlayerConnect(playerid)
{
    new str[128], secondstring[128], accname[128];

    format(secondstring, sizeof(secondstring), "Map By:"AUTHOR" || Vehicles %d|", VEHICLE_COUNT);
    SendClientMessage(playerid, COLOR_WHITE, secondstring);
    printf("second string message");

    format(accname, sizeof(accname), "FILES/ACCOUNTS/%s.ini", GetName(playerid));
    printf("Accname formating");

    if(!fexist(accname))
    {
        printf("Checking if there's a file for defined player");

        format(str, sizeof(str), "{FFFFFF}Hello. {FBFF00}%s \n\n{FFFFFF}Register!", GetName(playerid));
        printf("register dialog formating");
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register", str, "Register", "Quit");
        printf("Showed dialog");
    }

    return 1;
}



Re: Dialog crashing server? - sekol - 13.11.2011

It didn't work. It again crashed on showin dialog -.-


Re: Dialog crashing server? - BlackSA - 13.11.2011

Make sure that are all the folders are existing.


Re: Dialog crashing server? - sekol - 13.11.2011

I did. Even if there's one missing it wouldn't just save and not crash the server because of dialog.