Problem In Going To Saved Positions. -
Youssef214 - 18.04.2014
When I Spawn I Don't Go To My Saved Positions,It Goes To The Position Of "AddPlayerClass" Function.
Codes:
pawn Код:
public OnPlayerSpawn(playerid)
{
GetPlayerName(playerid, pname, sizeof(pname)); // This get's the player name with the name length
GetPlayerPos(playerid, PX[playerid], PY[playerid], PZ[playerid]);
format(file2, sizeof(file2), savefolder2,pname); // Formatting file
if(dini_Exists(file2)) // If the file exist
{
SetPlayerPos(playerid, PX[playerid], PY[playerid], PZ[playerid]);
}
return 1;
}
Note: I Use DINI.
Re: Problem In Going To Saved Positions. -
AhmedMohamed - 18.04.2014
show us the onplayerdisconnect callback please??
Re: Problem In Going To Saved Positions. -
Youssef214 - 18.04.2014
OnPlayerDisconnect Callback:
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new Float:armour,Float:health;
new vehicleid = GetPlayerVehicleID(playerid);
GetPlayerPos(playerid, PX[playerid], PY[playerid], PZ[playerid]);
GetPlayerName(playerid, pname, sizeof(pname)); // This get's the player name with the name length
format(file, sizeof(file), savefolder,pname); // Formatting file
if(!dini_Exists(file)) { // If the file exist
}
else {
dini_IntSet(file, "Armour", GetPlayerArmour(playerid, armour)); // Set's "Money"
dini_IntSet(file, "Cash", GetPlayerMoney(playerid)); // Set's "Money"
dini_IntSet(file, "Health", GetPlayerHealth(playerid, health)); // Set's "Money"
dini_IntSet(file, "Score", GetPlayerScore(playerid)); // Set's "Money"
dini_IntSet(file, "WantedLevel", GetPlayerWantedLevel(playerid)); // Set's "Money"
dini_IntSet(file, "RacesWon", playerinfo[playerid][RacesWon]); // Set's "Money"
dini_IntSet(file, "RacesLost", playerinfo[playerid][RacesLost]); // Set's "Money"
dini_IntSet(file, "Evaded", playerinfo[playerid][Evaded]); // Set's "Money"
dini_IntSet(file, "Busted", playerinfo[playerid][Busted]); // Set's "Money"
dini_IntSet(file, "AdminLevel", playerinfo[playerid][AdminLevel]); // Set's "Money"
dini_IntSet(file, "Banned", playerinfo[playerid][Banned]); // Set's "Money"
dini_IntSet(file, "Disabled", playerinfo[playerid][Disabled]); // Set's "Money"
dini_IntSet(file, "Challenges", playerinfo[playerid][Challenges]); // Set's "Money" // if not
}
if(IsPlayerInAnyVehicle(playerid))
{
dini_IntSet(file, "VehicleID", vehicleid); // Set's "Score"
dini_IntSet(file, "ModelID", GetVehicleModel(vehicleid)); // Set's "Money"
}
GetPlayerName(playerid, pname, sizeof(pname)); // This get's the player name with the lenght of the player name
format(file2, sizeof(file2), savefolder2,pname); // This describe's where to save and how to save it
if(!dini_Exists(file2)) { // If the file exist
}
else {
dini_FloatSet(file2, "PositionX", PX[playerid]); // Set's "Score"
dini_FloatSet(file2, "PositionY", PY[playerid]); // Set's "Score"
dini_FloatSet(file2, "PositionZ", PZ[playerid]); // Set's "Score"
}
return 1;
}
Re: Problem In Going To Saved Positions. -
AhmedMohamed - 18.04.2014
Why you make it like that??
pawn Код:
if(!dini_Exists(file2)) { // If the file exist
}
else {
dini_FloatSet(file2, "PositionX", PX[playerid]); // Set's "Score"
dini_FloatSet(file2, "PositionY", PY[playerid]); // Set's "Score"
dini_FloatSet(file2, "PositionZ", PZ[playerid]); // Set's "Score"
}
why didn't you make it like that??
pawn Код:
if(dini_Exists(file2)) { // If the file exist
dini_FloatSet(file2, "PositionX", PX[playerid]); // Set's "Score"
dini_FloatSet(file2, "PositionY", PY[playerid]); // Set's "Score"
dini_FloatSet(file2, "PositionZ", PZ[playerid]); // Set's "Score"
}
and is the score , cash , health and armor saved or just happen like the position??
Re: Problem In Going To Saved Positions. -
Youssef214 - 18.04.2014
You Don't Understand,It Saves The Position While Disconnecting,The Problem Is While Spawning.
EDIT: The Other Things Are Saved + Successfully Loaded.
Re: Problem In Going To Saved Positions. -
AhmedMohamed - 18.04.2014
I know what you talking about, mate

but please answer my question
Re: Problem In Going To Saved Positions. -
Youssef214 - 18.04.2014
Still Doesn't Make Me Spawned At The Saved Positions.
Re: Problem In Going To Saved Positions. -
Youssef214 - 18.04.2014
Fixed The Problem,
How?
On "OnPlayerSpawn" CallBack:
pawn Код:
public OnPlayerSpawn(playerid)
{
GetPlayerName(playerid, pname, sizeof(pname)); // This get's the player name with the name length
GetPlayerPos(playerid, PX[playerid], PY[playerid], PZ[playerid]);
format(file2, sizeof(file2), savefolder2,pname); // Formatting file
if(dini_Exists(file2)) // If the file exist
{
SetPlayerPos(playerid, dini_Float(file2, "PositionX"), dini_Float(file2, "PositionY"), dini_Float(file2, "PositionZ"));
}
return 1;
}
Instead Of:
pawn Код:
SetPlayerPos(playerid, PX[playerid],PY[playerid],PZ[playerid]);
Re: Problem In Going To Saved Positions. -
AhmedMohamed - 18.04.2014
how?? xD
I think it never make it.