Error's
#16

pawn Code:
enum pDataE
{
    pWanted,
    pSkin,
    Float:posX,
    Float:posY,
    Float:posZ
};

new pData[MAX_PLAYERS][pDataE]


public OnPlayerConnect(playerid)
{
    new file[64];
    format(file, sizeof(file), "Players/%s.ini", GetPlayerNameEx(playerid));
    if(!dini_Exists(file))
    {
        gTeam[playerid] = TEAM_CIV;
        pData[playerid][pWanted] = 0;
        pData[playerid][posX] = 0.0;
        pData[playerid][posY] = 0.0;
        pData[playerid][posZ] = 0.0;
        pData[playerid][pSkin] = -1;
    }
    else
    {
        gTeam[playerid] = dini_Int(file, "Teams");
        pData[playerid][pWanted] = dini_Int(file, "Wanted");
        pData[playerid][posX] = dini_Float(file, "PositionX");
        pData[playerid][posY] = dini_Float(file, "PositionY");
        pData[playerid][posZ] = dini_Float(file, "PositionZ");
        pData[playerid][pSkin] = dini_Int(file, "skin");
    }
}
public OnPlayerDisconnect(playerid, reason)
{
    GetPlayerPos(playerid, pData[playerid][posX], pData[playerid][posY], pData[playerid][posZ]);
    new file[64];
    format(file, sizeof(file), "Players/%s.ini", GetPlayerNameEx(playerid));
    if(!dini_Exists(file)) dini_Create(file);
    dini_IntSet(file, "Teams", gTeam[playerid]);
    dini_IntSet(file, "Wanted", GetPlayerWantedLevel(playerid));
    dini_FloatSet(file, "PositionX", pData[playerid][posX]);
    dini_FloatSet(file, "PositionY", pData[playerid][posY]);
    dini_FloatSet(file, "PositionZ", pData[playerid][posZ]);
    dini_IntSet(file, "Skin", GetPlayerSkin(playerid));
    return 1;
}

public OnPlayerSpawn(playerid)
{
    if(pData[playerid][pSkin] == -1)
    {
        SetPlayerPos(playerid, 1647.1093, -2308.5242, 14.5156);
    }
    else
    {
        SetPlayerSkin(playerid, pData[playerid][pSkin]);
        SetPlayerPos(playerid, pData[playerid][posX], pData[playerid][posY], pData[playerid][posZ]);
    }
    return 1;
}

stock GetPlayerNameEx(playerid)
{
    new playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));
    return playername;
}
Reply


Messages In This Thread
Error's - by ZBits - 18.07.2012, 03:30
Re: Error's - by ViniBorn - 18.07.2012, 03:32
Re: Error's - by ZBits - 18.07.2012, 03:33
Re: Error's - by ViniBorn - 18.07.2012, 03:34
Re: Error's - by ZBits - 18.07.2012, 03:40
Re: Error's - by ZBits - 18.07.2012, 03:46
Re: Error's - by Larceny - 18.07.2012, 03:51
Re: Error's - by ZBits - 18.07.2012, 03:56
Re: Error's - by Larceny - 18.07.2012, 03:58
Re: Error's - by ZBits - 18.07.2012, 04:03
Re: Error's - by Larceny - 18.07.2012, 04:12
Re: Error's - by ZBits - 18.07.2012, 04:49
Re: Error's - by ZBits - 18.07.2012, 05:52
Re: Error's - by Andi_Evandy - 18.07.2012, 06:42
Re: Error's - by ZBits - 18.07.2012, 14:07
Re: Error's - by Andi_Evandy - 18.07.2012, 14:56
Re: Error's - by XStormiest - 18.07.2012, 15:13
Re: Error's - by ZBits - 18.07.2012, 15:34
Re: Error's - by XStormiest - 18.07.2012, 15:49
Re: Error's - by ZBits - 18.07.2012, 15:55

Forum Jump:


Users browsing this thread: 1 Guest(s)