Problem with pos loading. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with pos loading. (
/showthread.php?tid=257409)
Problem with pos loading. -
Vvolk - 25.05.2011
I have a epic problem with pos loading. Then player disconnect his pos saves to mysql DB fine, but then player login, pos doesn't load. There is my code: if player write correct password then all of his stats loading ,but there I don't write it all stats only pos, because only it don't work:
Код:
new vardas[128],query[256];
new Float:pos1,Float:pos2,Float:pos3;
GetPlayerName(playerid,vardas,128);
if(IsPlayerConnected(playerid))
{
MySQLCheck();
if(mysql_num_rows() == 1)
{
format(query,sizeof(query),"SELECT PozicijaX FROM `"TABLENAME"` WHERE Vardas = '%s' AND Slaptazodis = md5('%s') LIMIT 1",vardas,inputtext);
mysql_query(query);
mysql_store_result();
pos1 = mysql_fetch_int();
mysql_free_result();
format(query,sizeof(query),"SELECT PozicijaY FROM `"TABLENAME"` WHERE Vardas = '%s' AND Slaptazodis = md5('%s') LIMIT 1",vardas,inputtext);
mysql_query(query);
mysql_store_result();
pos2 = mysql_fetch_int();
mysql_free_result();
format(query,sizeof(query),"SELECT PozicijaZ FROM `"TABLENAME"` WHERE Vardas = '%s' AND Slaptazodis = md5('%s') LIMIT 1",vardas,inputtext);
mysql_query(query);
mysql_store_result();
pos3 = mysql_fetch_int();
mysql_free_result();
SetPlayerPos(playerid,pos1,pos2,pos3);
Everything allright and no errors here, because I don't write here all my code only important part
![Cheesy](images/smilies/biggrin.png)
. Please correct it to fine code which can load player pos
*Vardas = Name ; Slaptazodis = Password; Pozicija = Position; It is translate from my language.
Re: Problem with pos loading. -
Mean - 25.05.2011
You aren't using SetPlayerPos to load it, you're just executing the query, it's like clicking on a file and closing it right away and doing nothing in it.
Re: Problem with pos loading. -
Vvolk - 26.05.2011
But with money and xp and adminlevel I do it like with pos. And money and xp is loading for me. What I need to do correct this problem with pos loading
![Huh?](images/smilies/confused.gif)
?
Re: Problem with pos loading. -
Raimis_R - 26.05.2011
Poz its not Integer. Player position its float
Re: Problem with pos loading. -
Vvolk - 26.05.2011
I know that but What I need to do
Re: Problem with pos loading. -
Raimis_R - 26.05.2011
Use
Re: Problem with pos loading. -
Vvolk - 26.05.2011
But how I need to use it?
Re: Problem with pos loading. -
Vvolk - 27.05.2011
But how I need to use this function
![Huh?](images/smilies/confused.gif)
Please help anybody...
Re: Problem with pos loading. -
StUNt71 - 27.05.2011
mysql_fetch_int();
change:
mysql_fetch_float();
Re: Problem with pos loading. -
Vvolk - 27.05.2011
I do it like this code:
Код:
PosY = mysql_fetch_float();
I defined it.... But there is error: number of arguments does not match definition...
What I need to do?