[Help] Spawning
#1

Hello again, SA:MP community. I have recently (you could say finished) my DINI saving system when I noticed a problem while completely owning myself in a Hydra. Whenever you die, you just teleport to your location that was saved and you spawn with all the money, armour, etc, that was saved with it. After noticing this was under "OnPlayerSpawn" I thought, "Oh, okay! I'll just move this script to OnPlayerConnect." I did so, and because of that when I hit the 'spawn' button I still have yet to remove, I end up where my AddPlayerClass is, and not where my last location was saved. And I don't end up in the same skin. So I '//' (commented) the AddPlayerClass and when I came into the server, and instead of loading my X, Y, Z, and skin. It decided it would be mean to me and only load my health, armour. It placed me as CJ and teleported me to blueberry. I'm not sure what I need to do if anything I can do, but here is the code for my OnPlayerSpawn. Is their somewhere I can move this to prevent this from happening?

Код:
public OnPlayerSpawn(playerid)
{
    new file[128], pname[MAX_PLAYER_NAME];
    new Float:x, Float:y, Float:z;
    new money;
    new Float:health;
    new Float:armour;
    new playerskin;
    new adminlevel;
    new faction;
    new posing;

    GetPlayerName(playerid, pname, sizeof(pname));
    format(file, sizeof(file), "USERFILES/%s.ini", pname);

    if(!dini_Exists(file))
    {
        dini_Create(file);
    }
    else
    {
        x = dini_Float(file, "CoordinateX");
        y = dini_Float(file, "CoordinateY");
        z = dini_Float(file, "CoordinateZ");
        money = dini_Int(file, "Money");
        health = dini_Float(file, "Health");
        armour = dini_Float(file, "Armour");
        playerskin = dini_Int(file, "Skin");
        adminlevel = dini_Int(file, "AdminLevel");
        faction = dini_Int(file, "Faction");
        posing = dini_Int(file, "Posing");
        SetPlayerPos(playerid, x, y, z);
        GivePlayerMoney(playerid, money);
        SetPlayerHealth(playerid, health);
        SetPlayerArmour(playerid, armour);
        SetPlayerSkin(playerid, playerskin);
        wStaff[playerid] = adminlevel;
        wFaction[playerid] = faction;
        Posing[playerid] = posing;
    }
    return 1;
}
Thanks in advance!
-Jason

I know DINI is prehistoric but it works for me. Please don't suggest I change my saving system. Because unless I absolutely have to, I won't. Thank you!
Reply


Messages In This Thread
[Help] Spawning - by BornHuman - 29.10.2013, 01:18

Forum Jump:


Users browsing this thread: 1 Guest(s)