SA-MP Forums Archive
What does sscanf query values means? - 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: What does sscanf query values means? (/showthread.php?tid=450008)



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.