SA-MP Forums Archive
Dialogs Dont work.. - 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: Dialogs Dont work.. (/showthread.php?tid=343016)



Dialogs Dont work.. - jtemple042996 - 15.05.2012

Not only do the dialogs not work but they make all commands return SERVER: Unknown Command!
Quote:

new pname[MAX_PLAYER_NAME],file[128],sstring[MAX_PLAYER_NAME+128];
GetPlayerName(playerid,pname,sizeof(pname));
format(file, sizeof(file), "\\Users\\%s.ini", pname);
format(sstring,sizeof(sstring),"%s(%i) has joined the server.",pname,playerid);
SendClientMessageToAll(0x828282FF,sstring);
if(dini_Exists(file))
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD, "Login","Enter your password below:","Login","Cancel");
}
else
{
ShowPlayerDialog(playerid,2,DIALOG_STYLE_PASSWORD, "Register","Enter your password below:","Register","Cancel");
}

Quote:

new file[128],pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
format(file, sizeof(file), "\\Users\\%s.ini", pname);
switch(dialogid)
{
case 1://login
{
new pass[500],lpassenc[33];
pass = dini_Get(file,"pass");
md5(inputtext,lpassenc);
if(strcmp(lpassenc,pass, false))
{
SendClientMessage(playerid,0x828282FF,"You are successfully logged in!");
alevel[playerid] = strval(dini_Get(file,"alevel"));
faction[playerid] = strval(dini_Get(file,"faction"));
rank[playerid] = strval(dini_Get(file,"rank"));
ucbadge[playerid] = strval(dini_Get(file,"ucbadge"));
swat[playerid] = strval(dini_Get(file,"swat"));
det[playerid] = strval(dini_Get(file,"det"));
tf[playerid] = strval(dini_Get(file,"tf"));
}
else
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD, "Wrong Password!","Enter your password below:","Login","Cancel");
}
if(!response)
{
Kick(playerid);
}
}
case 2://register
{
new rpassenc[33];
md5(inputtext,rpassenc);
dini_Create(file);
dini_Set(file, "pass", rpassenc);
dini_IntSet(file,"alevel", 0);
dini_IntSet(file,"faction", 0);
dini_IntSet(file,"rank",0);
dini_IntSet(file,"ucbadge",0);
dini_IntSet(file,"swat",0);
dini_IntSet(file,"det",0);
dini_IntSet(file,"tf",0);
dini_IntSet(file,"copbanned",0);
SendClientMessage(playerid,0x828282FF,"You are now registered on this server!");
if(!response)
{
Kick(playerid);
}
}
case 3:
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD, "Login","Enter your password below:","Login","Cancel");
}
}
return 1;




Re: Dialogs Dont work.. - MeDaKewlDude - 16.05.2012

this should fix the login, but i think the "command not found" part is in a different part.(prehaps in "OnPlayerCommandText")
pawn Код:
new file[128],pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
format(file, sizeof(file), "\\Users\\%s.ini", pname);
switch(dialogid)
{
case 1://login
{
new pass[500],lpassenc[33];
pass = dini_Get(file,"pass");
md5(inputtext,lpassenc);
if(response)
{
if(!strcmp(lpassenc,pass, false))
{
SendClientMessage(playerid,0x828282FF,"You are successfully logged in!");
alevel[playerid] = strval(dini_Get(file,"alevel"));
faction[playerid] = strval(dini_Get(file,"faction"));
rank[playerid] = strval(dini_Get(file,"rank"));
ucbadge[playerid] = strval(dini_Get(file,"ucbadge"));
swat[playerid] = strval(dini_Get(file,"swat"));
det[playerid] = strval(dini_Get(file,"det"));
tf[playerid] = strval(dini_Get(file,"tf"));
}
else
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD, "Wrong Password!","Enter your password below:","Login","Cancel");
}
}
else
{
Kick(playerid);
}
}
case 2://register
{
if(response)
{
new rpassenc[33];
md5(inputtext,rpassenc);
dini_Create(file);
dini_Set(file, "pass", rpassenc);
dini_IntSet(file,"alevel", 0);
dini_IntSet(file,"faction", 0);
dini_IntSet(file,"rank",0);
dini_IntSet(file,"ucbadge",0);
dini_IntSet(file,"swat",0);
dini_IntSet(file,"det",0);
dini_IntSet(file,"tf",0);
dini_IntSet(file,"copbanned",0);
SendClientMessage(playerid,0x828282FF,"You are now registered on this server!");
}
else
{
Kick(playerid);
}
}
case 3:
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD, "Login","Enter your password below:","Login","Cancel");
}
}
return 1;
also, you might want to indent the code. its alot easier to read that way
indented:
pawn Код:
new file[128],pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
format(file, sizeof(file), "\\Users\\%s.ini", pname);
switch(dialogid)
{
    case 1://login
    {
        new pass[500],lpassenc[33];
        pass = dini_Get(file,"pass");
        md5(inputtext,lpassenc);
        if(response)
        {
            if(!strcmp(lpassenc,pass, false))
            {
                SendClientMessage(playerid,0x828282FF,"You are successfully logged in!");
                alevel[playerid] = strval(dini_Get(file,"alevel"));
                faction[playerid] = strval(dini_Get(file,"faction"));
                rank[playerid] = strval(dini_Get(file,"rank"));
                ucbadge[playerid] = strval(dini_Get(file,"ucbadge"));
                swat[playerid] = strval(dini_Get(file,"swat"));
                det[playerid] = strval(dini_Get(file,"det"));
                tf[playerid] = strval(dini_Get(file,"tf"));
            }
            else
            {
                ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD, "Wrong Password!","Enter your password below:","Login","Cancel");
            }
        }
        else
        {
            Kick(playerid);
        }
    }
    case 2://register
    {
        if(response)
        {
            new rpassenc[33];
            md5(inputtext,rpassenc);
            dini_Create(file);
            dini_Set(file, "pass", rpassenc);
            dini_IntSet(file,"alevel", 0);
            dini_IntSet(file,"faction", 0);
            dini_IntSet(file,"rank",0);
            dini_IntSet(file,"ucbadge",0);
            dini_IntSet(file,"swat",0);
            dini_IntSet(file,"det",0);
            dini_IntSet(file,"tf",0);
            dini_IntSet(file,"copbanned",0);
            SendClientMessage(playerid,0x828282FF,"You are now registered on this server!");
        }
        else
        {
            Kick(playerid);
        }
    }
    case 3:
    {
        ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD, "Login","Enter your password below:","Login","Cancel");
    }
}
return 1;



Re: Dialogs Dont work.. - jtemple042996 - 18.05.2012

Ok thanks for that, however i use ZCMD(No OnPlayerCommandText) and the scripts work fine without the login script.

EDIT: Dialogs still dont work..


Re: Dialogs Dont work.. - milanosie - 18.05.2012

you forgot if(response)