Saving position.
#1

Hi, I am adjusting my saving system so it also saves my position.

But I am getting this error:

pawn Code:
error 001: expected token: ",", but found ";"
I tried actually everything, but it doesn't seem to work.

Code:

pawn Code:
SetPlayerPos(playerid, dini_Int(file, "Position")-GetPlayerPos(playerid, x, y, z); // Error line.
Rest of the code:

pawn Code:
if (dialogid == 2)
    {
        new name[MAX_PLAYER_NAME], file[256];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);
        if(!response) return Kick(playerid);
        if (!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login Dialog", "You are already registered.\nPlease insert your password.", "Login", "Leave");
        new tmp;
        tmp = dini_Int(file, "Password");
        if(udb_hash(inputtext) != tmp) {
            SendClientMessage(playerid, COLOR_RED, "Wrong password, try again!");
            ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Login Dialog", "Welcome!\nPlease insert your password", "Login", "Exit");
        }
        else
        {
            gPlayerLogged[playerid] = 1;
            PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
            GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid));
            SetPlayerPos(playerid, dini_Int(file, "Position")-GetPlayerPos(playerid, x, y, z);
            SendClientMessage(playerid, COLOR_YELLOW, "You have succesfully logged in!");
        }
    }
Everything else works fine, help would be appreciated.
Reply
#2

You actually start with a "(" and don't close it.Next time watch out every parenthesis.Fixed code:

pawn Code:
SetPlayerPos(playerid, dini_Int(file, "Position")-GetPlayerPos(playerid, x, y, z));
Reply
#3

I already tried this. It will give me the "Invalid number of arguments" error.
Reply
#4

Coordinates are floats, not integers.

You've to use dini_Float and dini_FloatSet and save each parameters (X, Y, Z).
Reply
#5

Thank you, Zeus.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)