Jump to content

Robi[adv]

Membru
  • Posts

    28
  • Joined

  • Last visited

Everything posted by Robi[adv]

  1. Recent am creat cu ajutorul unui tutorial un sistem de register si de login , ceva simplu. Problema nu este intimpinata la cod ci la baza de date. La conexiunea cu serverul nu intampin nici-o problema..se conecteaza. Insa dupa register, la relog contul nu ramane salvat. #define SQL_HOST "localhost" #define SQL_USER "root" #define SQL_PASS "" #define SQL_DB "rpg_db" new SQL; // conexiunea se afla in public OnGameModeInit() SQL = mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS); public OnPlayerConnect(playerid) { PlayerInfo[playerid][pLoginTries] = 0; gQuery[0] = EOS; mysql_format(SQL, gQuery, sizeof(gQuery), "SELECT * FROM `users` WHERE `Name` = '%e' LIMIT 1", GetName(playerid)); mysql_tquery(SQL, gQuery, "checkAcount", "i" ,playerid); return 1; } case DIALOG_REGISTER: { if(!response) return Kick(playerid); if(strlen(inputtext) < 6 || strlen(inputtext) > 32) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Bine ai venit!\nScrie o parola pentru a te putea inregistra.\nParola trebuie sa fie intre 6-32 caractere\nParola nu indeplineste cerintele cerute!", "Register", "Quit"); gQuery[0] = EOS; mysql_format(SQL, gQuery, sizeof gQuery, "INSERT INTO `users` ('Name', 'Password') VALUES ('%s', '%s')", GetName( playerid ), inputtext ); mysql_tquery(SQL, gQuery, "insertAccount", "d", playerid); format(PlayerInfo[playerid][pPassword], 32, inputtext); ShowPlayerDialog(playerid, DIALOG_EMAIL, DIALOG_STYLE_INPUT, "E-Mail", "Seteaza-ti parola de e-mail.\nTe rugam sa folosesti o adresa valida.", "Setez",""); } function insertAccount(playerid) { PlayerInfo[playerid][pSQLID] = cache_insert_id(); printf("%s s-a inregistrat cu SQLID-ul #%d.", GetName(playerid), PlayerInfo[playerid][pSQLID]); return 1; } function checkAcount(playerid) { switch(cache_num_rows()) { case 0: ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Bine ai venit!\nScrie o parola pentru a te putea inregistra.\nParola trebuie sa fie intre 6-32 caractere", "Register", "Quit"); case 1: ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Bine ai venit!\nScrie parola in casuta de mai jos pentru a te loga!", "Login", "Quit"); } return 1; } M-am ajutat de o comanda luata dupa net. public OnQueryError , eroarea este urmatoarea: [20:46:06 03/27/20] [DEBUG] mysql_connect - host: "localhost", user: "root", database: "rpg_db", password: "****", port: 3306, autoreconnect: true, pool_size: 2 [20:46:06 03/27/20] [DEBUG] CMySQLHandle::Create - creating new connection.. [20:46:06 03/27/20] [DEBUG] CMySQLHandle::CMySQLHandle - constructor called [20:46:06 03/27/20] [DEBUG] CMySQLHandle::Create - connection created (id: 1) [20:46:06 03/27/20] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [20:46:06 03/27/20] [DEBUG] CMySQLConnection::Connect - connection was successful [20:46:06 03/27/20] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [20:46:06 03/27/20] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [20:46:06 03/27/20] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [20:46:06 03/27/20] [DEBUG] CMySQLConnection::Connect - establishing connection to database... [20:46:06 03/27/20] [DEBUG] CMySQLConnection::Connect - connection was successful [20:46:06 03/27/20] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [20:46:07 03/27/20] [DEBUG] CMySQLConnection::Connect - connection was successful [20:46:07 03/27/20] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [20:46:07 03/27/20] [DEBUG] CMySQLConnection::Connect - connection was successful [20:46:07 03/27/20] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled [20:46:37 03/27/20] [DEBUG] mysql_format - connection: 1, len: 256, format: "SELECT * FROM `users` WHERE `Name` = '%e' LIMIT 1" [20:46:37 03/27/20] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM `users` WHERE `Name` = 'wRoby' LIMIT 1", callback: "checkAcount", format: "i" [20:46:37 03/27/20] [DEBUG] CMySQLQuery::Execute[checkAcount] - starting query execution [20:46:38 03/27/20] [DEBUG] CMySQLQuery::Execute[checkAcount] - query was successfully executed within 1188.293 milliseconds [20:46:38 03/27/20] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [20:46:38 03/27/20] [DEBUG] Calling callback "checkAcount".. [20:46:38 03/27/20] [DEBUG] cache_get_row_count - connection: 1 [20:46:38 03/27/20] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called [20:46:41 03/27/20] [DEBUG] mysql_format - connection: 1, len: 256, format: "INSERT INTO `users` ('Name', 'Password') VALUES ('%s', '%s')" [20:46:41 03/27/20] [DEBUG] mysql_tquery - connection: 1, query: "INSERT INTO `users` ('Name', 'Password') VALUES ('wRoby', '03200", callback: "insertAccount", format: "d" [20:46:41 03/27/20] [DEBUG] CMySQLQuery::Execute[insertAccount] - starting query execution [20:46:41 03/27/20] [ERROR] CMySQLQuery::Execute[insertAccount] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''Name', 'Password') VALUES ('wRoby', '032003')' at line 1 (Query: "INSERT INTO `users` ('Name', 'Password') VALUES ('wRoby', '032003')") [20:46:41 03/27/20] [DEBUG] CMySQLQuery::Execute[insertAccount] - error will be triggered in OnQueryError [20:46:41 03/27/20] [DEBUG] Calling callback "OnQueryError".. [20:46:43 03/27/20] [DEBUG] mysql_format - connection: 1, len: 256, format: "UPDATE 'users' SET 'Email' = '%s' WHERE 'ID' = '%d'" [20:46:43 03/27/20] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE 'users' SET 'Email' = 'robert' WHERE 'ID' = '0'", callback: "(null)", format: "(null)" [20:46:43 03/27/20] [DEBUG] CMySQLQuery::Execute[] - starting query execution [20:46:43 03/27/20] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''users' SET 'Email' = 'robert' WHERE 'ID' = '0'' at line 1 (Query: "UPDATE 'users' SET 'Email' = 'robert' WHERE 'ID' = '0'") [20:46:43 03/27/20] [DEBUG] CMySQLQuery::Execute[] - error will be triggered in OnQueryError [20:46:43 03/27/20] [DEBUG] Calling callback "OnQueryError"..
  2. Nu ma pricep , da ce e acolo nu are logica
  3. Este facuta din capul tau sau vazuta undeva?
  4. Asta tocmai ce am terminat de facut un sistem de register vazut la un tutorial pe net. Totul mi-a mers foarte ok , nici-o eroare in script. Pana cand am vrut sa testez si am realizat ca nu merge. Dupa ce ma conectez , ma pune sa aleg o parola iar dupa asta nu se face conectarea la baza de date, pur si simplu dialogul cu register dispare si nu mai apare nimic... Putin ajutor?
  5. Recend am vazut un tutorial despre zone text, si in momentul cand trebuia sa adaug textul de m-ai jos , nu am stiut unde , deoarece cel din tutorial avea un pulbic pe care eu nu-l aveam. V-a rug ajutati-ma. foreach(Player, i) { if(ZoneIndicator[i] == 1) { new zone[32]; GetPlayer3DZone(i, zone ,sizeof(zone)); PlayerTextDrawSetString(i, ZoneIndicator, string); PlayerTextDrawShow(i, ZoneIndicator); } return }
  6. Simplu , dar nu te descuraja , acorda-i m-ai mult timp si fii sigur ca v-a iesii belea.
  7. Salut manilor , am creeat un textdraw ce contine informatii despre statusul playerului[click], health ,money ,armour ,hours , si vreau sa-l adaug in colt dreapta sus , si nu stiu cum sa scot ,fist-ul , money bar ,health bar , etc . Daca ma puteti ajuta , aveti tot respectul meu . Am m-ai vazut faza aceasta , deci se poate.
  8. public OnPlayerConnect(playerid) { ShowPlayerMarkers(2); return 1; }
  9. Dar Stock-ul acela il modifica si il foloseste pe unde vrea. Dar sunt de acord si cu tine
  10. Frumos , stiu ca e asa simplu , dar nu reuseam sa fac ,multumesc.
  11. Salut salbaticilor , as avea nevoie de un tutorial cum sa creem puncte ,stil PremiumPoints ! Multumesc ;
  12. Sau o modalitate m-ai simpla daca vrei sa acorzi puncte , sau alte lucruri.
  13. Din cate vad in Message-ul tau , doresti sa dai bani , oricum , ai modelul cu format inclus Pasul 1 : Folosim .inc-urile de chttps://www.webpagefx.com/web-design/color-picker/are avem nevoie #include <zcmd> // Y_Less [download zcmd |click| ]#include <sscanf2> // [download sscanf2 |click|] Pasul 2: Creem un stock prin care generam numele playerului ce foloseste comanda. stock GetName(playerid) { new name[24]; GetPlayerName(playerid, name, sizeof(name)); strreplace(name, '_', ' '); return name; } Pasul 3 : Creem comnda CMD:givemoney(playerid, params[]) { if(IsPlayerAdmin(playerid)) / /verificam daca playerul respectiv este conectat cu Rcon , adica daca este admin { new string[128], targetid, money; //string se v-a numii formatul pe care tu il doresti. if(sscanf(params, "ud", targetid, money)) return SendClientMessage(playerid, CULOAREA DORITA [click], "USAGE: /givemoney [playerid] [money]");//in caz ca ,comanda este tastata incomplet , player-ului respectiv ii v-a aparea exemplul if(IsPlayerConnected(targetid)) // verificam daca player-ul este conectat { GivePlayerMoney(targetid, money); // Comanda pentru a da bani. tragetid este suma introduse de catre player format(string, sizeof(string), "*I-ai acrodat lui %s suma de %d$",GetName(targetid),money); //creem formatul pe care il v-omm trimite playerului ce foloseste comanda daca comanda a fost reusita SendClientMessage(playerid, CULOAREA DORITA [click], string); } } else { SendClientMessage(playerid, -1, "Nu esti autorizat sa folosesti aceasta comanda"); // in caz ca playerul nu este admin ,v-a primii acest mesaj } return 1; } Format-ul de care ai nevoie tu este : new string[128]; format(string, sizeof(string), "*I-ai acrodat lui %s suma de %d$",GetName(targetid),money); //creem formatul pe care il v-omm trimite playerului ce foloseste comanda daca comanda a fost reusita SendClientMessage(playerid, CULOAREA DORITA [click], string); Nu doresc HATE , sunt incepator si ajut si eu pe altii asa cum stiu.
  14. Parerea mea : odata e edy a facut acel tutorial , invatati de acolo , ci nu dati copy-paste apoi sa veniti cu niste erorii chiar simple , poti da copy-paste de 1000 de ori si tot nu inveti , nu ramai cu nimic.
  15. [!] Info : Baza de date nu este conectata bine , m-ai verifica odata
  16. Foarte frumos , o sa-l folosesc , nu uit sa pun creditele
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.