Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Credits to WildWave + Y_Less
- //Found bug ? Skype : ofekshirin or http://www.fxp.co.il/member.php?u=839912
- //======Includes=======//
- #include <a_samp>
- #include <YSI\y_ini>
- #include <YSI\y_inline>
- #include <ZCMD>
- new SkinFile[MAX_PLAYERS][MAX_PLAYER_NAME];
- enum sInfo
- {
- Skin,
- bool:SavedSkin
- }
- new SkinInfo[MAX_PLAYERS][sInfo];
- public OnPlayerConnect(playerid)
- {
- GetPlayerName(playerid,SkinInfo[playerid],MAX_PLAYER_NAME+1) && format(SkinFile[playerid],sizeof(SkinFile),"Skin/%s.ini",SkinInfo[playerid]);
- inline LoadUserData(string:name[],string:value[])
- {
- INI_Int("LastSkin",SkinInfo[playerid][Skin]);
- INI_Bool("SavedSkin",SkinInfo[playerid][SavedSkin]);
- }
- if(fexist(SkinFile[playerid]))
- {
- INI_ParseFile(SkinFile[playerid],using inline "LoadUserData");
- }
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- if(SkinInfo[playerid][SavedSkin] == true) return SetPlayerSkin(playerid,SkinInfo[playerid][Skin]);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- new INI:File = INI_Open(SkinFile[playerid]);
- INI_WriteInt(File,"LastSkin",SkinInfo[playerid][Skin]);
- INI_WriteBool(File,"SavedSkin",SkinInfo[playerid][SavedSkin]);
- INI_Close(File);
- return 1;
- }
- //=================Commands=============================//
- CMD:saveskin(playerid,params[])
- {
- if(SkinInfo[playerid][SavedSkin] == true) return SendClientMessage(playerid,-1,"{FF0000}You already saved skin !");
- SkinInfo[playerid][SavedSkin] = true;
- new skin = GetPlayerSkin(playerid);
- SkinInfo[playerid][Skin] = skin;
- SendClientMessage(playerid,-1,"{FFFF00}You're save your skin , to delete him /DelSkin");
- return 1;
- }
- CMD:delskin(playerid,params[])
- {
- if(SkinInfo[playerid][SavedSkin] == false) return SendClientMessage(playerid,-1,"{FF0000}You have saved your skin.");
- SkinInfo[playerid][SavedSkin] = false;
- SendClientMessage(playerid,-1,"{FFFF00}You're deleted your skin , to save /SaveSkin");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement