SA-MP Forums Archive
Tag Mismatch - 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: Tag Mismatch (/showthread.php?tid=576572)



Tag Mismatch - nezo2001 - 05.06.2015

As the title says
on line 3
PHP код:
                    new pass[128];
                    
format(pass,sizeof(pass),"SELECT pPass FROM users WHERE pName = '%s'",PlayerName(playerid));
                    new 
pass2 mysql_query(1pass);
                    
PlayerInfo[playerid][pPass] = pass2



Re: Tag Mismatch - Konstantinos - 05.06.2015

Having non-threaded queries with R33+ would be something like the code below and if I understand correctly, your variable pPass is an integer?
PHP код:
new pass[128];
mysql_format(1pass,sizeof(pass),"SELECT pPass FROM users WHERE pName = '%e'"PlayerName(playerid));
new 
Cache:result mysql_query(1passtrue);
if (
cache_get_row_count()) PlayerInfo[playerid][pPass] = cache_get_row_int(00);
cache_delete(result); 
Though using threaded queries and a variable (global) for the connection handle is recommended.


Re: Tag Mismatch - nezo2001 - 05.06.2015

Yes it is because when I hash it the strings change into integers


Re: Tag Mismatch - Konstantinos - 05.06.2015

What do you mean the strings change into integers? It wouldn't do that if pPass has size of 129 in the enum, saving/loading the password as a string and in the table structure the type of the field for the password to be VARCHAR or CHAR.


Re: Tag Mismatch - nezo2001 - 05.06.2015

See:

The password hashed and changed into integer

Edit: the field is text not integer


Re: Tag Mismatch - dusk - 05.06.2015

In that case use cache_get_row instead of cache_get_row_int.


Re: Tag Mismatch - nezo2001 - 05.06.2015

Ok but I don't understand what he did ?!


Re: Tag Mismatch - Konstantinos - 05.06.2015

I used mysql_format so we can escape strings using %e specifier (normally you'd use %s).
It executes the query (non-threaded) and cache is set to true so you can use the cache functions.
If there are rows, retrieve the data and assign them to the variable.
The last I suppose is like freeing the result.

I haven't used non-threaded for R33+ but I believe it's correct.

---

About the password, change the type to VARCHAR and length 129 in the table structure. Make sure that pPass has a size of 129 in your enum.
When registering and inserting the password, hash it (the size must be 129 in WP_Hash too) and insert it as a string.
When loading as dusk said, you need to use cache_get_row but as it's enum-array, you have to specify the length.
pawn Код:
cache_get_row(0, 0, PlayerInfo[playerid][pPass], 1, 129);



Re: Tag Mismatch - nezo2001 - 05.06.2015

You are amazing, Thank You again


Re: Tag Mismatch - nezo2001 - 05.06.2015

But it did't work, The value which recovered from the database is
""
So I login with "" not my password
and same for money, admin level, et...........