public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid)) return 1;
if(GetPVarInt(playerid, "LoggedIn") == 1) SpawnChar(playerid);
return 1;
}
stock SpawnChar(playerid)
{
SetPlayerPos(playerid, PlayerInfo[playerid][posX], PlayerInfo[playerid][posY], PlayerInfo[playerid][posZ]);
SetPlayerFacingAngle(playerid, PlayerInfo[playerid][posA]);
SetPlayerInterior(playerid, PlayerInfo[playerid][pInterior]);
SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVW]);
SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
SetPlayerArmour(playerid, PlayerInfo[playerid][pArmour]);
GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
SetPlayerColor(playerid, COLOR_WHITE);
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, 1);
}
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
SetPVarInt(playerid, "LoggedIn", 1);
SetSpawnInfo(playerid, 0, 255, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
public LoadUser_data(playerid,name[],value[])
{
INI_String("Password", PlayerInfo[playerid][pPass], 129);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Int("Money", PlayerInfo[playerid][pMoney]);
INI_Int("Admin", PlayerInfo[playerid][pAdmin]);
INI_Int("Ban", PlayerInfo[playerid][pBan]);
INI_String("IP", PlayerInfo[playerid][pIP], 16);
INI_Int("Interior", PlayerInfo[playerid][pInterior]);
INI_Int("VirutalWorld", PlayerInfo[playerid][pVW]);
INI_Int("Skin", PlayerInfo[playerid][pSkin]);
INI_Int("Gender", PlayerInfo[playerid][pGender]);
INI_Int("Age", PlayerInfo[playerid][pAge]);
INI_Int("Hospital", PlayerInfo[playerid][pHospital]);
INI_Float("Health", PlayerInfo[playerid][pHealth]);
INI_Float("Armour", PlayerInfo[playerid][pArmour]);
INI_Float("PositionX",PlayerInfo[playerid][posX]);
INI_Float("PositionY",PlayerInfo[playerid][posY]);
INI_Float("PositionZ",PlayerInfo[playerid][posZ]);
INI_Float("PositionA",PlayerInfo[playerid][posA]);
return 1;
}
stock SaveUser(playerid)
{
new INI:File = INI_Open(UserPath(playerid));
GetPlayerPos(playerid, PlayerInfo[playerid][posX], PlayerInfo[playerid][posY], PlayerInfo[playerid][posZ]);
GetPlayerFacingAngle(playerid, PlayerInfo[playerid][posA]);
GetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
GetPlayerArmour(playerid, PlayerInfo[playerid][pArmour]);
INI_SetTag(File,"PlayerData");
INI_WriteInt(File,"Skin", GetPlayerSkin(playerid));
INI_WriteInt(File,"Ban", PlayerInfo[playerid][pBan]);
if(PlayerInfo[playerid][pBan])
{
INI_WriteString(File, "BanReason", PlayerInfo[playerid][pBanReason]);
INI_WriteString(File, "BannedBy", PlayerInfo[playerid][pBannedBy]);
}
INI_WriteInt(File,"Money", PlayerInfo[playerid][pMoney]);
INI_WriteInt(File,"Admin", PlayerInfo[playerid][pAdmin]);
INI_WriteString(File,"IP", PlayerInfo[playerid][pIP]);
INI_WriteInt(File,"Interior", GetPlayerInterior(playerid));
INI_WriteInt(File,"VirtualWorld", GetPlayerVirtualWorld(playerid));
INI_WriteInt(File,"Hospital", PlayerInfo[playerid][pHospital]);
INI_WriteFloat(File,"Health", PlayerInfo[playerid][pHealth]);
INI_WriteFloat(File,"Armour", PlayerInfo[playerid][pArmour]);
INI_WriteFloat(File,"PositionX", PlayerInfo[playerid][posX]);
INI_WriteFloat(File,"PositionY", PlayerInfo[playerid][posY]);
INI_WriteFloat(File,"PositionZ", PlayerInfo[playerid][posZ]);
INI_WriteFloat(File,"PositionA", PlayerInfo[playerid][posA]);
INI_Close(File);
}
INI_SetTag(File,"PlayerData");
Change your LoadUser_data function name to LoadUser_PlayerData.
Why? 1. pawn Код:
https://sampforum.blast.hk/showthread.php?tid=175565 - read up on remoteFormat parameter. |