SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 30/05/2013, 06:11 PM   #1
zClaw
Big Clucker
 
zClaw's Avatar
 
Join Date: Jan 2013
Location: Earth
Posts: 157
Reputation: 12
Default Saving position.

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.
zClaw is offline   Reply With Quote
Old 30/05/2013, 06:19 PM   #2
Necip
Huge Clucker
 
Necip's Avatar
 
Join Date: May 2011
Posts: 334
Reputation: 25
Default Re: Saving position.

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));
__________________


Necip is offline   Reply With Quote
Old 30/05/2013, 06:41 PM   #3
zClaw
Big Clucker
 
zClaw's Avatar
 
Join Date: Jan 2013
Location: Earth
Posts: 157
Reputation: 12
Default Re: Saving position.

I already tried this. It will give me the "Invalid number of arguments" error.
zClaw is offline   Reply With Quote
Old 30/05/2013, 06:47 PM   #4
Konstantinos
Spam Machine
 
Konstantinos's Avatar
 
Join Date: Dec 2011
Posts: 11,827
Reputation: 1401
Default Re: Saving position.

Coordinates are floats, not integers.

You've to use dini_Float and dini_FloatSet and save each parameters (X, Y, Z).
__________________
Life is like riding a bicycle. To keep your balance, you must keep moving.

[Tutorial] How to use SQLite
[FilterScript] Tune System
Konstantinos is offline   Reply With Quote
Old 30/05/2013, 06:50 PM   #5
zClaw
Big Clucker
 
zClaw's Avatar
 
Join Date: Jan 2013
Location: Earth
Posts: 157
Reputation: 12
Default Re: Saving position.

Thank you, Zeus.
zClaw is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[HELP] I need help with a saving position xXTanglesXx Scripting Help 2 26/05/2013 09:09 AM
[HELP] Skin Saving / Position Saving. andershh Help Archive 3 13/07/2010 10:20 AM
Position Saving Sascha Help Archive 2 25/05/2010 11:43 PM
About saving position pierhs Help Archive 18 25/07/2009 12:06 PM
Saving Position Adamrcook Help Archive 5 10/07/2009 03:19 PM


All times are GMT. The time now is 11:04 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.