#1

I maded this code for reading from Querry but i get errors

Код:
new data[3][50]; //The data strings
                   new data2[10]; //The data variables
                   mysql_query("SELECT * FROM `playerinfo`"data[1], data[2], data2[0], data2[1], data2[2], data2[3], data2[4], data2[5]);
                   SetPVarInt(playerid, "Kills", data2[0]); //Sets Pvar ints
                   SetPVarInt(playerid, "Logged", 1); //Sets Pvar ints
                   SetPVarInt(playerid, "Deaths", data2[1]); //Sets Pvar ints
                   SetPlayerScore(playerid, data2[2]); //Sets players score
                   GivePlayerMoney(playerid, data2[3]); //Sets players cash
                   SetPVarInt(playerid, "Admin", data2[4]);
                   SetPVarInt(playerid, "GM", data2[5]);
                   mysql_free_result();
And errors:

Код:
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\//\MojMod.pwn(151) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\//\MojMod.pwn(151) : warning 215: expression has no effect
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\//\MojMod.pwn(151) : warning 215: expression has no effect
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\//\MojMod.pwn(151) : warning 215: expression has no effect
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\//\MojMod.pwn(151) : warning 215: expression has no effect
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\//\MojMod.pwn(151) : warning 215: expression has no effect
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\//\MojMod.pwn(151) : warning 215: expression has no effect
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\//\MojMod.pwn(151) : warning 215: expression has no effect
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\//\MojMod.pwn(151) : warning 215: expression has no effect
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\//\MojMod.pwn(151) : error 001: expected token: ";", but found ")"
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\//\MojMod.pwn(151) : error 029: invalid expression, assumed zero
C:\Users\Sa-Mp\Desktop\BNRP\gamemodes\//\MojMod.pwn(151) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
In the attachment is the database
Reply
#2

https://sampwiki.blast.hk/wiki/MySQL#mysql_query

Check the function's parameters in that example. Then check yours.
Reply
#3

But i dont understand how to read from fucking Querryyyyyyyyyyyyyyyyy
Reply
#4

pawn Код:
new UselessData[129], data2[6], Playername[MAX_PLAYER_NAME],QueryString[100],Line[100];
GetPlayerName(playerid,Playername,sizeof(Playername));
format(QueryString,sizeof(QueryString),"SELECT * FROM `playerinfo` WHERE `user` = '%s'",Playername); // Select the row of the player
mysql_query(QueryString);
mysql_fetch_row(Line); // This gets whole MySQL row
sscanf(Line,"p<|>s[128]s[24]ddddds[24]dd",UselessData,UselessData,data2[0],data2[1],data2[2],data2[3],UselessData,data2[4],data2[5]); // Using SSCANF by ****** to split the line
SetPVarInt(playerid, "Kills", data2[0]); //Sets Pvar ints
SetPVarInt(playerid, "Logged", 1); //Sets Pvar ints
SetPVarInt(playerid, "Deaths", data2[1]); //Sets Pvar ints
SetPlayerScore(playerid, data2[2]); // Set Score
GivePlayerMoney(playerid, data2[3]); // Set Cash
SetPVarInt(playerid, "Admin", data2[4]);
SetPVarInt(playerid, "GM", data2[5]);
mysql_free_result();
Read this properly and compare it to your own script
Reply
#5

Again not working,no errors,data is saving but its not loading on Login
Reply
#6

Bump...
Reply
#7

Helpppppp..............
Reply
#8

Do not bump your topic before 48 hours after last post -.-

Show more code.
Reply
#9

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
pawn Код:
new UselessData[129], data2[6], Playername[MAX_PLAYER_NAME],QueryString[100],Line[100];
GetPlayerName(playerid,Playername,sizeof(Playername));
format(QueryString,sizeof(QueryString),"SELECT * FROM `playerinfo` WHERE `user` = '%s'",Playername); // Select the row of the player
mysql_query(QueryString);
mysql_fetch_row(Line); // This gets whole MySQL row
sscanf(Line,"p<|>s[128]s[24]ddddds[24]dd",UselessData,UselessData,data2[0],data2[1],data2[2],data2[3],UselessData,data2[4],data2[5]); // Using SSCANF by ****** to split the line
SetPVarInt(playerid, "Kills", data2[0]); //Sets Pvar ints
SetPVarInt(playerid, "Logged", 1); //Sets Pvar ints
SetPVarInt(playerid, "Deaths", data2[1]); //Sets Pvar ints
SetPlayerScore(playerid, data2[2]); // Set Score
GivePlayerMoney(playerid, data2[3]); // Set Cash
SetPVarInt(playerid, "Admin", data2[4]);
SetPVarInt(playerid, "GM", data2[5]);
mysql_free_result();
Read this properly and compare it to your own script
Whats the point of UseLess Data?

Код:
SELECT Colum1Name, Coloum2Name,etc FROM `playerinfo` WHERE `user` = '%s'",Playername);
Then there is no need for this extra varible
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)