Jump to content
  • 0

Nu functioneaza sistemul de PIN


Nasti

Question

Problema intalnita (descriere): Am creat un sistem de PIN de la 0 pe dialog. Merge totul bine mersi dar problema este cand selectez sa deblochez contul, pot sa fac asta cu orice pin. De exemplu daca am pin-ul setat: 1234, eu pot sa deblochez contul si cu alte pinuri.
Ero(area / rile) / warning-(ul / urile): Nu am erori
Liniile de cod / sursa / script-ul(obligatoriu): Dialog-ul unde seteaza pin-ul si dialogul unde deblocheaza.
Imagini / Video (optional): Nu am.
Ati incercat sa rezolvati singur?: Da, sa rescriu dialogul dar degeaba.

 

Dialog-ul unde seteaza codul pin:

 

	if(dialogid == DIALOG_SETPIN)
	{
	    new string[128];
	    if(response)
	    {
	        if(!strmid(PlayerInfo[playerid][pPinAccount], inputtext, 0, strlen(inputtext), 999))
	        {
		        strmid(PlayerInfo[playerid][pPinAccount], inputtext, 0, strlen(inputtext), 999);
		        Update(playerid,pPinAccountu);
				format(string,sizeof(string),"Ok, codul tau pin este: %s",inputtext);
				SendClientMessage(playerid,COLOR_YELLOW,string);
			}
			else return SendClientMessage(playerid,COLOR_YELLOW2,"Eroare: Contul tau are deja un cod pin setat.");
	    }
	}

 

Dialog-ul de deblocare:

 

	if(dialogid == DIALOG_UNLOCKPIN)
	{
	    if(response)
	    {
	        if(PlayerInfo[playerid][pLockAccount] == 1) return SendClientMessage(playerid,COLOR_YELLOW2,"Eroare: Tu ai deja contul deblocat.");
	        if(strlen(inputtext) == strmid(PlayerInfo[playerid][pPinAccount], inputtext, 0, strlen(inputtext), 999))
	        {
	            PlayerInfo[playerid][pLockAccount] = 1;
				Update(playerid,pLockAccountu);
				SendClientMessage(playerid,COLOR_YELLOW,"* Ti-ai deblocat contul cu succes.");
        	}
        	else return SendClientMessage(playerid,COLOR_YELLOW2,"Eroare: Ai introdus un cod pin gresit.");
	    }
	}

 

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0
  • 0

Uite, incearca asa:

if(dialogid == DIALOG_UNLOCKPIN)
	{
	    if(response)
	    {
	        if(PlayerInfo[playerid][pLockAccount] == 1) 
					return SendClientMessage(playerid,COLOR_YELLOW2,"Eroare: Tu ai deja contul deblocat.");
			
			new rows, fields;
			cache_get_data(rows, fields, handle);
			
			mysql_format(handle, query, sizeof(query), "SELECT * FROM `acconts` WHERE `Name`='%e' AND `PinAcount`='%d'", GetName(playerid), inputtext);
			mysql_query(handle, query);
			
	        if(rows))
	        {
	            PlayerInfo[playerid][pLockAccount] = 1;
				Update(playerid,pLockAccountu);
				SendClientMessage(playerid,COLOR_YELLOW,"* Ti-ai deblocat contul cu succes.");
        	}
        	else return SendClientMessage(playerid,COLOR_YELLOW2,"Eroare: Ai introdus un cod pin gresit.");
	    }
	}
	
stock GetName( playerid )
{
	new name[MAX_PLAYER_NAME+1];
	GetPlayerName(playerid,name,sizeof(name));
	return name;
}

configurezi ce ti-am dat dupa baza de date a ta...

Link to comment
Share on other sites

  • 0

Pune

if(strlen(inputtext) != PlayerInfo[playerid][pPinAccount]) return SendClientMessage(playerid, -1, "Ai introdus un cod PIN gresit!");

la dialogul UNLOCKPIN

Edited by KnowN

242086.png

Link to comment
Share on other sites

  • 0

Tot imi zice ca e gresit, iti las si dialogul cu setpin ca poate te ajuta.

 

	if(dialogid == DIALOG_SETPIN)
	{
	    new string[128];
	    if(response)
	    {
	        strmid(PlayerInfo[playerid][pPinAccount], inputtext, 0, strlen(inputtext), 999);
	        Update(playerid,pPinAccountu);
			format(string,sizeof(string),"Ok, codul tau pin este: %s",inputtext);
			SendClientMessage(playerid,COLOR_YELLOW,string);
	    }
	}

Ai si poza cum e setat in baza de date.

da.PNG

Link to comment
Share on other sites

  • 0

incearca asa:

if(dialogid == DIALOG_UNLOCKPIN)
	{
		new pin = PlayerInfo[playerid][pPinAccount];
	    if(response)
	    {
	        if(PlayerInfo[playerid][pLockAccount] == 1) 
					return SendClientMessage(playerid,COLOR_YELLOW2,"Eroare: Tu ai deja contul deblocat.");
					
	        if(strlen(inputtext) == pin)
	        {
	            PlayerInfo[playerid][pLockAccount] = 1;
				Update(playerid,pLockAccountu);
				SendClientMessage(playerid,COLOR_YELLOW,"* Ti-ai deblocat contul cu succes.");
        	}
			
        	else return SendClientMessage(playerid,COLOR_YELLOW2,"Eroare: Ai introdus un cod pin gresit.");
	    }
	}

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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.