[NEED HELP]Saving Players Pos into file!
#1

I want to make a /savepostofile cmd but i got much of warnings and errors
pawn Код:
if (strcmp(cmdtext, "/savepostofile", true)==0)
    {
           new string[128];
        new Float:X, Float:Z, Float:Y, Float:Rotation; // this is line 666
        GetPlayerPos(playerid, X, Y, Z); // this is line 667
        GetPlayerFacingAngle(playerid, Rotation);
        new File:pos=fopen("Server/Save/onfoot", io_append);
        format(string, 256, "AddPlayerClass(0, %f, %f, %f, %f, 0,0,0,0,0,0);", X, Y, Z,Rotation); //this is line 670
        fwrite(pos, string);
        fclose(pos);
        return 1;
    }
but i have theese errors:
Код:
\SASF.pwn(666) : warning 219: local variable "X" shadows a variable at a preceding level
(666) : warning 219: local variable "Z" shadows a variable at a preceding level
(666) : warning 219: local variable "Y" shadows a variable at a preceding level
(667) : error 035: argument type mismatch (argument 2)
(670) : warning 213: tag mismatch
(670) : warning 213: tag mismatch
(670) : warning 213: tag mismatch
(666) : warning 203: symbol is never used: "Y"
(666) : warning 203: symbol is never used: "Z"
(666) : warning 203: symbol is never used: "X"
thx for helping
Reply
#2

why u not use /save [comment] command? xD much better you get savepos into documents gtasa samp ...
Reply
#3

Try with small letters.

pawn Код:
if (strcmp(cmdtext, "/savepostofile", true)==0)
{
    new string[128];
    new Float:x, Float:z, Float:y, Float:Rotation;
    GetPlayerPos(playerid, x, y, z);
    GetPlayerFacingAngle(playerid, Rotation);
    new File:pos=fopen("Server/Save/onfoot", io_append);
    format(string, sizeof(string), "AddPlayerClass(0, %f, %f, %f, %f, 0,0,0,0,0,0);", x, y, z,Rotation);
    fwrite(pos, string);
    fclose(pos);
    return 1;
}
Reply
#4

Thanks! it rly worked! no errors and no warnings!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)