Error's
#11

Look the comments.

pawn Code:
public OnPlayerConnect(playerid)
{
    new
        pName[MAX_PLAYER_NAME],
        file[64];

    GetPlayerName(playerid, pName, sizeof(pName));
    format(file, sizeof(file), "Players/%s.ini", pName);
   
    if(!dini_Exists(file))
    {
        //if it doesn't exist it MUST be created.
        dini_Create(file);
       
        gTeam[playerid] = TEAM_CIV;
       
        new Float:x;
        new Float:y;
        new Float:z;

        GetPlayerPos(playerid,x,y,z);
        skin = GetPlayerSkin(playerid);
        positionx = x;
        positiony = y;
        positionz = z;
       
        dini_IntSet(file, "Teams", gTeam[playerid]);
        dini_IntSet(file, "Wanted",wanted);
       
       
        dini_IntSet(file, "PositionX", floatround(positionx));
        dini_IntSet(file, "PositionY", floatround(positiony));
        dini_IntSet(file, "PositionZ", floatround(positionz));
        //WHY floatround? It SHOULD be a FLOAT.
       
        dini_IntSet(file, "Skin", skin);
    }
    else
    {
        gTeam[playerid] = dini_Int(file, "Teams");
        wanted = dini_Int(file, "Wanted");
        positionx = dini_Int(file, "PositionX");
        positiony = dini_Int(file, "PositionY");
        positionz = dini_Int(file, "PositionZ");
        skin = dini_Int(file, "skin");
    }
   
    // wanted, positionx, positiony, positionz, skin MUST be an array like gTeam[playerid]!!!
}

public OnPlayerDisconnect(playerid, reason)
{
    new Float:x;
    new Float:y;
    new Float:z;

    GetPlayerPos(playerid,x,y,z);
    skin = GetPlayerSkin(playerid);
    positionx = x;
    positiony = y;
    positionz = z;

    wanted = GetPlayerWantedLevel(playerid);
    new pName[MAX_PLAYER_NAME], file[64];
    GetPlayerName(playerid, pName, sizeof(pName));
    format(file, sizeof(file), "Players/%s.ini", pName);
   
    if(!dini_Exists(file)){ dini_Create(file); }
   
   
    dini_IntSet(file, "Teams", gTeam[playerid]);
    dini_IntSet(file, "Wanted",wanted);
   
   
    dini_IntSet(file, "PositionX", floatround(positionx));
    dini_IntSet(file, "PositionY", floatround(positiony));
    dini_IntSet(file, "PositionZ", floatround(positionz));
    //WHY floatround? It SHOULD be a FLOAT.
   
    dini_IntSet(file, "Skin", skin);
   
    // wanted, positionx, positiony, positionz, skin MUST be an array like gTeam[playerid]!!!
    return 1;
}

public OnPlayerSpawn(playerid)
{
    new pName[MAX_PLAYER_NAME], file[64];
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    format(file, sizeof(file), "Players/%s.ini", pName);
    if(!dini_Exists(file))
    {
        dini_Create(file);//Create the file
        SetPlayerPos(playerid,1647.1093,-2308.5242,14.5156);
    }
    else
    {
        SetPlayerPos(playerid, positionx,positiony,positionz);
        SetPlayerSkin(playerid, skin);
        // positionx, positiony, positionz, skin MUST be an array like gTeam[playerid]!!!
    }
    return 1;
}
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: 3 Guest(s)