Skin Save system
#1

I can't seem to find a tutorial on how to save skins using Y_INI. Can anyone help please?
Reply
#2

bump
Reply
#3

This or This
Reply
#4

Add a new line in .ini file. Skin. Plus the enum.
Reply
#5

I have this setskin command
Код HTML:
CMD:setskin(playerid, params[])
{
     new name[MAX_PLAYER_NAME], targetname[MAX_PLAYER_NAME], id, skinid, string[128];
     if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not atleast Admin Level 3!");
     if(sscanf(params, "ui", id, skinid)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setskin [playerid] [skinid]");
     GetPlayerName(playerid, name, MAX_PLAYER_NAME);
     GetPlayerName(id, targetname, MAX_PLAYER_NAME);
     if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Player not connected!");
     if(skinid > 299) return SendClientMessage(playerid,COLOR_RED, "ERROR: Invalid Skin id!");
     SetPlayerSkin(id, skinid);
     format(string, 128, "Admin %s(%d) has set your skinid to %i", name, playerid, skinid);
     SendClientMessage(id, COLOR_RED, string);
     format(string, 128, "You set %s(%d) skin to skinid %i", targetname, id, skinid);
     SendClientMessage(playerid, COLOR_RED, string);
     return 1;
}
I was wondering how I could make it save the skin I set you when I do /setskin player 288 and so when he disconnects or dies it sets his skin back to that
Reply
#6

Код:
enum PlayerInfo
{
      Skin,
}
new pInfo[MAX_PLAYERS][PlayerInfo]

public onplayerdisconect(playerid,reason)
{
       new INI:File = INI_Open(YOUR PATH);
       INI_SetTag(File,"YOUR TAG");
       INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
       return 1;
}

public onplayerspawn(playerid)
{
     SetPlayerSkin(playerid,pInfo[playerid][Skin]);
     return 1;
}
Of course you need first load account..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)