06.04.2016, 18:43
Код:
public OnPlayerConnect(playerid) { new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); InterpolateCameraPos(playerid, 380.2796, -340.6636, 49.3404, -162.2861, 157.5699, 53.6954, 150000); InterpolateCameraLookAt(playerid, 381.0202, -341.3334, 49.4304, -162.9535, 158.3127, 53.8754, 100000); SetPlayerMapIcon(playerid, 1, 373.4215, -275.4926, 1.0578, 9, 0, MAPICON_LOCAL); SetTimer("LevelTimer", 1800000, true); TogglePlayerSpectating(playerid, 1); // remove "Spawn" button SetPlayerPos(playerid, -162.9535, 158.3127, 53.8754); if(fexist(UserPath(playerid))) { INI_ParseFile(UserPath(playerid), "LoadUser_user", .bExtra = true, .extra = playerid); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Type your password below to login.", "Login", "Quit"); } else ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Type your password below to register a new account.", "Register", "Quit"); PreloadAnimLib(playerid, "KNIFE"); PreloadAnimLib(playerid, "MEDIC"); return 1; }
Код:
public OnPlayerDisconnect(playerid, reason) { if(Logged[playerid] == true) { new year, month, day, hour, minute, second, Float: X, Float: Y, Float: Z, Float: hp, Float: armor; GetPlayerArmour(playerid, armor), GetPlayerHealth(playerid, hp); getdate(year, month, day), gettime(hour, minute, second), GetPlayerPos(playerid, X, Y, Z); GetPlayerWeaponData(playerid, 2, pInfo[playerid][Weapon1], pInfo[playerid][Wep1Ammo]); GetPlayerWeaponData(playerid, 3, pInfo[playerid][Weapon2], pInfo[playerid][Wep2Ammo]); GetPlayerWeaponData(playerid, 4, pInfo[playerid][Weapon3], pInfo[playerid][Wep3Ammo]); GetPlayerWeaponData(playerid, 5, pInfo[playerid][Weapon4], pInfo[playerid][Wep4Ammo]); GetPlayerWeaponData(playerid, 6, pInfo[playerid][Weapon5], pInfo[playerid][Wep5Ammo]); new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File, "Player Data"); // account related INI_WriteInt(File, "Admin", pInfo[playerid][Admin]); INI_WriteInt(File, "Level", pInfo[playerid][Level]); INI_WriteInt(File, "Skin", GetPlayerSkin(playerid)); INI_WriteInt(File, "Exp", pInfo[playerid][Exp]); INI_WriteInt(File, "CurExp", pInfo[playerid][CurExp]); INI_WriteInt(File, "Gender", pInfo[playerid][Gender]); INI_WriteInt(File, "Registered", pInfo[playerid][Registered]); INI_WriteInt(File, "HandMoney", GetPlayerMoney(playerid)); INI_WriteInt(File, "BankMoney", pInfo[playerid][BankMoney]); INI_WriteFloat(File, "Armour", armor); INI_WriteFloat(File, "Health", hp); // faction INI_WriteInt(File, "Faction", pInfo[playerid][Faction]); INI_WriteInt(File, "FactionTier", pInfo[playerid][FactionTier]); INI_WriteString(File, "FactionRank", pInfo[playerid][FactionRank]); INI_WriteInt(File, "Weapon1", pInfo[playerid][Weapon1]); INI_WriteInt(File, "Wep1Ammo", pInfo[playerid][Wep1Ammo]); INI_WriteInt(File, "Weapon2", pInfo[playerid][Weapon2]); INI_WriteInt(File, "Wep2Ammo", pInfo[playerid][Wep2Ammo]); INI_WriteInt(File, "Weapon3", pInfo[playerid][Weapon3]); INI_WriteInt(File, "Wep3Ammo", pInfo[playerid][Wep3Ammo]); INI_WriteInt(File, "Weapon4", pInfo[playerid][Weapon4]); INI_WriteInt(File, "Wep4Ammo", pInfo[playerid][Wep4Ammo]); INI_WriteInt(File, "Weapon5", pInfo[playerid][Weapon5]); INI_WriteInt(File, "Wep5Ammo", pInfo[playerid][Wep5Ammo]); // server-side INI_WriteInt(File, "LastPos", 1); INI_WriteInt(File, "LastInt", GetPlayerInterior(playerid)); INI_WriteInt(File, "LastVW", GetPlayerVirtualWorld(playerid)); INI_WriteFloat(File, "LastX", X); INI_WriteFloat(File, "LastY", Y); INI_WriteFloat(File, "LastZ", Z); INI_WriteInt(File, "Mask", pInfo[playerid][Mask]); INI_WriteInt(File, "MaskID", pInfo[playerid][MaskID]); INI_WriteInt(File, "PhoneNumber", pInfo[playerid][PhoneNumber]); INI_WriteInt(File, "HouseOwner", pInfo[playerid][HouseOwner]); INI_WriteInt(File, "BizOwner", pInfo[playerid][BizOwner]); INI_WriteInt(File, "VehicleOwner", pInfo[playerid][VehicleOwner]); // informational INI_WriteInt(File, "lvDay", day); INI_WriteInt(File, "lvMonth", month); INI_WriteInt(File, "lvYear", year); INI_WriteInt(File, "lvHour", hour); INI_WriteInt(File, "lvMinute", minute); INI_WriteInt(File, "lvSecond", second); INI_Close(File); } return 1; }