SA-MP Forums Archive
[HELP]Saving skin and spawning - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP]Saving skin and spawning (/showthread.php?tid=163913)



[HELP]Saving skin and spawning - LasTRace - 29.07.2010

Hai,

There are 300 skins (0 to 299) as i know, and i created a skin saving system. I mean, players will register, and it will create a "Skin=300" (id 300 for skins = nothing) into his skin file and will save it. In-game, players will type /skinsave, and it will save his/her current skin. After he re-joined, it will not teleport him to class selection (if skin id is not 300), game will spawn him automaticly. i tried it, but game crashes everytime :

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    new PlayerFile[50], ppName[50];
   
    GetPlayerName(playerid, ppName, sizeof(ppName));
    format(PlayerFile, sizeof(PlayerFile), "/users/%s.ini", ppName);
   
    PlayerInfo[playerid][Skin] = dini_Int(PlayerFile, "Skin");
   
    iSpawnSet[playerid] = 0;
    TextDrawShowForPlayer(playerid,Textdraw2);
    TextDrawShowForPlayer(playerid,Textdraw3);
    SetPlayerColor(playerid,playerColors[playerid]);
    if(PlayerInfo[playerid][Skin] != 300)
    {
        SetupPlayerForClassSelection(playerid);
    }
    else
    {
        SetPlayerSkin(playerid,PlayerInfo[playerid][Skin]);
        SpawnPlayer(playerid);
    }
    return 1;
}
How can i fix it?


Re: [HELP]Saving skin and spawning - ikey07 - 29.07.2010

Here you can try to set player skin 300 which doesnt exist.
pawn Код:
if(PlayerInfo[playerid][Skin] != 300)
    {
        SetupPlayerForClassSelection(playerid);
    }
    else
    {
        SetPlayerSkin(playerid,PlayerInfo[playerid][Skin]);  //atm here is 300s skin ID
        SpawnPlayer(playerid);
    }



Re: [HELP]Saving skin and spawning - LasTRace - 29.07.2010

can you tell me, how can i cancel class selection?