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);
}
}
#Dialog Login Didn't Showing
103 messages · Page 1 of 1 (latest)
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)
im copying the verifycode script from another gamemode, but idk about this code
Make a print statement inside the condition to check if it really meets it
if(PlayerData[playerid][pPassword] > 10)
if(PlayerData[playerid][pPassword] > 1)
How to read this
I guess its checking if the pPassword value from the player is greater than 10 and if it is then go to the next condition which checks if its greater than 1 but I think not the best way to use pPassword name for integer values since we know that password is string
should i change it?
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?
i want to let the script to check the pPassword is filled or no, i mean like, the player is new player, or no
if its new player, then the dialog verifycode showed
else, the dialog login showed
sorry for my bad english bro
Where do you assign the value of this pPassword?
or how do you assign the value for this pPassword
You already did it with if cache_num_rows > 0
this?
ah, let me send the original code before this
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;
}
this works fine
but the script not kicking the not registered player, it'll letting the player registering ingame
yes
Then you did a wrong check
aight
Ohh probably this pPassword value is not really a string
if strlen(PlayerData[playerid][pPassword] > 1)
its supposed to give you an error when compiling tho if you compare a string with integer
i got invalid expression
put ( before strlen
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
idk why dialog_login still not showed
yes, then i want to let the player that already have verifycode, to got the dialog_verifycode
like my example script
If you need something like this then the code you wrote above really wont work.
if cache_num_rows
it means the player account already exists
Show him this dialog login
else
Show him this verify code dialog
i see
then, if the player is not registered, and dont have verifycode also. How to kick it?
what is the value of this verify code? I guess its Integer?
yes integer
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
am i right?
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;
}
yes I think
Give it a try
registered player still not getting dialog login, same with the unregistered player not getting dialog verifycode
show the code
this
inside if rows means the player is already registered show him the login dialog not that DIALOG_VERIFYCODE
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?
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;
}
yes, edited, but still not showed
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
you mean like, printf?
idk what should i write xd
printf("string: %s", string);
it's not printed to sampsvr
then something's wrong in calling OnUCPLoaded
probably mysql error
check your logs it can help you solve your problems
any idea how to find the error? im new on scripting tbh
the logs showed nothing, im using crashdetect
No crashdetect won't help your problem
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;
}
stop using this format function
but it works fine before i replace this code
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
where to check mysql log sir
then what's this mean
missing the connection handle
show it here
it means you didn't put your connection handle to the arguments before query
what's connection handle
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
SELECT username, verifycode FROM ucp = '%e'
you did wrong here
The syntax is SELECT column(s) FROM table WHERE column
ah
Do it then comeback here
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;
}
its supposed to give you an error in your logs since its not the right syntax
yea give it a shot
where to check mysql log btw
im using xampp
in your directory find the folder named logs then find it here
that's good