SA-MP Forums Archive
Mysql problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Mysql problem (/showthread.php?tid=618008)



Mysql problem - AndreiWow - 29.09.2016

Код:
if(playertextid == GreenButton) {
		if(strlen(InputtText[playerid]) < 4) return 1;
		if(strlen(PlayerInfo[playerid][pPin]) == 1) {
			format(PlayerInfo[playerid][pPin], 5, InputtText[playerid]);
			format(szQuery, sizeof(szQuery), "UPDATE `users` SET `Pin`='%s' WHERE `Name`='%s'", PlayerInfo[playerid][pPin], PlayerInfo[playerid][pNormalName]);
			mysql_query(SQL, szQuery);
			SendClientMessage(playerid, -1, "{FFFF45}Ai setat codul de securitate al contului.");
		}
Why is this not working? The Pin is not saving.

The table is not made by me, I searched 'Pin' in the users mysql table and there is no field for that, how can I add one for all new users that register.. didn't really work with mysql until today.

I also found this and I am not sure what is it
Код:
PlayerInfo[playerid][pPin] = cache_get_field_content(0, "Pin", string);



Re: Mysql problem - Vince - 29.09.2016

You're checking if the length is exactly 1 while it should presumably be 4 or greater. In that case the second strlen if-statement is completely redundant because if the length is not less than 4 then it is obviously 4 or greater.


Re: Mysql problem - AndreiWow - 29.09.2016

So this should be like this?:

if(strlen(PlayerInfo[playerid][pPin]) >= 1)


the pin can only be of 4 so it cant be higher or lower.


Re: Mysql problem - AndreiWow - 29.09.2016

Uh I set it as == 4 and the whole system bugged, if I use the command now it sets a new pin instead of asking me to type my pin to log in.

I really don't understand whats the problem..


Re: Mysql problem - AndreiWow - 30.09.2016

bump, anyone please?