03.11.2018, 15:25
Code:
hook OnPlayerConnect(playerid)
{
new
pName[MAX_PLAYER_NAME],
PlayerPathFile[50];
GetPlayerName(playerid, pName, sizeof(pName));
format(PlayerPathFile, sizeof(PlayerPathFile), "/PlayerData/%s.ini", pName);
if(!dini_Exists(PlayerPathFile))
{
dini_Create(PlayerPathFile);
}
else
{
PlayerInfo[playerid][pPosX] = dini_Float(PlayerPathFile, "PositionX");
PlayerInfo[playerid][pPosY] = dini_Float(PlayerPathFile, "PositionY");
PlayerInfo[playerid][pPosZ] = dini_Float(PlayerPathFile, "PositionZ");
PlayerInfo[playerid][pRot] = dini_Float(PlayerPathFile, "Rotation");
PlayerInfo[playerid][pAdmin] = dini_Int(PlayerPathFile,"AdminLevel");
SendClientMessage(playerid, COLOR_YELLOW, "Your player files have been loaded in. Enjoy your stay.");
}
SetSpawnInfo(playerid, 0, 0, PlayerInfo[playerid][pPosX], PlayerInfo[playerid][pPosY], PlayerInfo[playerid][pPosZ], PlayerInfo[playerid][pRot], 0, 0, 0, 0, 0, 0);
return 1;
}
hook OnPlayerDisconnect(playerid, reason)
{
new
pName[MAX_PLAYER_NAME],
PlayerPathFile[50];
GetPlayerName(playerid, pName, sizeof(pName));
format(PlayerPathFile, sizeof(PlayerPathFile), "/PlayerData/%s.ini", pName);
dini_FloatSet(PlayerPathFile, "PositionX", PlayerInfo[playerid][pPosX]);
dini_FloatSet(PlayerPathFile, "PositionY", PlayerInfo[playerid][pPosY]);
dini_FloatSet(PlayerPathFile, "PositionZ", PlayerInfo[playerid][pPosZ]);
dini_FloatSet(PlayerPathFile, "Rotation", PlayerInfo[playerid][pRot]);
dini_IntSet(PlayerPathFile, "AdminLevel", PlayerInfo[playerid][pAdmin]);
return 1;
}
ps: and yes you will probs ask why u dont use mysql and i will once i get the hang of pawn


