dini help...
#1

im getting problems with dini cause when player disconnect and come back, they spawn at some on top ls, please help how to save player pos when they connect!!!!!!!
Reply
#2

someone help me already please
Reply
#3

You mean like, when a player disconnects it saves their positon(x,y,z) ? And next time they connect it loads their old position and put them where they were?
Reply
#4

yeeeeppp
Reply
#5

Found this with a little SEARCH:

In you Playerinfo enum:

pawn Код:
Float:pPosX,
Float:pPosY,
Float:pPosZ,
Under your Login Function:

pawn Код:
pInfo[playerid][pPosX] = dini_Float(File, "PosX");
pInfo[playerid][pPosY] = dini_Float(File, "PosY");
pInfo[playerid][pPosZ] = dini_Float(File, "PosZ");

SetSpawnInfo(playerid, 0, pInfo[playerid][pSkin],pInfo[playerid][pPosX],pInfo[playerid][pPosY],pInfo[playerid][pPosZ],0,0,0,0,0,0,0);
SpawnPlayer(playerid);
Under your Data Save Function:

pawn Код:
GetPlayerPos(playerid, pInfo[playerid][pPosX], pInfo[playerid][pPosY], pInfo[playerid][pPosZ]);

dini_FloatSet(File, "PosX", pInfo[playerid][pPosX]);
dini_FloatSet(File, "PosY", pInfo[playerid][pPosY]);
dini_FloatSet(File, "PosZ", pInfo[playerid][pPosZ]);
Hope it helps.
Reply
#6

pawn Код:
D:\Users\Tanush\Desktop\SA-MP\gamemodes\Server.pwn(1069) : warning 202: number of arguments does not match definition
D:\Users\Tanush\Desktop\SA-MP\gamemodes\Server.pwn(1075) : error 028: invalid subscript (not an array or too many subscripts): "pInfo"
D:\Users\Tanush\Desktop\SA-MP\gamemodes\Server.pwn(1075) : warning 215: expression has no effect
D:\Users\Tanush\Desktop\SA-MP\gamemodes\Server.pwn(1075) : error 001: expected token: ";", but found "]"
D:\Users\Tanush\Desktop\SA-MP\gamemodes\Server.pwn(1075) : error 029: invalid expression, assumed zero
D:\Users\Tanush\Desktop\SA-MP\gamemodes\Server.pwn(1075) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
line is
pawn Код:
pInfo[playerid][pPosX] = dini_Float(File, "PosX");
Reply
#7

hmm try this, not sure if it works

Under OnPlayerSpawn
pawn Код:
SetPlayerPosition(playerid, dini_Int(file, "PositionX"));
    SetPlayerPosition(playerid, dini_Int(file, "PositionY"));
    SetPlayerPosition(playerid, dini_Int(file, "PositionZ"));
Under OnPlayerDisconnect
pawn Код:
new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    dini_FloatSet(file, "PositionX", x);
    dini_FloatSet(file, "PositionY", y);
    dini_FloatSet(file, "PositionZ", z);
And this, outside of any callbacks(recommended at the buttom of your script)

pawn Код:
new position[MAX_PLAYERS];
stock GetPlayerPosition(playerid)
{
   return position[playerid];
}


stock SetPlayerPosition(playerid, pos)
{
    position[playerid] = position[playerid] + pos;
    return position[playerid];
}
It should write the coordinates in to a player file and then load it. But im not sure, you can try it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)