[HELP] with skin saving!
#1

Hi guys. I'm having problem with skin saving. What I need to add to make my skin saving workable. I would like to have skin saving which on exit save skin ID and next time i open my server, it just show my skin (last time used one) on skin selection. Just show skin not to spawn with that skin! Thanks in advance.
Sincerely,
anito
Reply
#2

You can make that with dini, I think in this case it's the fastest way. If you don't know how to use it, just ask me here.

Best regards!
Reply
#3

Quote:
Originally Posted by irinel1996
Посмотреть сообщение
You can make that with dini, I think in this case it's the fastest way. If you don't know how to use it, just ask me here.

Best regards!
Ok, sir. I don't know how to do it! Can you please help me? REP+
Reply
#4

First you have to download it, and put the file in pawno/include. OK, time to save the skins. Create a folder in scriptfiles called Skins.
pawn Код:
//You have to include it:
#include <dini>
//You can put this line under #include <a_samp>

new bool:FirstSpawn[MAX_PLAYERS char] = false;

//---
public OnPlayerConnect(playerid)
{
    FirstSpawn[playerid] = true;
    new name[MAX_PLAYER_NAME], file_path[50];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    format(file_path,50,"/Skins/%s.ini",name);
    if(!dini_exists(file_path))
    {
        dini_Create(file_path);
        dini_IntSet(file_path,"Skin",0);
    }
    return 1;
}

public OnPlayerDisconnect(playerid)
{
    new name[MAX_PLAYER_NAME], file_path[50];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    format(file_path,50,"/Skins/%s.ini",name);
    dini_IntSet(file_path,"Skin",GetPlayerSkin(playerid));
    return 1;
}

public OnPlayerSpawn(playerid)
{
    if(FirstSpawn[playerid] == true)
    {
        new name[MAX_PLAYER_NAME], file_path[50];
        GetPlayerName(playerid,name,MAX_PLAYER_NAME);
        format(file_path,50,"/Skins/%s.ini",name);
        SetPlayerSkin(playerid, dini_Get(file_path,"Skin"));
        SendClientMessage(playerid,-1,"Skin loaded");
        FirstSpawn[playerid] = false;
    }
    return 1;
}
It should work, I didn't test it.
Reply
#5

Quote:
Originally Posted by irinel1996
Посмотреть сообщение
First you have to download it, and put the file in pawno/include. OK, time to save the skins. Create a folder in scriptfiles called Skins.
pawn Код:
//You have to include it:
#include <dini>
//You can put this line under #include <a_samp>

new bool:FirstSpawn[MAX_PLAYERS char] = false;

//---
public OnPlayerConnect(playerid)
{
    FirstSpawn[playerid] = true;
    new name[MAX_PLAYER_NAME], file_path[50];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    format(file_path,50,"/Skins/%s.ini",name);
    if(!dini_exists(file_path))
    {
        dini_Create(file_path);
        dini_IntSet(file_path,"Skin",0);
    }
    return 1;
}

public OnPlayerDisconnect(playerid)
{
    new name[MAX_PLAYER_NAME], file_path[50];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    format(file_path,50,"/Skins/%s.ini",name);
    dini_IntSet(file_path,"Skin",GetPlayerSkin(playerid));
    return 1;
}

public OnPlayerSpawn(playerid)
{
    if(FirstSpawn[playerid] == true)
    {
        new name[MAX_PLAYER_NAME], file_path[50];
        GetPlayerName(playerid,name,MAX_PLAYER_NAME);
        format(file_path,50,"/Skins/%s.ini",name);
        SetPlayerSkin(playerid, dini_Get(file_path,"Skin"));
        SendClientMessage(playerid,-1,"Skin loaded");
        FirstSpawn[playerid] = false;
    }
    return 1;
}
It should work, I didn't test it.
Here is the thing. I asked one user for help before this thread and he sent me skin code he made with ysi so it works. I don't need this code sir but i gave you rep+! Thank you!
Reply
#6

OK, you're welcome.

Best regards!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)