Jump to content

Question

Posted (edited)
CMD:setpin(playerid, params[]) {
	if(playerVariables[playerid][pPin] != 0) return SCM(playerid, COLOR_LIGHTGREEN3, "Ai deja un pin setat!\nFoloseste comanda [/pin] pentru a te loga!");
	ShowPlayerDialogEx(playerid, DIALOG_SETPIN, DIALOG_STYLE_INPUT, "Set Pin", "Seteza-ti pinul!\nPinul trebuie sa contina 4 numere!", "Ok", "Exit");
	return 1;
}
CMD:pin(playerid, params[]) {
	if(playerVariables[playerid][pPinLogged] == 1) return SCM(playerid, COLOR_LIGHTGREEN3, "Deja te-ai logat cu pin-ul tau!");
	if(playerVariables[playerid][pPin] == 0) return SCM(playerid, COLOR_LIGHTGREEN3, "Nu ai un pin setat!\nFoloseste comanda [/setpin] pentru ati seta unul!");
	ShowPlayerDialogEx(playerid, DIALOG_PIN, DIALOG_STYLE_INPUT, " Login Pin", "Conecteaza-te cu pinul setat de tine!", "Ok", "Exit");
	return 1;
}
CMD:changepin(playerid, params[]) {
	if(playerVariables[playerid][pPin] == 0) return SCM(playerid, COLOR_LIGHTGREEN3, "Nu ai un pin setat!\nFoloseste comanda [/setpin] pentru ati seta unul!");
	if(playerVariables[playerid][pPinLogged] == 0) return SCM(playerid, COLOR_LIGHTGREEN3, "Pentru ati schimba pinul trebuie sa fi logat cu el!");
	ShowPlayerDialogEx(playerid, DIALOG_CHANGEPIN, DIALOG_STYLE_INPUT, " Change Pin", "Conecteaza-te cu pinul setat de tine!", "Ok", "Exit");
	return 1;
}
        switch(dialogid) {
		case DIALOG_SETPIN: {
			if(!response) return 1;
			if(!IsNumeric(inputtext)) return SCM(playerid, COLOR_LIGHTGREEN3, "Pinul trebuie sa contina doar numere!");
			if(strlen(inputtext) > 4) return SCM(playerid, COLOR_LIGHTGREEN3, "Pinul trebuie sa fie format din 4 numere!");
			if(strlen(inputtext) < 4) return SCM(playerid, COLOR_LIGHTGREEN3, "Pinul trebuie sa fie format din 4 numere!");
			new pin = strval(inputtext);
			playerVariables[playerid][pPin] = pin;
			playerVariables[playerid][pPinLogged] = 1;
			format(string, sizeof(string), "Pinul tau este %d!", pin);
			SCM(playerid, COLOR_ORANGE, string);
			new query[180];
			format(query, sizeof(query), "UPDATE `users` SET `Pin'='%s' WHERE `ID`='%d'", pin, playerVariables[playerid][pSQLID]);
			mysql_query(SQL, query);
		}
		case DIALOG_PIN: {
			if(!response) return 1;
			new pin = strval(inputtext);
			if(playerVariables[playerid][pPin] != pin) return SCM(playerid, COLOR_RED, "Pin-ul introdus este Invalid!");
			playerVariables[playerid][pPinLogged] = 1;
			SCM(playerid, COLOR_YELLOW, "Te-ai logat cu succes cu pin-ul setat de tine!");
		}
		case DIALOG_CHANGEPIN: {
			if(!response) return 1;
			new pin = strval(inputtext);
			if(playerVariables[playerid][pPin] != pin) return SCM(playerid, COLOR_RED, "Pin-ul introdus este Invalid!");
			ShowPlayerDialogEx(playerid, DIALOG_CHANGEPIN+1, DIALOG_STYLE_INPUT, "New Pin", "Seteaza-ti noul tau pin!", "Ok", "Exit");		
		}
		case DIALOG_CHANGEPIN+1: {
			if(!response) return 1;
			new pin = strval(inputtext);
			playerVariables[playerid][pPin] = pin;
			format(string, sizeof(string), "Noul tau pin este %d!", pin);
			SCM(playerid, COLOR_ORANGE, string);
			new query[180];
			format(query, sizeof(query), "UPDATE `users` SET `Pin`='%s' WHERE `ID`='%d'", pin, playerVariables[playerid][pSQLID]);
			mysql_query(SQL, query);
		}	
	}

Cand scriu /setpin imi aleg pin-ul dar nu mi se pune in baza de date..

Ce as putea face?

 

Edited by Alexandru Alex

13 answers to this question

Recommended Posts

  • 0
Posted (edited)

E scris gresit in query-ul de la DIALOG_SETPIN.
Inlocuieste: 

`Pin'='%s'

cu 

`Pin` = %i

Si la DIALOG_CHANGEPIN+1 inlocuieste la fel!

Edited by Akan
  • Haha 1

Discord:
! Akan !#6675

  • 0
Posted
50 minutes ago, Akan said:

E scris gresit in query-ul de la DIALOG_SETPIN.
Inlocuieste: 


`Pin'='%s'

cu 


`Pin`='%i'

Si la DIALOG_CHANGEPIN+1 inlocuieste la fel!

Nu merge :/

  • 0
Posted (edited)

Pune asa 

`Pin` = %i

 

Edited by Akan

Discord:
! Akan !#6675

  • 0
Posted

Poti sa ne spui ce tip de data este definit pentru pin in baza de date?

Deasemenea verifica mysql log si vezi daca sunt erori

  • 0
Posted
49 minutes ago, Banditul said:

Poti sa ne spui ce tip de data este definit pentru pin in baza de date?

Deasemenea verifica mysql log si vezi daca sunt erori

[22:29:19 05/01/20] [ERROR] CMySQLQuery::Execute - (error #1054) Unknown column '5' in 'where clause' (Query: "UPDATE `users` SET `Pin` = `8` WHERE `id` = `5`")
[18:31:09 05/02/20] [ERROR] CMySQLQuery::Execute - (error #1054) Unknown column '4' in 'where clause' (Query: "UPDATE `users` SET `Pin` = `{` WHERE `id` = `4`")
[22:55:30 05/02/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 'ID`='4'' at line 1 (Query: "UPDATE `users` SET `Pin'='8' WHERE `ID`='4'")
[22:58:32 05/02/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 'ID`='4'' at line 1 (Query: "UPDATE `users` SET `Pin'='8' WHERE `ID`='4'")
[00:16:53 05/03/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 'ID`='4'' at line 1 (Query: "UPDATE `users` SET `Pin'='2104' WHERE `ID`='4'")
[00:19:22 05/03/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 'ID`='2104'' at line 1 (Query: "UPDATE `users` SET `Pin'='e' WHERE `ID`='2104'")
[00:37:39 05/03/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 'ID`='4'' at line 1 (Query: "UPDATE `users` SET `Pin'='8' WHERE `ID`='4'")
[00:43:05 05/03/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 'ID`='4'' at line 1 (Query: "UPDATE `users` SET `Pin'='8' WHERE `ID`='4'")
[00:46:07 05/03/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 'ID`='4'' at line 1 (Query: "UPDATE `users` SET `Pin'='8' WHERE `ID`='4'")
[00:48:15 05/03/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 'ID`='4'' at line 1 (Query: "UPDATE `users` SET `Pin'='8' WHERE `ID`='4'")
[00:49:56 05/03/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 'ID`='4'' at line 1 (Query: "UPDATE `users` SET `Pin'='8' WHERE `ID`='4'")
[00:51:44 05/03/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 'ID`='4'' at line 1 (Query: "UPDATE `users` SET `Pin'='8' WHERE `ID`='4'")
[00:59:55 05/03/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 'ID`='4'' at line 1 (Query: "UPDATE `users` SET `Pin'='2104' WHERE `ID`='4'")
[01:17:37 05/03/20] [WARNING] cache_get_row_count - no active cache
[01:18:02 05/03/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 'ID`='6'' at line 1 (Query: "UPDATE `users` SET `Pin'='2104' WHERE `ID`='6'")
[01:32:25 05/03/20] [WARNING] cache_get_row_count - no active cache
[12:23:13 05/03/20] [WARNING] cache_get_row_count - no active cache
[12:23:28 05/03/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 'ID`='8'' at line 1 (Query: "UPDATE `users` SET `Pin'='2104' WHERE `ID`='8'")
[13:36:37 05/03/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 'ID`='8'' at line 1 (Query: "UPDATE `users` SET `Pin'='2104' WHERE `ID`='8'")
[13:43:20 05/03/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 'ID`='8'' at line 1 (Query: "UPDATE `users` SET `Pin'='2104' WHERE `ID`='8'")
[13:49:10 05/03/20] [WARNING] cache_get_row_count - no active cache
[13:49:25 05/03/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 'ID`='9'' at line 1 (Query: "UPDATE `users` SET `Pin'='1234' WHERE `ID`='9'")
[13:53:03 05/03/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 'ID`='9'' at line 1 (Query: "UPDATE `users` SET `Pin'='2103' WHERE `ID`='9'")
[13:56:28 05/03/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 'ID`='9'' at line 1 (Query: "UPDATE `users` SET `Pin'='2103' WHERE `ID`='9'")

 

Mysql_log

 

iar in baza de date am

Pin int(10)     No None
  • 0
Posted (edited)
format(query, sizeof(query), "UPDATE users SET Pin = %i WHERE `ID` = %i", pin, playerVariables[playerid][pSQLID]);

Pune direct asa in locul acelui query al tau de la dialog_setpin.

 

Din mysql_log pe care l-ai trimis se vede ca nu ai inlocuit cum ti-am zis...
`Pin' - asta e gresit, ai ` inainte de Pin si ' dupa Pin ... 2 semne de punctuatie diferite... sterge-le pe amandoua, pune cum ti-am scris eu mai sus codul ca nu sunt necesare semnele de punctuatie in cazul de fata!

Edited by Akan
  • Upvote 1

Discord:
! Akan !#6675

  • 0
Posted
20 minutes ago, Akan said:

format(query, sizeof(query), "UPDATE users SET Pin = %i WHERE `ID` = %i", pin, playerVariables[playerid][pSQLID]);

Pune direct asa in locul acelui query al tau de la dialog_setpin.

 

Din mysql_log pe care l-ai trimis se vede ca nu ai inlocuit cum ti-am zis...
`Pin' - asta e gresit, ai ` inainte de Pin si ' dupa Pin ... 2 semne de punctuatie diferite... sterge-le pe amandoua, pune cum ti-am scris eu mai sus codul ca nu sunt necesare semnele de punctuatie in cazul de fata!

sper sa fie cum zictu, acum compilez si verific

 

  • 0
Posted
22 minutes ago, Akan said:

format(query, sizeof(query), "UPDATE users SET Pin = %i WHERE `ID` = %i", pin, playerVariables[playerid][pSQLID]);

Pune direct asa in locul acelui query al tau de la dialog_setpin.

 

Din mysql_log pe care l-ai trimis se vede ca nu ai inlocuit cum ti-am zis...
`Pin' - asta e gresit, ai ` inainte de Pin si ' dupa Pin ... 2 semne de punctuatie diferite... sterge-le pe amandoua, pune cum ti-am scris eu mai sus codul ca nu sunt necesare semnele de punctuatie in cazul de fata!

+1 RESPECT, mersi mult ❤️

  • 0
Posted
Acum 2 minute, Alexandru Alex a spus:

+1 RESPECT, mersi mult ❤️

Cu multa placere! :) Vezi sa inlocuiesti la fel si la  DIALOG_CHANGEPIN+1  ca sa functioneze si cand iti schimbi PIN-ul. :) Bafta!

Discord:
! Akan !#6675

  • 0
Posted
1 minute ago, Akan said:

Cu multa placere! :) Vezi sa inlocuiesti la fel si la  DIALOG_CHANGEPIN+1  ca sa functioneze si cand iti schimbi PIN-ul. :) Bafta!

Am facut asta deja :), inca odata multumeac frumos ;)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.