Some of my script defines.
Код:
#define <YSI\Y_INI>
#define PATH "Users/%s.ini
then a enum to create the variables.
Код:
enum PlayerData
{
Player_Name[MAX_PLAYER_NAME],
Password[129],
Float:PosX,
Float:PosY,
Float:PosZ,
Float:Pos:A,
Interior,
VirtualWorld,
Skin
}
remember I'm sending with mobile so I can't indent correctly. Next the stock that saves the data.
Код:
stock Save_Info(playerid)
{
GetPlayerName(playerid, PlayerInfo[playerid][Player_Name], MAX_PLAYER_NAME);
GetPlayerPos(playerid, PlayerInfo[playerid][PosX], PlayerInfo[playerid][PosY], PlayerInfo[playerid][PosZ]);
GetPlayerFacingAngle(PlayerInfo[playerid][PosA]);
new PlayerFile[512];
Formar(PlayerFile, sizeof playerfile, PATH, PlayerInfo[playeid][Player_Name]);
new INI:File = INI_Open(PlayerFile);
INI_WriteString(File,"User Name", PlayerInfo[playerid][Player_Name]);
INI_WriteString(File,"Password", PlayerInfo[playerid][Password]);
INI_WriteFloat(File,"Pos X", PlayerInfo[playerid][PosX]);
INI_WriteFloat(File,"Pos Y", PlayerInfo[playerid][PosY]);
INI_WriteFloat(File,"Pos Z", PlayerInfo[playerid][PosZ]);
INI_WriteFloat(File,"Pos A", PlayerInfo[playerid][PosA]);
INI_WriteInt(File,"VirtualWorld", GetPlayerVirtualWorld(playerid));
INI_WriteInt(File,"Interior", GetPlayerInterior(playerid));
INI_WriteInt(File,"Skin", GetPlayerSkin(playerid));
INI_Close(File);
The stock on player register...
Код:
stock OnPlayerRegister(playerid, password[])
{
PlayerInfo[playerid][PosX] = 214.2363;
PlayerInfo[playerid][PosY] = 1878.2864;
PlayerInfo[playerid][PosZ] = 13.1406;
PlayerInfo[playerid][PosA] = 0.0;
PlayerInfo[playerid][VirtualWorld] = 0;
PlayerInfo[playerid][Interior] = 0;
PlayerInfo[playerid][Skin] = 0;
new PlayerFile[512];
GetPlayerName(playerid, PlayerInfo[playerid][Player_Name], MAX_PLAYER_NAME);
Formar(PlayerFile, sizeof playerfile, PATH, PlayerInfo[playeid][Player_Name]);
WP_Hash(PlayerInfo[playerid][Password], 129, password);
new INI:File = INI_Open(PlayerFile);
INI_WriteString(File,"User Name", PlayerInfo[playerid][Player_Name]);
INI_WriteString(File,"Password", PlayerInfo[playerid][Password]);
INI_WriteFloat(File,"Pos X", PlayerInfo[playerid][PosX]);
INI_WriteFloat(File,"Pos Y", PlayerInfo[playerid][PosY]);
INI_WriteFloat(File,"Pos Z", PlayerInfo[playerid][PosZ]);
INI_WriteFloat(File,"Pos A", PlayerInfo[playerid][PosA]);
INI_WriteInt(File,"VirtualWorld", PlayerInfo[playerid][VirtualWorld]);
INI_WriteInt(File,"Interior", PlayerInfo[playerid][Interior]);
INI_WriteInt(File,"Skin", PlayerInfo[playerid][Skin]);
INI_Close(File);
That is the saving code, on the disconect function I call the save_info stock and on the ondialog response I call the onplayerregister stock SaveInfo(playerid); and OnPlayerRegister(playerid, inputtext);
If you need other code just ask what code you need