SA-MP Forums Archive
How To save skin - 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: How To save skin (/showthread.php?tid=469444)



How To save skin - Lay - 13.10.2013

i want to save the player skin

how can i ?

just give me examples

pawn Код:
CMD:skin(playerid,params[])
{
  new skinid,string[128],file[64];
  if(sscanf(params, "i",skinid)) return SendClientMessage(playerid,0xFFDD00AA, "** Usage: /skin [skinid].");
  if(skinid > 299 || skinid < 0) return SendClientMessage(playerid,0xFFDD00AA, "* Invalid Skin ID.");
  format(file,sizeof file,"Admin/%s.ini",GetName(playerid));
  INI_Open(file);//Opening the file with SII include
  INI_SetString("Skin",skin);
  INI_WriteInt("Skin",skinid);//Writing the line "Level" the selected admin level.
  INI_Save();//Saving the file
  INI_Close();//Closing the file
  SetPlayerSkin(playerid,skinid);
  format(string,sizeof(string), "** You changed your skin to %d",skinid);
  SendClientMessage(playerid,0xFFDD00AA,string);
  return 1;
}



Re: How To save skin - AIped - 13.10.2013

Usually you 'save' the skin when the player disconnects
You need GetPlayerSkin for that then and INI_Save.

If you connect to the server again you need SetPlayerSkin and Init_Load


Re: How To save skin - Lay - 13.10.2013

example please in pawno


Re: How To save skin - ]Rafaellos[ - 13.10.2013

He mean that you must add
pawn Код:
INI_WriteInt("Skin", GetPlayerSkin(playerid));
on
pawn Код:
public OnPlayerDisconnect(playerid, reason)
And just use the command like so
pawn Код:
CMD:skin(playerid,params[])
{
    new skinid,string[128],file[64];
    if(sscanf(params, "i",skinid)) return SendClientMessage(playerid,0xFFDD00AA, "** Usage: /skin [skinid].");
    if(skinid > 299 || skinid < 0) return SendClientMessage(playerid,0xFFDD00AA, "* Invalid Skin ID.");
    format(string,sizeof(string), "** You changed your skin to %d",skinid);
    SendClientMessage(playerid,0xFFDD00AA,string);
    SetPlayerSkin(playerid,skinid);
    return 1;
}



Re : How To save skin - Predat3r - 13.10.2013

Hello,
In The Logged event you add exemple :
PHP код:
new skin PlayerInfo[playerid][pSkin]);
SetPlayerSkin(playerid,skin); 



Re: How To save skin - Lay - 13.10.2013

little bit more explanation ?

]Rafaellos[


Re: How To save skin - ]Rafaellos[ - 13.10.2013

When a player disconnects, usually you'r administrator system save player's data (money, score, etc). In that data, you will save skin too.