31.05.2013, 19:13
I can't seem to find a tutorial on how to save skins using Y_INI. Can anyone help please?
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;
}
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; }