Skin isn't loading
#1

I don't know whats the problem, I think I'm doing everything right. I use Pawn's raw file processor. When I register a account in my script, I'm given skin id 240, I use a command to change my skin to 239, I quit, and log back in, my skin is 239, just as it should be. After that, here's the problem, when I do /kill to change back to the old skin 240 (/kill - 240 is the only skin added in AddPlayerClass) and after my skin is set to 240 after death, logout again, I log in only to see that my skin id is 239. I don't know whats the problem, I've searched everywhere, tried almost everything but can't find the solution. But I deeply suspect that there is something wrong in 'SaveAccount'. Here is the scripts I have in my gamemode.

pawn Код:
public SaveAccount(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerLogged[playerid])
        {
            new string[30];
            GetPlayerName(playerid, string, sizeof(string));
            format(string, sizeof(string), "%s.ini", string);
            new File: hFile = fopen(string, io_write);
            if (hFile)
            {
                PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid);
                format(string, sizeof(string), "Skin=%d\n",PlayerInfo[playerid][pSkin]);fwrite(hFile, string);
                fclose(hFile);
            }
        }
    }
    return 1;
}
Reply
#2

Show the command that sets the skin.
Reply
#3

pawn Код:
//OnPlayerConnect
PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid);
SetPlayerSkin(playerid, %d);
Reply
#4

pawn Код:
public OnPlayerLogin(playerid,password[])
{
    new string[128];
    new playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));
    format(string, sizeof(string), "%s.ini", playername);
    new File: UserFile = fopen(string, io_read);
    if(UserFile)
    {
        new valtmp[128];
        fread(UserFile, string, sizeof(string));
        if(strcmp(ini_GetKey(string), "Key", true) == 0)
        {
            valtmp = ini_GetValue(string);
            strmid(PlayerInfo[playerid][pKey], valtmp, 0, strlen(valtmp)-1, 255);
        }
        if(strcmp(PlayerInfo[playerid][pKey], password, true) == 0)
        {
                new key[128];
                new val[128];
                while(fread(UserFile, string, sizeof(string)))
                {
                    key = ini_GetKey(string);
                    if(strcmp(key, "Skin", true) == 0) { val = ini_GetValue(string); PlayerInfo[playerid][pSkin] = strval(val); }
                }
                fclose(UserFile);
        }
        else
        {
           
            fclose(UserFile);
            return 1;
        }
    }
    SpawnPlayer(playerid);
    PlayerLogged[playerid] = 1;
    SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)