SetPlayerPos problem(float)
#1

I have command that checks position in MYSQL DB.

pawn Код:
COMMAND:test(playerid, params[]) //
{
    new string[64];
    format(string,sizeof(string),"X: %f , Y:%f, Z:%f",GetPVarFloat(playerid,"xpos"),    GetPVarFloat(playerid,"ypos"), GetPVarFloat(playerid,"zpos"));
    SendClientMessage(playerid,0xFFFFFFAA,string);
    return 1;
}
And dialog response where it sets PVar:

pawn Код:
new data2[12],data[8][50];
new Float:x,Float:y,Float:z;
sscanf(line, "p|ssddddfdfffssddd", data[0], data[1], data2[0], data2[1], data2[2], data2[3], data2[8],data2[4],x,y,z,data[4],data[5],data2[9],data2[10],data2[11]);

SetPVarFloat(playerid,"xpos",x); // Save the float into a player variable
SetPVarFloat(playerid,"ypos",y); // Save the float into a player variable
SetPVarFloat(playerid,"zpos",z); // Save the float into a player variable
Every thing works perfect except coordinates. Command /test returns 0.00000 0.00000 0.000000


Any suggestions how to get coordinates?
Reply
#2

pawn Код:
sscanf(line, "p|ssddddfdfffssddd", data[0], data[1], data2[0], data2[1], data2[2], data2[3], data2[8],data2[4],x,y,z,data[4],data[5],data2[9],data2[10],data2[11]);
Try this

float shouldnt be "f" in sscanf?
I see you're using old version of sscanf, in new version you need to put f for floats, i dont know about old version
Reply
#3

I updated post, renewed sscanf to newest and still won't work. Any suggestions ?
Reply
#4

Код:
sscanf(line, "p<|>ssddddfdfffssddd", data[0], data[1], data2[0], data2[1], data2[2], data2[3], data2[8],data2[4],x,y,z,data[4],data[5],data2[9],data2[10],data2[11]);
and to seperate strings you will need like

Код:
new string1[9], string2[10];
sscanf(line, "p<|>s[9]s[10]", string1, string2);
Reply
#5

I can't get what du you mean by this:

Quote:

and to seperate strings you will need like

Code:
new string1[9], string2[10];
sscanf(line, "p<|>s[9]s[10]", string1, string2);

in log it shows : 131.36|-73.1422|1.42969| .

So that's what i need . But it won't work with /test command or when i use it in SetPlayerPos
Reply
#6

anyone?
Reply
#7

Fixed :P
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)