Save Players Skin - No Command
#1

i need save the players skin which choose at registration.
after, when player login automatic spawn with skin saved.

i use Y_INI register, now how save skins?
please help :/
Reply
#2

Код:
COMMAND:saveskin(playerid, params[])
{
    new skinid, string[256];
    if(sscanf(params, "i", skinid)) SendClientMessage(playerid, 0xFFFFFFAA,"usage: /saveskin[skinid]");
    if(skinid > 299) return SendClientMessage(playerid,0xFF0000AA,"error: Available Skin: 0 - 299 !");
    SetPlayerSkin(playerid,skinid);
    format(string, sizeof(string), "You changed your Skin-ID succesful!");
    SendClientMessage(playerid, 0xFF0000AA, string);
   // Now we will save the Skin.
   new INI:File = INI_Open(UserPath(playerid));
   INI_SetTag(File,"data");
   INI_WriteInt(File,"SkinID",skinid);
   INI_Close(File);
   return 1;
}
Reply
#3

Quote:
Originally Posted by Blackazur
Посмотреть сообщение
Код:
COMMAND:saveskin(playerid, params[])
{
    new skinid, string[256];
    if(sscanf(params, "i", skinid)) SendClientMessage(playerid, 0xFFFFFFAA,"usage: /saveskin[skinid]");
    if(skinid > 299) return SendClientMessage(playerid,0xFF0000AA,"error: Available Skin: 0 - 299 !");
    SetPlayerSkin(playerid,skinid);
    format(string, sizeof(string), "You changed your Skin-ID succesful!");
    SendClientMessage(playerid, 0xFF0000AA, string);
   // Now we will save the Skin.
   new INI:File = INI_Open(UserPath(playerid));
   INI_SetTag(File,"data");
   INI_WriteInt(File,"SkinID",skinid);
   INI_Close(File);
   return 1;
}
i said no command bro :S
check title...
Reply
#4

bump! help please
Reply
#5

Код:
public OnPlayerDisconect(playerid)
{
   new skin = GetPlayerSkin(playerid);
   new INI:File = INI_Open(UserPath(playerid));
   INI_SetTag(File,"data");
   INI_WriteInt(File,"pSkin",skin);
   INI_Close(File);
}
Maybe that?
Never used Y_Ini so cant help you with setting the players skin when spawning.

EDIT: I have been looking around for you, and this should work (Untested)

Код:
enum pInfo
{
    pSkin

}
newPlayerInfo[MAX_PLAYERS][pInfo];

forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("pSkin",PlayerInfo[playerid][pSkin]);
    return 1;
}

OnPlayerSpawn(playerid)
{
    SetlayerSkin(playerid,PlayerInfo[playerid][pSkin]);
}
This is just to give you a quick look on how you should do it.
Reply
#6

Don't be lazy! Just grab the code from the command and use it!
Reply
#7

Quote:
Originally Posted by justinnater
Посмотреть сообщение
Код:
public OnPlayerDisconect(playerid)
{
   new skin = GetPlayerSkin(playerid);
   new INI:File = INI_Open(UserPath(playerid));
   INI_SetTag(File,"data");
   INI_WriteInt(File,"pSkin",skin);
   INI_Close(File);
}
Maybe that?
Never used Y_Ini so cant help you with setting the players skin when spawning.

EDIT: I have been looking around for you, and this should work (Untested)

Код:
enum pInfo
{
    pSkin

}
newPlayerInfo[MAX_PLAYERS][pInfo];

forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("pSkin",PlayerInfo[playerid][pSkin]);
    return 1;
}

OnPlayerSpawn(playerid)
{
    SetlayerSkin(playerid,PlayerInfo[playerid][pSkin]);
}
This is just to give you a quick look on how you should do it.
yes work bro
thanks really
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)