Help please
#1

I'm wanting to to save peoples position after they logout and instead of returning to the class selection they will spawn in there skin, how would i do that?
Reply
#2

use this code

Under OnPlayerDisconnect


pawn Код:
new file[128], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), "\\skin\\%s.ini", pname);//skin will be the name of your folder in scriptfiles
if(!dini_Exists(file))
dini_Create(file);
dini_IntSet(file, "skin", GetPlayerSkin(playerid));
Under OnPlayerSpawn

pawn Код:
new file[128], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), "\\skin\\%s.ini", pname);
if(dini_Exists(file))
{
SetTimerEx("SpawnSave", 100, false, "d", playerid);
}
At the end

pawn Код:
forward SkinSave(playerid);

public SkinSave(playerid)
{
     new file[128], pname[MAX_PLAYER_NAME];
     GetPlayerName(playerid, pname, sizeof(pname));
     format(file, sizeof(file), "\\skin\\%s.ini", pname);
     SetPlayerSkin(playerid, dini_Int(file, "skin"));
     return 1;
}
Don't forget to edit \\skin\\ to your own filename
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)