SA-MP Forums Archive
Save Players Skin - No Command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Save Players Skin - No Command (/showthread.php?tid=401290)



Save Players Skin - No Command - zudokuxd10 - 22.12.2012

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 :/


AW: Save Players Skin - No Command - Blackazur - 22.12.2012

Код:
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;
}



Re: AW: Save Players Skin - No Command - zudokuxd10 - 22.12.2012

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...


Re: Save Players Skin - No Command - zudokuxd10 - 22.12.2012

bump! help please


Re: Save Players Skin - No Command - justinnater - 22.12.2012

Код:
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.


Re: Save Players Skin - No Command - Faisal_khan - 22.12.2012

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


Re: Save Players Skin - No Command - zudokuxd10 - 22.12.2012

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