SHOW:
|
|
- or go back to the newest paste.
1 | //Credits to WildWave + Y_Less | |
2 | //Found bug ? Skype : ofekshirin or http://www.fxp.co.il/member.php?u=839912 | |
3 | //======Includes=======// | |
4 | #include <a_samp> | |
5 | #include <YSI\y_ini> | |
6 | #include <YSI\y_inline> | |
7 | #include <ZCMD> | |
8 | ||
9 | new SkinFile[MAX_PLAYERS][MAX_PLAYER_NAME]; | |
10 | ||
11 | enum sInfo | |
12 | { | |
13 | Skin, | |
14 | bool:SavedSkin | |
15 | } | |
16 | new SkinInfo[MAX_PLAYERS][sInfo]; | |
17 | public OnPlayerConnect(playerid) | |
18 | { | |
19 | GetPlayerName(playerid,SkinInfo[playerid],MAX_PLAYER_NAME+1) && format(SkinFile[playerid],sizeof(SkinFile),"Skin/%s.ini",SkinInfo[playerid]); | |
20 | inline LoadUserData(string:name[],string:value[]) | |
21 | { | |
22 | INI_Int("LastSkin",SkinInfo[playerid][Skin]); | |
23 | INI_Bool("SavedSkin",SkinInfo[playerid][SavedSkin]); | |
24 | } | |
25 | if(fexist(SkinFile[playerid])) | |
26 | { | |
27 | INI_ParseFile(SkinFile[playerid],using inline "LoadUserData"); | |
28 | } | |
29 | return 1; | |
30 | } | |
31 | public OnPlayerSpawn(playerid) | |
32 | { | |
33 | if(SkinInfo[playerid][SavedSkin] == true) return SetPlayerSkin(playerid,SkinInfo[playerid][Skin]); | |
34 | return 1; | |
35 | } | |
36 | public OnPlayerDisconnect(playerid, reason) | |
37 | { | |
38 | new INI:File = INI_Open(SkinFile[playerid]); | |
39 | INI_WriteInt(File,"LastSkin",SkinInfo[playerid][Skin]); | |
40 | INI_WriteBool(File,"SavedSkin",SkinInfo[playerid][SavedSkin]); | |
41 | INI_Close(File); | |
42 | return 1; | |
43 | } | |
44 | //=================Commands=============================// | |
45 | CMD:saveskin(playerid,params[]) | |
46 | { | |
47 | if(SkinInfo[playerid][SavedSkin] == true) return SendClientMessage(playerid,-1,"{FF0000}You already saved skin !"); | |
48 | SkinInfo[playerid][SavedSkin] = true; | |
49 | new skin = GetPlayerSkin(playerid); | |
50 | SkinInfo[playerid][Skin] = skin; | |
51 | SendClientMessage(playerid,-1,"{FFFF00}You're save your skin , to delete him /DelSkin"); | |
52 | return 1; | |
53 | } | |
54 | CMD:delskin(playerid,params[]) | |
55 | { | |
56 | if(SkinInfo[playerid][SavedSkin] == false) return SendClientMessage(playerid,-1,"{FF0000}You have saved your skin."); | |
57 | SkinInfo[playerid][SavedSkin] = false; | |
58 | SendClientMessage(playerid,-1,"{FFFF00}You're deleted your skin , to save /SaveSkin"); | |
59 | return 1; | |
60 | } |