Problem In Going To Saved Positions.
#1

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.
Reply
#2

show us the onplayerdisconnect callback please??
Reply
#3

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;
}
Reply
#4

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??
Reply
#5

You Don't Understand,It Saves The Position While Disconnecting,The Problem Is While Spawning.

EDIT: The Other Things Are Saved + Successfully Loaded.
Reply
#6

I know what you talking about, mate
but please answer my question
Reply
#7

Still Doesn't Make Me Spawned At The Saved Positions.
Reply
#8

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]);
Reply
#9

how?? xD
I think it never make it.
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)