Search

open.mp forum

RegisterLogin

Discussion

General
Chat
Tech
Life
Art
Programming
open.mp
Development Updates
Questions and Suggestions
SA-MP
General Discussions
Videos and Screenshots
Support
Pawn Scripting
Tutorials
Releases
Plugins
Libraries
Filterscripts
Gamemodes
Maps
Advertisements
Other languages
Spanish/Espa?ol
Programaci?n
Discusi?n GTA SA Multijugador
Mods
Offtopic
Juegos
Portuguese/Portugu?s
Russian/???????
Italian/Italiano
Dutch/Nederlands
German/Deutsch
Romanian/Rom?na
Ex-Yu
Polish/Polski
Og?lne
Serwery
Skryptowanie
Filmiki i zdjecia
Lithuanian/Lietuvi?kas
French/Fran?ais
Hungarian/Magyar
Hindi/Urdu
Turkish
Other
Internal
Team
Hidden
Archived

Library

 Collections Links Members Roles

i have problem with easyDialog or mysql r41-4

Dovada: https://www.youtube.com/watch?v=JI6VpCtqK2w

ID
d6ouivnilegovhg7c13g
author
lifehd326's avatar

lifehd326

@lifehd326


View profile
Copy link
  Report member
started
Sep 14, 2023
replies
0
participating
No

scroll to top

powered by storyden

Login
Discussion
Pawn Scripting
i have problem with easyDialog or mysql r41-4
lifehd326's avatar

lifehd326

@lifehd326


View profile
Copy link
  Report member
• 2y
Pawn Scripting

i have problem with easyDialog or mysql r41-4

pawn

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;
}

0 likes0 replies

    Please sign up or log in to reply