How to save skin and force player class selection ?
#8

pawn Код:
#include <YSI\y_ini>

#define UserPath "%s.ini"

enum PlayerInfo
{
    Skin,
}
new pInfo[MAX_PLAYERS][PlayerInfo];

stock Path(playerid)
{
    new str[150], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(str, sizeof(str), UserPath, name);
    return str;
}

forward loadskin_user(playerid, name[], value[]);

public loadskin_user(playerid, name[], value[])
{
    INI_Int("Skin", pInfo[playerid][Skin]);
    return 1;
}

public OnPlayerConnect(playerid)
{
    if(pInfo[playerid][Skin] != -1)
    {
    SpawnPlayer(playerid);
    SetPlayerSkin(playerid, pInfo[playerid][Skin]);
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new INI:file = INI_Open(Path(playerid));
    INI_SetTag(file, "Player's Skin");
    INI_WriteInt(file, "Skin", pInfo[playerid][Skin]);
    INI_Close(file);
    return 1;
}    

CMD:saveskin(playerid, params[])
{
    new skin = GetPlayerSkin(playerid);
    pInfo[playerid][Skin] = skin;
    SendClientMessage(playerid, -1, "Your skin has been saved !");
    return 1;
}
If you will post your user system (here is a tutorial for it), then i can make it. This is just a part. But it won't work.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)