Mysql login + PVars system
#1

pawn Код:
mysql_fetch_row_format( line, "|" );
      sscanf        ( line, "p<|>ds[24]s[64]ddddddddddddddddddddddddddfffd",
                          tmpint, // Skipping (id)
                                  string, // Skipping (name)
                                  string, // Skipping (password)
                                  SetPVarInt( playerid, "level", d ),
                                  SetPVarInt( playerid, "admin", d ),
                                  SetPVarInt( playerid, "cash", d ),
                                  SetPVarInt( playerid, "bank", d ),
                                  SetPVarInt( playerid, "fighting", d ),
                                  SetPVarInt( playerid, "playtime", d ),
                                  SetPVarInt( playerid, "done", d ),
                                  SetPVarInt( playerid, "sex", d ),
                                  SetPVarInt( playerid, "age", d ),
                                  SetPVarInt( playerid, "origin", d ),
                                  SetPVarInt( playerid, "deaths", d ),
                                  SetPVarInt( playerid, "kills", d ),
                                  SetPVarInt( playerid, "rank", d ),
                                  SetPVarInt( playerid, "member", d ),
                                  SetPVarInt( playerid, "inv0", d ),
                                  SetPVarInt( playerid, "inv1", d ),
                  SetPVarInt( playerid, "inv2", d ),
                  SetPVarInt( playerid, "inv3", d ),
                  SetPVarInt( playerid, "inv4", d ),
                  SetPVarInt( playerid, "warns", d ),
                  SetPVarInt( playerid, "number", d ),
                  SetPVarInt( playerid, "skin", d ),
                  SetPVarInt( playerid, "driving", d ),
                  SetPVarInt( playerid, "flying", d ),
                  SetPVarInt( playerid, "motoring", d ),
                  SetPVarInt( playerid, "sailing", d ),
                  SetPVarFloat( playerid, "posx", f ),
                  SetPVarFloat( playerid, "posy", f ),
                  SetPVarFloat( playerid, "posz", f ),
                  SetPVarInt( playerid, "radio", d )
Hi, I'm using the code above ^^^, to set players data from mysql one line, example: "My_Name|0|500|300" etc., to PVars, but when i try the script above, i get this error:
pawn Код:
E:\Documents and Settings\Simas\Desktop\SA-MP\erp_kuriama\gamemodes\erp.pwn(1836 -- 1840) : error 017: undefined symbol "d"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
How can I do this guys?
Thanks,
Simas.
Reply
#2

No response for 12 hours ! Bump
Reply
#3

What is "d" do in the script?
Reply
#4

Quote:
Originally Posted by Steven82
What is "d" do in the script?
I'm only trying to do like this, don't really have and idea how to do it.
Reply
#5

If you do it like that a (temporary) variable is necessary to store your MYSQL data in.

Let's say that query you use only returns "level" it would look like the following:

mysql_fetch_row( line);
SetPVarInt( playerid, "level", strvalEx(line) )

Let's say it returns "level" and "admin":

mysql_fetch_row_format( line, "|" );
new level,admin;
sscanf( line, "p<|>dd",level,admin);
SetPVarInt( playerid, "level", level );
SetPVarInt( playerid, "admin", admin);

Obviously this is just to give you an idea what's wrong there.

I am pretty sure you can think of a better workaround than declaring ~20 variables to store your data temporary in before storing that in a PVar .
Reply
#6

Quote:
Originally Posted by theRealG
If you do it like that a (temporary) variable is necessary to store your MYSQL data in.

Let's say that query you use only returns "level" it would look like the following:

mysql_fetch_row( line);
SetPVarInt( playerid, "level", strvalEx(line) )

Let's say it returns "level" and "admin":

mysql_fetch_row_format( line, "|" );
new level,admin;
sscanf( line, "p<|>dd",level,admin);
SetPVarInt( playerid, "level", level );
SetPVarInt( playerid, "admin", admin);

Obviously this is just to give you an idea what's wrong there.

I am pretty sure you can think of a better workaround than declaring ~20 variables to store your data temporary in before storing that in a PVar .
Woah, get it now. Will try to think something more eficient.
If someone has some ideas - don't be shy, post
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)