27.03.2016, 13:52
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { new string[128], pname[MAX_PLAYER_NAME+1]; GetPlayerName(playerid, pname, sizeof(pname)); if(dialogid == 0) { if (!response) return Kick(playerid); if(response) { if(!strlen(inputtext)) return ShowDialog(playerid, 0); new INI:File = INI_Open(UserPath(playerid)); new rand1 = random(99999), rand2 = random(99999); INI_SetTag(File, "Player Data"); INI_WriteInt(File, "Password", udb_hash(inputtext)); INI_WriteInt(File, "Admin", 0); INI_WriteInt(File, "Tut", 0); INI_WriteInt(File, "Level", 1); INI_WriteInt(File, "ConnectTime", 0); INI_WriteInt(File, "Age", 0); INI_WriteInt(File, "Skin", 0); INI_WriteInt(File, "Internet", 0); INI_WriteInt(File, "HasCellphone", 0); INI_WriteInt(File, "Exp", 0); INI_WriteInt(File, "Gender", 0); INI_WriteInt(File, "Registered", 0); INI_WriteFloat(File, "Armour", 10); INI_WriteFloat(File, "Health", 100); INI_WriteInt(File, "Faction", 0); INI_WriteInt(File, "FactionTier", 0); INI_WriteString(File, "FactionRank", "None"); INI_WriteInt(File, "HandMoney", 70); INI_WriteInt(File, "BankMoney", 130); INI_WriteInt(File, "Mask", 0); INI_WriteInt(File, "MaskID", 0); INI_WriteInt(File, "PhoneNumber", 0); INI_WriteInt(File, "HouseOwner", 9999); INI_WriteInt(File, "HouseHey", Invalid_House_ID); INI_WriteInt(File, "HouseKey2", Invalid_House_ID); INI_WriteInt(File, "VehicleOwner", 9999); INI_WriteInt(File, "BizOwner", 9999); INI_WriteInt(File, "Weapon1", 0); INI_WriteInt(File, "Wep1Ammo", 0); INI_WriteInt(File, "Weapon2", 0); INI_WriteInt(File, "Wep2Ammo", 0); INI_WriteInt(File, "Weapon3", 0); INI_WriteInt(File, "Wep3Ammo", 0); INI_WriteInt(File, "Weapon4", 0); INI_WriteInt(File, "Wep4Ammo", 0); INI_WriteInt(File, "Weapon5", 0); INI_WriteInt(File, "Wep5Ammo", 0); INI_WriteInt(File, "lvDay", 0); INI_WriteInt(File, "lvMonth", 0); INI_WriteInt(File, "lvYear", 0); INI_WriteInt(File, "lvHour", 0); INI_WriteInt(File, "lvMinute", 0); INI_WriteInt(File, "lvSecond", 0); INI_WriteInt(File, "LastPos", 0); INI_WriteInt(File, "LastVW", 0); INI_WriteInt(File, "LastInt", 0); INI_WriteFloat(File, "LastX", 0); INI_WriteFloat(File, "LastY", 0); INI_WriteFloat(File, "LastZ", 0); INI_Close(File); format(string, sizeof(string), "SERVER:{FFFFFF} Welcome to the server, %s!", pname); SendClientMessage(playerid, 0x46E850FF, string); ShowDialog(playerid, 2); } } else if(dialogid == 1) // Login { if(response) { if(udb_hash(inputtext) == PlayerInfo[playerid][Pass]) { INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); GivePlayerMoney(playerid, PlayerInfo[playerid][HandMoney]); SetSpawnInfo(playerid, 0, 0, 0.00, 0.00, 0.00, 0.00, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); SetCameraBehindPlayer(playerid); } else { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "{FFFFFF}You have entered an {C44B4B}incorrect{FFFFFF} password.\nType your password below to login.", "Login", "Quit"); } } } else if(dialogid == 2) // Male or Female { if(response) { switch(listitem) { case 0: { PlayerInfo[playerid][Gender] = 1; SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You've set your character's gender to male."); } case 1: { PlayerInfo[playerid][Gender] = 2; SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You've set your character's gender to female."); } } } else { switch(listitem) { case 0: { PlayerInfo[playerid][Gender] = 1; SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You've set your character's gender to male, pick their age from the next dialog."); } case 1: { PlayerInfo[playerid][Gender] = 2; SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You've set your character's gender to female, pick her age from the next dialog."); } } ShowDialog(playerid, 3); } }