23.07.2015, 20:46
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch( dialogid ) { case DIALOG_REGISTER: { if (!response) return Kick(playerid); if(response) { if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"reg",""COL_WHITE"bad pass.\n"COL_WHITE"type pass to reg.","reg","exit"); new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); INI_WriteInt(File,"Password",udb_hash(inputtext)); INI_WriteInt(File,"Cash",0); INI_WriteInt(File,"Admin",0); INI_WriteInt(File,"Age",0); INI_WriteInt(File,"Sex",2); INI_WriteInt(File,"Skin",0); INI_WriteInt(File,"Location",0); INI_Close(File); ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT,"Age?","\nType age using numbers.","ok",""); } } case DIALOG_AGE: { if(!response) return Kick(playerid); if(response) { new age, message[64]; age = strval(inputtext); if(age < 13 || age > 70) { ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT,"Age?","Type age using numbers.","Ok",""); SendClientMessage(playerid, 0x33CCFFAA, "at least 13 years!"); } else { PlayerInfo[playerid][pAge] = age; SendClientMessage(playerid, 0x33CCFFAA, message); ShowPlayerDialog(playerid, DIALOG_SEX, DIALOG_STYLE_LIST,"male or female","male\nfemale","Ok",""); } } } case DIALOG_SEX: { if(response) { if(listitem == 0) { PlayerInfo[playerid][pSex] = 0; PlayerInfo[playerid][pSkin] = 20; printf("Skin has been set to 20"); ShowPlayerDialog(playerid, DIALOG_LOCATION, DIALOG_STYLE_LIST,"spawn","LS ","OK",""); } if(listitem == 1) { PlayerInfo[playerid][pSex] = 1; PlayerInfo[playerid][pSkin] = 12; printf("Skin has been set to 12"); ShowPlayerDialog(playerid, DIALOG_LOCATION, DIALOG_STYLE_LIST,"SPAWN","LOS SANTOS","OK",""); } } } case DIALOG_LOCATION: { if(!response) return Kick(playerid); if(response) { new message[64]; if(listitem == 0) { PlayerInfo[playerid][pLocation] = 0; format(message, sizeof(message), "MSG"); SendClientMessage(playerid, 0xFFFFFFFF, message); SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], 1713.6101,-1912.2190,13.5669,85.9081, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); } if(listitem == 1) { PlayerInfo[playerid][pLocation] = 1; format(message, sizeof(message), "MSG"); SendClientMessage(playerid, 0xFFFFFFFF, message); SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], 1642.1584, -2334.1926, -2.6797, 359.7559, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); } if(listitem == 2) { PlayerInfo[playerid][pLocation] = 2; format(message, sizeof(message), "MSG"); SendClientMessage(playerid, 0xFFFFFFFF, message); SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], 1642.1584, -2334.1926, -2.6797, 359.7559, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); } } } case DIALOG_LOGIN: { if ( !response ) return Kick ( playerid ); if( response ) { if(udb_hash(inputtext) == PlayerInfo[playerid][pPass]) { INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]); SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], 1642.1584, -2334.1926, -2.6797, 359.7559, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); } else { Kick(playerid); } return 1; } } } return 1; } if(clickedid == reglog7) { ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"REG!","\nWELCOME TO SRW\n{FFFFFF}HI THERE\n{FFFFFF}Forum {FFFFFF}www.SS.com\nENJOY!","REG","QT"); TextDrawHideForPlayer(playerid, reglog0); TextDrawHideForPlayer(playerid, reglog1); TextDrawHideForPlayer(playerid, reglog2); TextDrawHideForPlayer(playerid, reglog3); TextDrawHideForPlayer(playerid, reglog4); TextDrawHideForPlayer(playerid, reglog5); TextDrawHideForPlayer(playerid, reglog6); TextDrawHideForPlayer(playerid, reglog7); } if(clickedid== reglog6) { INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"LOGIN","\nAF\nForum www.CS.com\nPUT PASS TO LOGIN","LOG","EXIT"); TextDrawHideForPlayer(playerid, reglog0); TextDrawHideForPlayer(playerid, reglog1); TextDrawHideForPlayer(playerid, reglog2); TextDrawHideForPlayer(playerid, reglog3); TextDrawHideForPlayer(playerid, reglog4); TextDrawHideForPlayer(playerid, reglog5); TextDrawHideForPlayer(playerid, reglog6); TextDrawHideForPlayer(playerid, reglog7); } return 1; }