#Dialog Login Didn't Showing

103 messages · Page 1 of 1 (latest)

visual mango
#
if(dialogid == DIALOG_VERIFYCODE)
    {
        if(response)
        {
            new str[200];
            if(isnull(inputtext))
            {
                format(str, sizeof(str), "UCP: {15D4ED}%s\n{ffffff}Silahkan masukkan PIN yang sudah di kirimkan oleh BOT", UcpData[playerid][uUsername]);
                return ShowPlayerDialog(playerid, DIALOG_VERIFYCODE, DIALOG_STYLE_INPUT, "Verify Account", str, "Input", "Cancel");
            }
            if(!IsNumeric(inputtext))
            {
                format(str, sizeof(str), "UCP: {15D4ED}%s\n{ffffff}Silahkan masukkan PIN yang sudah di kirimkan oleh BOT\n\n{FF0000}PIN hanya berisi 6 Digit angka bukan huruf", UcpData[playerid][uUsername]);
                return ShowPlayerDialog(playerid, DIALOG_VERIFYCODE, DIALOG_STYLE_INPUT, "Verify Account", str, "Input", "Cancel");    
            }
            if(strval(inputtext) == UcpData[playerid][uVerifyCode])
            {
                new lstring[512];
                format(lstring, sizeof lstring, "{ffffff}Welcome to {15D4ED}"SERVER_NAME"\n{ffffff}UCP: {15D4ED}%s\n{ffffff}Password: \nSilahkan buat password baru kamu!:", UcpData[playerid][uUsername]);
                ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Registration Great", lstring, "Register", "Quit");    
                return 1;
            }

            format(str, sizeof(str), "UCP: {15D4ED}%s\n{ffffff}Silahkan masukkan PIN yang sudah di kirimkan oleh BOT\n\n{FF0000}PIN salah!", UcpData[playerid][uUsername]);
            return ShowPlayerDialog(playerid, DIALOG_VERIFYCODE, DIALOG_STYLE_INPUT, "Verify Account", str, "Input", "Cancel");    
        }
        else 
        {
            KickEx(playerid);
        }
    }
hidden flax
#

The code seems works fine to me make sure one of these conditions really meets with your data.

if(PlayerData[playerid][pPassword] > 10)
if(PlayerData[playerid][pPassword] > 1)

visual mango
hidden flax
#

Make a print statement inside the condition to check if it really meets it

visual mango
#

if(PlayerData[playerid][pPassword] > 10)
if(PlayerData[playerid][pPassword] > 1)

How to read this

hidden flax
hidden flax
#

it depends on what you want to do with that code tbh I really don't know how your code works

#

For me this pPassword is checking for the password length?

visual mango
#

if its new player, then the dialog verifycode showed

#

else, the dialog login showed

#

sorry for my bad english bro

hidden flax
#

Where do you assign the value of this pPassword?

#

or how do you assign the value for this pPassword

hidden flax
visual mango
#
WRP::OnUCPLoaded(playerid, race_check)
{
    if (race_check != g_RaceCheck[playerid])
        return KickEx(playerid);

    new rows = cache_num_rows();
    new string[352];
    if (rows)
    {
        cache_get_value_name_int(0, "id", UcpData[playerid][uID]);
        cache_get_value_name_int(0, "admin", UcpData[playerid][uAdmin]);
        cache_get_value_name(0, "username", UcpData[playerid][uUsername], 64);
        
        format(string,sizeof(string),"{FFFFFF}Welcome back to {00FFFF}"SERVER_NAME"\n\n{FFFF00}UCP Account: %s\n{FFFFFF}Please input your password to login:",GetName(playerid));
        ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"{FFFFFF}UCP Account Login",string,"Login","Cancel");
    }
    else
    {
        format(string,sizeof(string),"{FFFFFF}Welcome to {00FFFF}"SERVER_NAME"\n\n{FFFF00}UCP Account: %s\n{FFFFFF}Your UCP is doesn't exists\n{FFFFFF}Please input your Password for Register:",GetName(playerid));
        ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_PASSWORD,"Account Register",string,"Register","Cancel");
    }
    return 1;
}
visual mango
#

but the script not kicking the not registered player, it'll letting the player registering ingame

hidden flax
#

is it string?

visual mango
hidden flax
#

Then you did a wrong check

visual mango
#

sorry to bother you btw

hidden flax
#

Go for strlen function

#

if strlen(pPassword) > 1
if strlen(pPassword) > 10

visual mango
#

aight

hidden flax
#

Ohh probably this pPassword value is not really a string

visual mango
#
if strlen(PlayerData[playerid][pPassword] > 1)
hidden flax
#

its supposed to give you an error when compiling tho if you compare a string with integer

visual mango
#

i got invalid expression

hidden flax
hidden flax
# visual mango ```c WRP::OnUCPLoaded(playerid, race_check) { if (race_check != g_RaceCheck[...
WRP::OnUCPLoaded(playerid, race_check)
{
    if (race_check != g_RaceCheck[playerid])
        return KickEx(playerid);

    new rows = cache_num_rows();
    new string[352];
    if (rows)
    {
        cache_get_value_name_int(0, "id", UcpData[playerid][uID]);
        cache_get_value_name_int(0, "admin", UcpData[playerid][uAdmin]);
        cache_get_value_name(0, "username", UcpData[playerid][uUsername], 64);
        
        format(string,sizeof(string),"{FFFFFF}Welcome back to {00FFFF}"SERVER_NAME"\n\n{FFFF00}UCP Account: %s\n{FFFFFF}Please input your password to login:",GetName(playerid));
        ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"{FFFFFF}UCP Account Login",string,"Login","Cancel");
    }
    else
    {
    Kick(playerid);
    }
    return 1;
}
#

try this one if you really want to kick the player who is not registered

#

just fix the indentation I'm sorry I'm on mobile now

visual mango
visual mango
#

like my example script

hidden flax
visual mango
hidden flax
#

what is the value of this verify code? I guess its Integer?

hidden flax
#

if it is then it should be something like this.

if cache_num_rows
it means the player account already exists
Show him this dialog login
else
if verifycode <= 0
kick him

Let's say this verify code invalid code is 0 or negative values then kicks him if it is less than or equal to 0

visual mango
#

am i right?

visual mango
# hidden flax If you need something like this then the code you wrote above really wont work. ...
WRP::OnUCPLoaded(playerid, race_check)
{
    if (race_check != g_RaceCheck[playerid])
        return KickEx(playerid);

    new rows = cache_num_rows();
    new string[352];
    if (rows)
    {
        cache_get_value_name_int(0, "id", UcpData[playerid][uID]);
        cache_get_value_name_int(0, "admin", UcpData[playerid][uAdmin]);
        cache_get_value_name(0, "verifycode", UcpData[playerid][uVerifyCode], 64);
        cache_get_value_name(0, "username", UcpData[playerid][uUsername], 64);

        format(string, sizeof(string), "UCP: {15D4ED}%s\n{ffffff}Silahkan masukkan PIN yang sudah di kirimkan oleh BOT", GetName(playerid));
        ShowPlayerDialog(playerid, DIALOG_VERIFYCODE, DIALOG_STYLE_INPUT, "Verify Account", string, "Input", "Cancel");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX,"Account Unregistered","{FFFF00}Nama Akun ini belum terdaftar!\n{ffffff}Silahkan daftar di Official Discord kami {15D4ED}"SERVER_NAME"\n{ffffff}Link Discord: {15D4ED}","Okay","");
        KickEx(playerid);
    }
    return 1;
}
visual mango
# hidden flax yes I think

registered player still not getting dialog login, same with the unregistered player not getting dialog verifycode

hidden flax
#
else
    {
        ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX,"Account Unregistered","{FFFF00}Nama Akun ini belum terdaftar!\n{ffffff}Silahkan daftar di Official Discord kami {15D4ED}"SERVER_NAME"\n{ffffff}Link Discord: {15D4ED}","Okay","");
        KickEx(playerid);
    }```

And the code here really dont shows the verifycode dialog to the player it shows the dialog with the message and kicks the player probably that's not what you want
#
if rows
    show the login dialog
else
    show the verifycode dialog```

Probably this one is what you are looking for am I right?
visual mango
#
WRP::OnUCPLoaded(playerid, race_check)
{
    if (race_check != g_RaceCheck[playerid])
        return KickEx(playerid);

    new rows = cache_num_rows();
    new string[352];
    if (rows)
    {
        cache_get_value_name_int(0, "id", UcpData[playerid][uID]);
        cache_get_value_name_int(0, "admin", UcpData[playerid][uAdmin]);
        cache_get_value_name(0, "verifycode", UcpData[playerid][uVerifyCode], 64);
        cache_get_value_name(0, "username", UcpData[playerid][uUsername], 64);

        format(string,sizeof(string),"{FFFFFF}Welcome back to {FF0000}"SERVER_NAME"\n\n{FFFFFF}UCP Account: {FF0000}%s\n{FFFFFF}Please input your password to login:",GetName(playerid));
        ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"{FFFFFF}UCP Account Login",string,"Login","Cancel");
        
    }
    else
    {
        format(string, sizeof(string), "UCP: {15D4ED}%s\n{ffffff}Silahkan masukkan PIN yang sudah di kirimkan oleh BOT", GetName(playerid));
        ShowPlayerDialog(playerid, DIALOG_VERIFYCODE, DIALOG_STYLE_INPUT, "Verify Account", string, "Input", "Cancel");
    }
    return 1;
}
visual mango
hidden flax
#

put print statement inside if rows blocks and else blocks then check if it prints the statement to the console

#

if nothing prints probably the problem is somewhere from your code

visual mango
#

idk what should i write xd

#
printf("string: %s", string);
#

it's not printed to sampsvr

hidden flax
#

then something's wrong in calling OnUCPLoaded

#

probably mysql error

#

check your logs it can help you solve your problems

visual mango
#

the logs showed nothing, im using crashdetect

hidden flax
#

No crashdetect won't help your problem

hidden flax
visual mango
# hidden flax show the code on how you call this OnUCPLoaded
CheckAccount(playerid)
{
    
    new query[256];
    format(query, sizeof(query), "SELECT `username`, `verifycode` FROM `ucp` WHERE `username = '%s' LIMIT 1;", GetName(playerid));
    mysql_tquery(sqldata, query, "OnUCPLoaded", "dd", playerid, g_RaceCheck[playerid]);
    return 1;
}
hidden flax
#

stop using this format function

visual mango
hidden flax
#

change it to mysql_format

#

and dont use %s to avoid sql injection

#

use '%e' instead

#

Then to answer to your problem check your mysql logs if there are error when executing this query

visual mango
#

then what's this mean

missing the connection handle

hidden flax
#

show it here

visual mango
hidden flax
#

it means you didn't put your connection handle to the arguments before query

hidden flax
#

isn't it self explanatory?

#

its a variable to handle your mysql connection

visual mango
#
CheckAccount(playerid)
{
    new query[256];
    mysql_format(sqldata, query, sizeof(query), "SELECT `username`, `verifycode` FROM `ucp` = '%e' LIMIT 1;", GetName(playerid));
    mysql_tquery(sqldata, query, "OnUCPLoaded", "dd", playerid, g_RaceCheck[playerid]);
    return 1;
}
#

Latest script, got no warning log, but still not showing the DIALOG_LOGIN or DIALOG_VERIFYCODE

hidden flax
#

SELECT username, verifycode FROM ucp = '%e'

#

you did wrong here

#

The syntax is SELECT column(s) FROM table WHERE column

visual mango
#

ah

hidden flax
#

Do it then comeback here

visual mango
#
CheckAccount(playerid)
{
    new query[256];
    mysql_format(sqldata, query, sizeof(query), "SELECT `username`, `verifycode` FROM `ucp` WHERE `username = '%e' LIMIT 1;", GetName(playerid));
    mysql_tquery(sqldata, query, "OnUCPLoaded", "dd", playerid, g_RaceCheck[playerid]);
    return 1;
}
hidden flax
#

its supposed to give you an error in your logs since its not the right syntax

visual mango
#

im using xampp

hidden flax
hidden flax
visual mango
#

idk why its keep not showing up

#

the logs shows nothing abt the column, or the table that i set