• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] i have problem with easyDialog or mysql r41-4
#1
Sad 
Dovada: https://www.youtube.com/watch?v=JI6VpCtqK2w

public OnGameModeExit()
{
mysql_close(SQL);
return 1;
}

public OnPlayerRequestClass(playerid)
{
return 1;
}
public OnPlayerConnect(playerid)
{
qQuery[0] = (EOS);
mysql_format(SQL, qQuery, sizeof(qQuery), "SELECT * FROM `users` WHERE `Name` = '%e' LIMIT 1", GetPlayerNameEx(playerid));
mysql_pquery(SQL, qQuery, "CheckPlayerAccount", "d", playerid);
PlayerInfo[playerid][pLoginTires] = 0;
return 1;
}

function CheckPlayerAccount(playerid) {

qString[0] = (EOS);
switch(cache_num_rows())
{
case 0:
{
format(qString, sizeof(qString), "Bine ai venit, %s.\nScrie o parola pentru a te inregistra:", GetPlayerNameEx(playerid));
Dialog_Show(playerid, DILOAG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", qString, "Register", "Quit");
}
case 1:
{
format(qString, sizeof(qString), "Bine ai revenit, %s.\nScrie mai jos parola contului tau:", GetPlayerNameEx(playerid));
Dialog_Show(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", qString, "Login", "Quit");
}
}
return 1;
}

Dialog:DIALOG_REGISTER(playerid, response, listitem, inputtext[]) {

if(!response)
return Kick(playerid);

if(strlen(inputtext) < 8 || strlen(inputtext) > 32)
return Dialog_Show(playerid, DILOAG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Scrie o parola pentru a te inregistra:\nNumarul de caractere trebuie sa fie format din 8 - 64", "Register", "Quit");


format(PlayerInfo[playerid][pName], 24, GetPlayerNameEx(playerid));
format(PlayerInfo[playerid][pPassword], 128, inputtext);

qQuery[0] = (EOS);
mysql_format(SQL, qQuery, sizeof(qQuery), "INSERT INTO `users` (Name, Password) VALUES ('%e', '%e')", GetPlayerNameEx(playerid), inputtext);
mysql_pquery(SQL, qQuery, "CheckSQLID", "d", playerid);

Dialog_Show(playerid, DIALOG_EMAIL, DIALOG_STYLE_INPUT, "E-Mail", "Scrie mai jos adresa ta de e-mail:", "Ok", "");


return 1;
}

Dialog:DIALOG_EMAIL(playerid, response, listitem, inputtext[])
{

if(!response)
return Dialog_Show(playerid, DIALOG_EMAIL, DIALOG_STYLE_INPUT, "E-Mail", "Scrie mai jos adresa ta de e-mail:", "Ok", "");

if(strlen(inputtext) < 8 || strlen(inputtext) > 128 || !IsValidEmailAddress(inputtext))
return Dialog_Show(playerid, DIALOG_EMAIL, DIALOG_STYLE_INPUT, "E-Mail", "Scrie mai jos adresa ta de e-mail:\nAdresa de e-mail nu este valida.", "Ok", "");

qQuery[0] = (EOS);
mysql_format(SQL, qQuery, sizeof(qQuery), "UPDATE `users` SET `Email` = `%e` WHERE `ID` = `%d`", PlayerInfo[playerid][pEmail], PlayerInfo[playerid][pSQLID]);
mysql_tquery(SQL, qQuery, "", "");

return 1;
}
Dialog:DIALOG_LOGIN(playerid, response, listitem, inputtext[]) {

if(!response)
return Kick(playerid);

qQuery[0] = (EOS);
mysql_format(SQL, qQuery, sizeof(qQuery), "SELECT * FROM `users` WHERE `Name` = `%e` AND `Password` = `%e` LIMIT 1", GetPlayerNameEx(playerid), inputtext);
mysql_pquery(SQL, qQuery, "OnPlayerLogin", "d", playerid);
return 1;
}
function OnPlayerLogin(playerid) {

switch(cache_num_rows())
{
case 0:
{

PlayerInfo[playerid][pLoginTires] ++;
if(PlayerInfo[playerid][pLoginTires] == 3) return Kick(playerid);

}
case 1:
{

cache_get_value_name_int(0, "pSQLID", PlayerInfo[playerid][pSQLID]);
cache_get_value_name_int(0, "Name", PlayerInfo[playerid][pName]);
cache_get_value_name_int(0, "Password", PlayerInfo[playerid][pPassword]);
cache_get_value_name_int(0, "Email", PlayerInfo[playerid][pEmail]);

}
}

return 1;
}

function CheckSQLID(playerid) {

PlayerInfo[playerid][pSQLID] = cache_insert_id();
printf("New account: %s.", GetPlayerNameEx(playerid));
return 1;
}
  Reply


Messages In This Thread
i have problem with easyDialog or mysql r41-4 - by lifehd326 - 2023-09-14, 02:22 PM

Forum Jump: