Portal SAMP
[Ajuda] Como fixar Skin - Versão de Impressão

+- Portal SAMP (https://portalsamp.com)
+-- Fórum: SA-MP (https://portalsamp.com/forumdisplay.php?fid=5)
+--- Fórum: Área de suporte (https://portalsamp.com/forumdisplay.php?fid=6)
+--- Tópico: [Ajuda] Como fixar Skin (/showthread.php?tid=1468)



Como fixar Skin - Paulao_ - 29/07/2021

Por exemplo, eu queria deixar para quando o player deslogar do servidor, entrar com a skin que tinha antes. Por exemplo, quando um player é PM e compra outra skin e quando ele reloga ele volta com a Skin do PM, porem eu queria deixar para quando ele relogar a skin não mudar!!!!


RE: Como fixar Skin - xbruno1000x - 29/07/2021

Testa aí

Código:
new pSkinPM[MAX_PLAYERS];

public OnPlayerDisconnect(playerid)
{
    new file[60];
    format(file, sizeof(file), "/CopSkin/%s.ini", GetPlayerNameEx(playerid));
    if(fexist(file))
    {
        switch(GetPlayerSkin(playerid))
        {
            case 280: DOF2_SetInt(file, "SkinPolicia", 280);
            case 281: DOF2_SetInt(file, "SkinPolicia", 281);
            case 282: DOF2_SetInt(file, "SkinPolicia", 282);
            case 283: DOF2_SetInt(file, "SkinPolicia", 283);
             case 284: DOF2_SetInt(file, "SkinPolicia", 284);
             case 285: DOF2_SetInt(file, "SkinPolicia", 285);
             case 286: DOF2_SetInt(file, "SkinPolicia", 286);
              case 287: DOF2_SetInt(file, "SkinPolicia", 287);
              case 288: DOF2_SetInt(file, "SkinPolicia", 288);
        }
    }
}

public OnPlayerSpawn(playerid)
{
    new file[60];
    format(file, sizeof(file), "/CopSkin/%s.ini", GetPlayerNameEx(playerid));
    if(fexist(file))
    {
        pSkinPM[playerid] = DOF2_GetInt(file, "SkinPolicia");
        SetPlayerSkin(playerid, pSkinPM[playerid]);
    }
}



RE: Como fixar Skin - Paulao_ - 30/07/2021

(29/07/2021 11:08)xbruno1000x Escreveu: Testa aí

Código:
new pSkinPM[MAX_PLAYERS];

public OnPlayerDisconnect(playerid)
{
    new file[60];
    format(file, sizeof(file), "/CopSkin/%s.ini", GetPlayerNameEx(playerid));
    if(fexist(file))
    {
        switch(GetPlayerSkin(playerid))
        {
            case 280: DOF2_SetInt(file, "SkinPolicia", 280);
            case 281: DOF2_SetInt(file, "SkinPolicia", 281);
            case 282: DOF2_SetInt(file, "SkinPolicia", 282);
            case 283: DOF2_SetInt(file, "SkinPolicia", 283);
             case 284: DOF2_SetInt(file, "SkinPolicia", 284);
             case 285: DOF2_SetInt(file, "SkinPolicia", 285);
             case 286: DOF2_SetInt(file, "SkinPolicia", 286);
              case 287: DOF2_SetInt(file, "SkinPolicia", 287);
              case 288: DOF2_SetInt(file, "SkinPolicia", 288);
        }
    }
}

public OnPlayerSpawn(playerid)
{
    new file[60];
    format(file, sizeof(file), "/CopSkin/%s.ini", GetPlayerNameEx(playerid));
    if(fexist(file))
    {
        pSkinPM[playerid] = DOF2_GetInt(file, "SkinPolicia");
        SetPlayerSkin(playerid, pSkinPM[playerid]);
    }
}
Sim mano, mas eu não queria só as de cop mas sim as que se compra na binco!!! Quando um player comprar uma skin na binco, ela fica para sempre!!!


RE: Como fixar Skin - xbruno1000x - 30/07/2021

(30/07/2021 05:56)Paulao_ Escreveu:
(29/07/2021 11:08)xbruno1000x Escreveu: Testa aí

Código:
new pSkinPM[MAX_PLAYERS];

public OnPlayerDisconnect(playerid)
{
    new file[60];
    format(file, sizeof(file), "/CopSkin/%s.ini", GetPlayerNameEx(playerid));
    if(fexist(file))
    {
        switch(GetPlayerSkin(playerid))
        {
            case 280: DOF2_SetInt(file, "SkinPolicia", 280);
            case 281: DOF2_SetInt(file, "SkinPolicia", 281);
            case 282: DOF2_SetInt(file, "SkinPolicia", 282);
            case 283: DOF2_SetInt(file, "SkinPolicia", 283);
             case 284: DOF2_SetInt(file, "SkinPolicia", 284);
             case 285: DOF2_SetInt(file, "SkinPolicia", 285);
             case 286: DOF2_SetInt(file, "SkinPolicia", 286);
              case 287: DOF2_SetInt(file, "SkinPolicia", 287);
              case 288: DOF2_SetInt(file, "SkinPolicia", 288);
        }
    }
}

public OnPlayerSpawn(playerid)
{
    new file[60];
    format(file, sizeof(file), "/CopSkin/%s.ini", GetPlayerNameEx(playerid));
    if(fexist(file))
    {
        pSkinPM[playerid] = DOF2_GetInt(file, "SkinPolicia");
        SetPlayerSkin(playerid, pSkinPM[playerid]);
    }
}
Sim mano, mas eu não queria só as de cop mas sim as que se compra na binco!!! Quando um player comprar uma skin na binco, ela fica para sempre!!!

O sistema tá aí mano, é só você adaptar da forma que desejar. A diferença é que você vai precisar setar o valor da variável no momento em que o player comprar a skin, para caso ele mudar no decorrer da gameplay, não ser salvo ao desconectar.