23.03.2014, 05:06
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == DTEAMS) { if(!response) return ShowPlayerDialog(playerid, DTEAMS, DIALOG_STYLE_LIST, "Teams:", ""#EMB_USA"United States of America\n"#EMB_GERMANY"Germany", "Select", ""); if(response) { switch(listitem) { case 0: { gTeam[playerid] = ARMY_TEAM; SetPlayerTeam(playerid, 0); SendClientMessage(playerid, COLOR_USA, "[Army]: You have chosen Army Team."); SendClientMessageToAll(COLOR_USA, "[Army]: Player %s has joined Army Team !"); ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Choose Classes", "[-] Assault | 0 Scores\n[-] Medic | 0 Scores\n[-] Sniper | 50 Scores\n[-] Engineer | 500 Scores\n[-] FlameThrower | 1000 Scores\n[-] Pilot | 1500 Scores", "Select", "Cancel"); } case 1: { gTeam[playerid] = TERROR_TEAM; SetPlayerTeam(playerid, 1); SendClientMessage(playerid, COLOR_RED, "[Terrorist]: You have chosen Terrorist Team."); SendClientMessageToAll(COLOR_RED, "[Terrorist]: Player %s has joined Terrorist Team !"); ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Choose Classes", "[-] Assault | 0 Scores\n[-] Medic | 0 Scores\n[-] Sniper | 50 Scores\n[-] Engineer | 500 Scores\n[-] FlameThrower | 1000 Scores\n[-] Pilot | 1500 Scores", "Select", "Cancel"); } } } } if(dialogid == 1) { if(response) { if(GetPlayerScore(playerid) >= 0)//Private { ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Assault Class", "You've choosed Assault Classes !\n\nClass Features :\n[-] Desert Eagle\n[-] M4\n[-] MP5\n[-] Tear Gas\n\nTo change class type /sc or /switchclass", "Close", ""); gPlayerClass[playerid] = ASSAULT_CLASS; PickedClass[playerid] = 1; SetPlayerVirtualWorld(playerid, 0); GivePlayerWeapon(playerid, 24, 20000); GivePlayerWeapon(playerid, 31, 50000); GivePlayerWeapon(playerid, 17, 5000); } if(listitem == 1)//sniper DONE { if(GetPlayerScore(playerid) >= 50)//Private { ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Sniper Class", "You've choosed Sniper Classes !\n\nClass Features :\n[-] Silenced Pistol\n[-] MP5\n[-] Sniper\n[-] Tear Gas\n\nTo change class type /sc or /switchclass", "Close", ""); gPlayerClass[playerid] = SNIPER_CLASS; PickedClass[playerid] = 1; SetPlayerVirtualWorld(playerid, 0); GivePlayerWeapon(playerid, 23, 50000); GivePlayerWeapon(playerid, 34, 10000); GivePlayerWeapon(playerid, 29, 2000); GivePlayerWeapon(playerid, 17, 5000); } else { ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Classes Selection", "You can't choose this class, you need atleast 50 Scores !\nPlease type /sc or /switchclass to change !!!", "Close", ""); } } if(listitem == 2)//Medic { if(GetPlayerScore(playerid) >= 0)//Private { ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Medic Class", "You've choosed Medic Classes !\n\nClass Features :\n[-] Silenced Pistol\n[-] MP5\n[-] Shotgun\n[-] Tear Gas\n\nTo change class type /sc or /switchclass", "Close", ""); gPlayerClass[playerid] = MEDIC_CLASS; PickedClass[playerid] = 1; SetPlayerVirtualWorld(playerid, 0); GivePlayerWeapon(playerid, 23, 5000); GivePlayerWeapon(playerid, 25, 1000); GivePlayerWeapon(playerid, 29, 2000); GivePlayerWeapon(playerid, 17, 5000); } } if(listitem == 3)//Engineer { if(GetPlayerScore(playerid) >= 500)//Sergeant { ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Engineer Class", "You've choosed Engineer Classes !\n\nClass Features :\n[-] Desert Eagle\n[-] M4\n[-] Combat Shotgun\n[-] Tec 9\n\nTo change class type /sc or /switchclass", "Close", ""); gPlayerClass[playerid] = ENGINEER_CLASS; PickedClass[playerid] = 1; SetPlayerVirtualWorld(playerid, 0); GivePlayerWeapon(playerid, 24, 1000); GivePlayerWeapon(playerid, 27, 5000); GivePlayerWeapon(playerid, 31, 5000); GivePlayerWeapon(playerid, 32, 5000); } else { ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Classes Selection", "You can't choose this class, you need atleast 500 Scores !\nPlease type /sc or /switchclass to change !!!", "Close", ""); } } if(listitem == 4)//FlameThrower { if(GetPlayerScore(playerid) >= 1000)//CAPTAIN { ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Flamethrower Class", "You've choosed Flame Thrower Classes !\n\nClass Features :\n[-] Silenced Pistol\n[-] UZI\n[-] Shotgun\n[-] Flamethrower\n\nTo change class type /sc or /switchclass", "Close", ""); gPlayerClass[playerid] = FLAMETHROWER_CLASS; PickedClass[playerid] = 1; SetPlayerVirtualWorld(playerid, 0); GivePlayerWeapon(playerid, 23, 2000); GivePlayerWeapon(playerid, 26, 2000); GivePlayerWeapon(playerid, 28, 2000); GivePlayerWeapon(playerid, 37, 100); } else { ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Classes Selection", "You can't choose this class, you need atleast 1000 Scores !\nPlease type /sc or /switchclass to change !!!", "Close", ""); } } if(listitem == 5)//pilot DONE { if(GetPlayerScore(playerid) >= 1500)//Lieutenant Colonel { ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Pilot Class", "You've choosed Pilot Classes !\n\nClass Features :\n[-] Desert Eagle\n[-] M4\n[-] Combat Shotgun\n[-] Tec 9\n[-] Country Rifle\n\nTo change class type /sc or /switchclass", "Close", ""); gPlayerClass[playerid] = AIRMAN_CLASS; PickedClass[playerid] = 1; SetPlayerVirtualWorld(playerid, 0); GivePlayerWeapon(playerid, 24, 5000); GivePlayerWeapon(playerid, 31, 5000); GivePlayerWeapon(playerid, 27, 5000); GivePlayerWeapon(playerid, 33, 5000); } else { ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Classes Selection", "You can't choose this class, you need atleast 1500 Scores !\nPlease type /sc or /switchclass to change !!!", "Close", ""); } } } } if(dialogid == DIALOG_REGISTER) { if (!response) return Kick(playerid); if(response) { if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Account Register",""COL_RED"You're new please register below!\n"COL_WHITE"Type your password below to register a new account.","Register","Quit"); 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,"Donators",0); INI_WriteInt(File,"Scores",0); INI_WriteInt(File,"Kills",0); INI_WriteInt(File,"Deaths",0); INI_Close(File); SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Account Created",""COL_GREEN"Good, your account is created now ! You can relog to test if its saved or not","Ok",""); } } if(dialogid == 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]); SetPlayerScore(playerid, PlayerInfo[playerid][pScores]); ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Account Access",""COL_GREEN"You have successfully access your account !\nWelcome Back :D","Ok",""); } else { new string[129]; format(string, sizeof(string), "Welcome Back!\n\nUsername : %s\n\n"cgreen"You're registered\n"COL_WHITE"Type your password below to login.", Name(playerid)); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Account Login", string,"Login","Quit"); } return 1; } } return 1; } }