if(pinfo[playerid][Registered] == 0)
{
SetPlayerSkin(playerid,pinfo[playerid][Skin]);
SetClassFromSkin(playerid);
WantedLevelColor(playerid);
SetPlayerTeam(playerid,pinfo[playerid][Team]);
SetPlayerToTeamColor(playerid);
GivePlayerTeamWeapons(playerid);
printf("%s stats have been given.Skin: %d Team: %d", GPN(playerid),pinfo[playerid][Skin],pinfo[playerid][Team]);
if(pinfo[playerid][Team] == TEAM_COPS)
{
SetPlayerPos(playerid, 1569.5902,-1694.6520,5.8906);
SetCameraBehindPlayer(playerid);
}
if(pinfo[playerid][Team] == NO_TEAM)
{
if(pinfo[playerid][Cuffed] == 1)
{
SendClientMessage(playerid, COLOR_RED," [ AUTO CUFF]: You have been autojailed because you left server while cuffed!");
new rnd = random(sizeof(PrisonSpawn));
SetPlayerPos(playerid, PrisonSpawn[rnd][0], PrisonSpawn[rnd][1], PrisonSpawn[rnd][2]);
SendClientMessage(playerid, COLOR_GREY, "**LOS SANTOS PRISON**");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "[PRISON] You have been sent to prison. You will be released soon.");
}
if(pinfo[playerid][Jailed] == 1)
{
new rnd = random(sizeof(PrisonSpawn));
SetPlayerPos(playerid, PrisonSpawn[rnd][0], PrisonSpawn[rnd][1], PrisonSpawn[rnd][2]);
SendClientMessage(playerid, COLOR_GREY, "**LOS SANTOS PRISON**");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "[PRISON] You have been sent to prison. You will be released soon.");
}
else
{
new rnd = random(sizeof(SpawnPoints));
//SetPlayerPos(playerid, SpawnPoints[rnd][0], SpawnPoints[rnd][1], SpawnPoints[rnd][2]);
SetPlayerPos(playerid,pinfo[playerid][posX],pinfo[playerid][posY],pinfo[playerid][posZ]); <<<<<<<
SetPlayerFacingAngle(playerid, SpawnPoints[rnd][3]);
SetCameraBehindPlayer(playerid);
}
}
}
public OnAccountLoad(playerid)
{
pinfo[playerid][Admin] = cache_get_field_content_int(0, "Admin");
pinfo[playerid][VIP] = cache_get_field_content_int(0, "VIP");
pinfo[playerid][Money] = cache_get_field_content_int(0, "Money");
pinfo[playerid][posX] = cache_get_field_content_float(0, "PosX");
pinfo[playerid][posY] = cache_get_field_content_float(0, "PosY");
pinfo[playerid][posZ] = cache_get_field_content_float(0, "PosZ");
pinfo[playerid][Kills] = cache_get_field_content_int(0, "Kills");
pinfo[playerid][Deaths] = cache_get_field_content_int(0, "Deaths");
pinfo[playerid][Score] = cache_get_field_content_int(0, "Score");
pinfo[playerid][Banned] = cache_get_field_content_int(0,"Banned");
pinfo[playerid][Hours] = cache_get_field_content_int(0, "Hours");
pinfo[playerid][Minutes] = cache_get_field_content_int(0, "Minutes");
pinfo[playerid][Terskill] = cache_get_field_content_int(0, "Terskill");
pinfo[playerid][Robskill] = cache_get_field_content_int(0, "Robskill");
pinfo[playerid][Hitmanskill] = cache_get_field_content_int(0, "Hitmanskill");
pinfo[playerid][WantedLevel] = cache_get_field_content_int(0, "WantedLevel");
pinfo[playerid][TotalRobs] = cache_get_field_content_int(0, "TotalRobs");
pinfo[playerid][Muted] = cache_get_field_content_int(0," Muted");
pinfo[playerid][Cuffed] = cache_get_field_content_int(0,"Cuffed");
pinfo[playerid][Jailed] = cache_get_field_content_int(0, "Jailed");
pinfo[playerid][JailTime] = cache_get_field_content_int(0, "JailTime");
pinfo[playerid][Skin] = cache_get_field_content_int(0, "Skin");
pinfo[playerid][Team] = cache_get_field_content_int(0, "Team");
pinfo[playerid][Drug] = cache_get_field_content_int(0, "Drugs");
pinfo[playerid][DrugAmount] = cache_get_field_content_int(0, "DrugAmount");
pinfo[playerid][Logged] = 1;
pinfo[playerid][Registered] = 0;
SpawnPlayer(playerid);
GivePlayerMoney(playerid, pinfo[playerid][Money]);
SendClientMessage(playerid, -1, "Successfully logged in");
return 1;
}
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
pinfo[playerid][Skin] = GetPlayerSkin(playerid);
pinfo[playerid][Team] = GetPlayerTeam(playerid);
pinfo[playerid][Money] = GetPlayerMoney(playerid);
pinfo[playerid][Score] = GetPlayerScore(playerid);
mysql_format(mysql, query, sizeof(query), "UPDATE `players` SET `Admin`=%d, `VIP`=%d, `Money`=%d, `posX`=%f, `posY`=%f, `posZ`=%f,\
`Score` =%d, `Banned` =%d, `Cuffed` =%d, `Muted` =%d, `Jailed` =%d, `JailTime` =%d, `Drugs` =%d, `DrugAmount` =%d, `Robskill` =%d, `Hitmanskill` =%d, `Terskill` =%d, `TotalRobs` =%d,\
`Skin` =%d, `Team` =%d, `Kills` =%d, `Deaths`=%d WHERE `ID`=%d",
pinfo[playerid][Admin], pinfo[playerid][VIP],pinfo[playerid][Money], pos[0], pos[1], pos[2],
pinfo[playerid][Score],pinfo[playerid][Banned], pinfo[playerid][Cuffed],pinfo[playerid][Muted],
pinfo[playerid][Jailed],pinfo[playerid][JailTime],pinfo[playerid][Drug],pinfo[playerid][DrugAmount],
pinfo[playerid][Robskill],pinfo[playerid][Hitmanskill],pinfo[playerid][Terskill],pinfo[playerid][TotalRobs],pinfo[playerid][Skin],
pinfo[playerid][Team],pinfo[playerid][Kills],pinfo[playerid][Deaths],pinfo[playerid][ID]);
Well vince i noticed that it saves actually the coords i might have put it and to another callback. D you have any suggestion of how i should work with that problem?
EDIT: It only saves the pos onplayerdisconnect |
You can't save the pos using "GetPlayer" on disconnect, because they're already disconnected.
However, you can make a stock in which updates/saves player stats every "34123412" milliseconds; and so fourth. |