Y_Ini Position
#1

Код:
C:\Users\Scripting.Ash-PC\Desktop\Roleplay\gamemodes\roleplay.pwn(111) : warning 202: number of arguments does not match definition
C:\Users\Scripting.Ash-PC\Desktop\Roleplay\gamemodes\roleplay.pwn(111) : warning 202: number of arguments does not match definition
C:\Users\Scripting.Ash-PC\Desktop\Roleplay\gamemodes\roleplay.pwn(111) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Warnings.
Trying to get it to save my Position..
My PlayerInfo enum
pawn Код:
enum pInfo
{
    pPass[129],
    pCash,
    pPos,
    pAdmin,
    pKills,
    pDeaths
}
Added pPos, There..

Then my OnPlayerDisconnect

pawn Код:
new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"PlayerData");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Pos",GetPlayerPos(playerid));
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Close(File);
    return 1;
}
Added INI_WriteInt(File,"Pos",GetPlayerPos(playerid));

.. I get the Warnings shown above.. Anyone know how to fix? Thanks
Reply
#2

For positions, you need 3 floats. One for x, y, and z coordinates.
pawn Код:
{
    new
        INI:File = INI_Open(UserPath(playerid)),
        Float:x,
        Float:y,
        Float:z;

    GetPlayerPos(playerid, x, y, z);

    INI_SetTag(File,"PlayerData");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteFloat(File, "X", x);
    INI_WriteFloat(File, "Y", y);
    INI_WriteFloat(File, "Z", z)
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Close(File);
    return 1;
}
Reply
#3

Quote:
Originally Posted by VincentDunn
Посмотреть сообщение
For positions, you need 3 floats. One for x, y, and z coordinates.
pawn Код:
{
    new
        INI:File = INI_Open(UserPath(playerid)),
        Float:x,
        Float:y,
        Float:z;

    GetPlayerPos(playerid, x, y, z);

    INI_SetTag(File,"PlayerData");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteFloat(File, "X", x);
    INI_WriteFloat(File, "Y", y);
    INI_WriteFloat(File, "Z", z)
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Close(File);
    return 1;
}
Im a pretty new scripter, Just before you replied i realised i would need to store the Pos in a variable so i added the variable floats but in a wrong idea, But then you posted so i saw my error, So i thank you very much i learnt a lot in the last 2 minutes Rep+
Reply
#4

Now only one more error, I tried to make the script load my position on login..

pawn Код:
SetPlayerPos(playerid,PlayerInfo[playerid],x,y,z);
Код:
C:\Users\Scripting.Ash-PC\Desktop\Roleplay\gamemodes\roleplay.pwn(337) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#5

How are you loading the floats on login?

The syntax for SetPlayerPos is

playerid, x, y, z
Reply
#6

Quote:
Originally Posted by VincentDunn
Посмотреть сообщение
How are you loading the floats on login?

The syntax for SetPlayerPos is

playerid, x, y, z
I then used, SetPlayerPos(playerid,x,y,z);
But the float variable i set was a local so i will need to now make it a global, Right?
Reply
#7

Change your enum to
pawn Код:
enum pInfo
{
    pPass[129],
    pCash,
    Float:pPos[3],
    pAdmin,
    pKills,
    pDeaths
}
Then on your .ini load function or w/e, do
pawn Код:
INI_Float("X", PlayerInfo[playerid][pPos][0]);
INI_Float("Y", PlayerInfo[playerid][pPos][1]);
INI_Float("Z", PlayerInfo[playerid][pPos][2]);
Since it is already global, you can use it anywhere in your script.

PlayerInfo[playerid][pPos][0] = x position
PlayerInfo[playerid][pPos][1] = y position
PlayerInfo[playerid][pPos][2] = z position

So then, you can do

Код:
SetPlayerPos(playerid, PlayerInfo[playerid][pPos][0], PlayerInfo[playerid][pPos][1], PlayerInfo[playerid][pPos][2]);
Reply
#8

Thanks man, I got one problem though..

Its making me spawn at the first spawn coordinates

pawn Код:
AddPlayerClass(79,-51.0108,2647.7188,63.8999,88.4150,0,0,0,0,0,0);
Is in my OnGameModeInit function
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)