SA-MP Forums Archive
CreateCP - 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: CreateCP (/showthread.php?tid=590427)



Skin Save Problйm - anassmaroc - 29.09.2015

hi guys i want save Skin From Skinlist (OnPlayerModelSelection)
Help me Please i Want is Saving

PHP код:
enum
    Skin
,
LoadPlayerAccount
    INI_Int
("Skin"PlayerInfo[playerid][Skin]);
OnPlayerConnect
    PlayerInfo
[playerid][Skin] = 0;
OnPlayerSpawn
    SetPlayerSkin
playeridPlayerInfo[playerid][Skin] );
OnPlayerModelSelection
    
if(listid == skinlist)
    {
        if(
response)
        {
           if(
PlayerInfo[playerid][Skin] == 1)
           {
           new 
skinid;
           
SetPlayerSkin(PlayerInfo[playerid][Skin], modelid);
           new 
INI:File INI_Open(UserPath(playerid));
           
INI_SetTag(File,"Player's Data");
           
INI_WriteInt(File"Skin",skinid);
           
INI_Close(File);
           
SendClientMessage(playerid0xFF0000FF" skin Changed");
           }
        }
        else 
SendClientMessage(playerid0xFF0000FF"Canceled skin selection");
        return 
1;
    }
OnPlayerDisconnect
        INI_WriteInt
(File"Skin"PlayerInfo[playerid][Skin]); 



Re: CreateCP - garotin - 29.09.2015

I did not quite understand what you want to do.


Re: CreateCP - PrO.GameR - 29.09.2015

PHP код:
SetPlayerSkin(PlayerInfo[playerid][Skin], modelid);
INI_WriteInt(File"Skin",skinid);
new 
skinid
These lines are wrong, it should be because:
Line 1) You are using the setskin syntax wrong, corrected: (playerid,modelid)
Line 2) You are saving an empty variable as player's skin, corrected: saving the modelid player chose
Line 3) You are creaitng an empty variable and also unnecessary one, corrected: changing player's skin in enum to the one he chose
PHP код:
SetPlayerSkin([playeridmodelid);
INI_WriteInt(File"Skin",modelid);
PlayerInfo[playerid][Skin]=modelid
and also this should be deleted, it doesn't make any sense and actually makes your system fail (unless you want the guy to save his skin only if he had skin ID 1 before.)
PHP код:
           if(PlayerInfo[playerid][Skin] == 1)
           { 
           }