What does sscanf query values means?
#1

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]);
Reply
#2

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).
Reply
#3

ok, Thank you for this help.
Reply
#4

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...
Reply
#5

[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.
Reply
#6

thank u zeus. you helped me in the main part of my gamemode. +2reps.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)