public OnPlayerSpawn(playerid)
{
if(JustLogged[playerid] == 1 && PlayerInfo[playerid][New] == 0)
{
//Won't read these co-ords SetPlayerPos(playerid, PlayerInfo[playerid][Pos][0], PlayerInfo[playerid][Pos][1], PlayerInfo[playerid][Pos][2]);
SetPlayerFacingAngle(playerid, PlayerInfo[playerid][Pos][3]);
JustLogged[playerid] = 0;
{
SetPlayerSkin(playerid, PlayerInfo[playerid][Skin]);
}
}
else
{
if(PlayerInfo[playerid][New] && gTeam[playerid] == TEAM_TRUCKER)
{
new RandPos = random(sizeof(TruckerSpawnPositions));
SetPlayerPos(playerid, TruckerSpawnPositions[RandPos][0], TruckerSpawnPositions[RandPos][1], TruckerSpawnPositions[RandPos][2]);
SetPlayerFacingAngle(playerid, TruckerSpawnPositions[RandPos][3]);
PlayerInfo[playerid][New] = 0;
}
}
return 1;
}
public SaveUser(playerid)
{
if(IsLogged[playerid] == 0) return 0;
GetPlayerHealth(playerid, PlayerInfo[playerid][Health]);
GetPlayerArmour(playerid, PlayerInfo[playerid][Armour]);
GetPlayerPos(playerid, PlayerInfo[playerid][Pos][0], PlayerInfo[playerid][Pos][1], PlayerInfo[playerid][Pos][2]);
GetPlayerFacingAngle(playerid, PlayerInfo[playerid][Pos][3]);
PlayerInfo[playerid][Money] = GetPlayerMoney(playerid);
PlayerInfo[playerid][Skin] = GetPlayerSkin(playerid);
dini_IntSet(Userfile, "Admin", PlayerInfo[playerid][Admin]);
dini_IntSet(Userfile, "Money", PlayerInfo[playerid][Money]);
dini_IntSet(Userfile, "Skin", PlayerInfo[playerid][Skin]);
if(PlayerInfo[playerid][Health] != 0) dini_FloatSet(Userfile, "Health", PlayerInfo[playerid][Health]);
if(PlayerInfo[playerid][Armour] != 0) dini_FloatSet(Userfile, "Armour", PlayerInfo[playerid][Armour]);
if(PlayerInfo[playerid][Pos][0] != 0) dini_FloatSet(Userfile, "X", PlayerInfo[playerid][Pos][0]);
if(PlayerInfo[playerid][Pos][1] != 0) dini_FloatSet(Userfile, "Y", PlayerInfo[playerid][Pos][1]);
if(PlayerInfo[playerid][Pos][2] != 0) dini_FloatSet(Userfile, "Z", PlayerInfo[playerid][Pos][2]);
if(PlayerInfo[playerid][Pos][3] != 0) dini_FloatSet(Userfile, "R", PlayerInfo[playerid][Pos][3]);
return 1;
}
stock LoginUser(playerid)
{
format(Userfile, sizeof(Userfile), "users/%s.ini", GetName(playerid));
IsLogged[playerid] = 1;
JustLogged[playerid] = 1;
PlayerInfo[playerid][Admin] = dini_Int(Userfile, "Admin");
PlayerInfo[playerid][Money] = dini_Int(Userfile, "Money");
PlayerInfo[playerid][Skin] = dini_Int(Userfile, "Skin");
PlayerInfo[playerid][Health] = dini_Float(Userfile, "Health");
PlayerInfo[playerid][Armour] = dini_Float(Userfile, "Armour");
PlayerInfo[playerid][Pos][0] = dini_Float(Userfile, "X");
PlayerInfo[playerid][Pos][1] = dini_Float(Userfile, "Y");
PlayerInfo[playerid][Pos][2] = dini_Float(Userfile, "Z");
PlayerInfo[playerid][Pos][3] = dini_Float(Userfile, "R");
GivePlayerMoney(playerid, PlayerInfo[playerid][Money]);
// Timers
SaveTimer[playerid] = SetTimerEx("SaveUser", 60 * 1000 * 5, true, "i", playerid);
return SendClientMessage(playerid, COLOR_INFO, "Logged in.");
}
It reads it but it doesn't work, so like a said it's a problem with that line..
|
JustLogged[playerid] = 0; { SetPlayerSkin(playerid, PlayerInfo[playerid][Skin]); }