How Do You save Player Postion With Y_INI?
#1

Well, I can't find a tutorials any where, there's one, but it doesn't work, could someone help?
Reply
#2

What's wrong with ******?
[Image: ******.png]
Reply
#3

Yes, I tried that tutorial, and it saved etc. and it did nothing.
Reply
#4

Top of your script:
pawn Код:
new
    Float: PosX[MAX_PLAYERS],
    Float: PosY[MAX_PLAYERS],
    Float: PosZ[MAX_PLAYERS],
    Float: Angle[MAX_PLAYERS]
Under OnPlayerDisconnect:
pawn Код:
GetPlayerPos(playerid,PosX[playerid],PosY[playerid],PosZ[playerid]);
    GetPlayerFacingAngle(playerid,Angle[playerid]);
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteFloat(File,"PositionX",PosX[playerid]);
    INI_WriteFloat(File,"PositionY",PosY[playerid]);
    INI_WriteFloat(File,"PositionZ",PosZ[playerid]);
    INI_WriteFloat(File,"Angle",Angle[playerid]);
    INI_Close(File);
Under OnPlayerSpawn:
pawn Код:
if(PosX[playerid] !=0 && PosY[playerid] !=0 && PosZ[playerid] !=0 && Angle[playerid] != 0)
    {
        SetPlayerPos(playerid,PosX[playerid],PosY[playerid],PosZ[playerid]);
        SetPlayerFacingAngle(playerid,Angle[playerid]);
    }
Under your Login System:
pawn Код:
SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin],PosX[playerid],PosY[playerid],PosZ[playerid],Angle[playerid], 0, 0, 0, 0, 0, 0);
                    SpawnPlayer(playerid);
Under your load function:
pawn Код:
INI_Float("PositionX",PosX[playerid]);
    INI_Float("PositionY",PosY[playerid]);
    INI_Float("PositionZ",PosZ[playerid]);
    INI_Float("Angle",Angle[playerid]);
This is how it works for me.
Reply
#5

This is a newb question, but Load Function? where is that?
Reply
#6

Quote:
Originally Posted by Mike97300
Посмотреть сообщение
This is a newb question, but Load Function? where is that?
Under this function.

public LoadUser_data(playerid,name[],value[])
Reply
#7

I'm getting these errors now.

pawn Код:
C:\Users\GTW\BaseNorton V2\gamemodes\Gamemode.pwn(143) : error 001: expected token: ";", but found "-identifier-"
Line 143

pawn Код:
main() { }
Reply
#8

Where is Main() placed? Plus, I honestly have no idea what that is, or what it does. Seems pretty useless.
Reply
#9

It's here

pawn Код:
//-----[Enum Playerinfo]-----
enum pInfo
{
    Password,
    Cash,
    Kills,
    Deaths,
    Adminlevel,
    Pskin,
}

new PlayerInfo[MAX_PLAYERS][pInfo];
new QuizAnswers[MAX_PLAYERS];



new LSPDLeader[MAX_PLAYERS];
new LSPDMember[MAX_PLAYERS];

new Float: PosX[MAX_PLAYERS],
    Float: PosY[MAX_PLAYERS],
    Float: PosZ[MAX_PLAYERS],
    Float: Angle[MAX_PLAYERS]
   
main() { }

public OnGameModeInit()
{
    Create3DTextLabel("24/7", COLOR_RED, 1833.4626,-1841.8864,13.5781, 40.0, 0, 0);
    AddStaticPickup(1318, 1, 240.5396,117.6052,1003.2257, -1);//lspd door
    AddStaticPickup(1318, 1, 252.1050,109.2321,1003.2188, -1);//lspd door
Reply
#10

Never mind, it was fixed, the last line wasn't ended -.-
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)