What does sscanf query values means? -
Champ - 11.07.2013
I have this in my onplayerconnect. I want to know what is this and how we can change it when we want to add another feature on register system like kills deaths and
played.
sscanf(Query, "p<|>{s[24]s[129]s[16]}a<i>[5]", values);
SetPVarInt(playerid, "Admin", values[0]);
GivePlayerMoney(playerid, values[1]);
SetPlayerScore(playerid, values[2]);
SetPVarInt(playerid, "Kills", values[3]);
SetPVarInt(playerid, "Deaths", values[4]);
Re: What does sscanf query values means? -
Konstantinos - 11.07.2013
The Query is for example:
pawn Код:
"Champ|dkjasldkadsajidsa...blablabla..jhadha|127.0.0.1|4|5|6|0|1".
Using { } is not recommended, because they're not saved. The rest is an array and the 5 last numbers will be assingned to the array (5).
Re: What does sscanf query values means? -
Champ - 11.07.2013
ok, Thank you for this help.
Re: What does sscanf query values means? -
Champ - 11.07.2013
But i have another problem Zeus. When i add a feature like played it works perfectly when players leave but when it joines it's value turns to 0.
sscanf(Query, "p<|>{s[24]s[129]s[16]}a<i>[5]", values);
SetPVarInt(playerid, "Admin", values[0]);
GivePlayerMoney(playerid, values[1]);
SetPlayerScore(playerid, values[2]);
SetPVarInt(playerid, "Kills", values[3]);
SetPVarInt(playerid, "Deaths", values[4]);
SetPVarInt(playerid, "Played", values[5]);
The value 5 could not work perfectly. Help plzzz...
Re: What does sscanf query values means? -
Konstantinos - 11.07.2013
[5] means 0-4
Add instead:
pawn Код:
new
values[ 6 ]
;
sscanf(Query, "p<|>{s[24]s[129]s[16]}a<i>[6]", values);
SetPVarInt(playerid, "Admin", values[0]);
GivePlayerMoney(playerid, values[1]);
SetPlayerScore(playerid, values[2]);
SetPVarInt(playerid, "Kills", values[3]);
SetPVarInt(playerid, "Deaths", values[4]);
SetPVarInt(playerid, "Played", values[5]);
for 0-5.
Re: What does sscanf query values means? -
Champ - 11.07.2013
thank u zeus. you helped me in the main part of my gamemode. +2reps.