Saving position. - 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: Saving position. (
/showthread.php?tid=440638)
Saving position. -
zClaw - 30.05.2013
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.
Re: Saving position. -
Necip - 30.05.2013
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));
Re: Saving position. -
zClaw - 30.05.2013
I already tried this. It will give me the "Invalid number of arguments" error.
Re: Saving position. -
Konstantinos - 30.05.2013
Coordinates are floats, not integers.
You've to use dini_Float and dini_FloatSet and save each parameters (X, Y, Z).
Re: Saving position. -
zClaw - 30.05.2013
Thank you, Zeus.