22.11.2015, 15:45
I need help adding these OnDialogResponse's inside one another so its one, sadly i made two by accident lol because i took one from my filterscript...
MAKE THIS THE MAIN:
ADD THIS TOO THE MAIN ONE:
Thanks in advance.
MAKE THIS THE MAIN:
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { new string[256]; if(strfind(inputtext, "%s", true) != -1) { format(string, sizeof(string), "AdmCmd: %s was kicked by system, Reason: Dialog Exploiting", GetName(playerid)); SendClientMessageToAll(COLOR_LIGHTRED, string); Kick(playerid); return 1; } switch( dialogid ) { case DIALOG_BAR: { if(!response) return -1; if(response) { switch(listitem) { // 0 = Beer ($2) 1= Wine ($5) 2= Cocktail ($4) 3= Piсacolada ($4) 4= Mojito ($4) 5=Cider ($3) 6=Sprunk ($1) case 0: { SetPVarInt(playerid, "DrinkPrice", 2); SetPVarString(playerid, "DrinkName", "bottle of beer"); SetPVarInt(playerid, "Animation", SPECIAL_ACTION_DRINK_BEER); } case 1: { SetPVarInt(playerid, "DrinkPrice", 5); SetPVarString(playerid, "DrinkName", "glass wine"); SetPVarInt(playerid, "Animation", SPECIAL_ACTION_DRINK_WINE); } case 2: { SetPVarInt(playerid, "DrinkPrice", 4); SetPVarString(playerid, "DrinkName", "cocktail"); SetPVarInt(playerid, "Animation", SPECIAL_ACTION_DRINK_WINE); } case 3: { SetPVarInt(playerid, "DrinkPrice", 4); SetPVarString(playerid, "DrinkName", "glass of piсacolada"); SetPVarInt(playerid, "Animation", SPECIAL_ACTION_DRINK_WINE); } case 4: { SetPVarInt(playerid, "DrinkPrice", 4); SetPVarString(playerid, "DrinkName", "glass of mojito"); } case 5: { SetPVarInt(playerid, "DrinkPrice", 3); SetPVarString(playerid, "DrinkName", "bottle of cider"); } case 6: { SetPVarInt(playerid, "DrinkPrice", 1); SetPVarString(playerid, "DrinkName", "cup of sprunk"); } } new price = GetPVarInt(playerid, "DrinkPrice"); new drink[56]; GetPVarString(playerid, "DrinkName", drink, sizeof(drink)); new action = GetPVarInt(playerid, "Animation"); SetPlayerSpecialAction(playerid, action); if(price > PlayerInfo[playerid][pCash]) return SendClientMessage(playerid, -1, "You can't afford the drink."); new str[126]; format(str, sizeof(str), "You bought a %s for $%i", drink, price); SendClientMessage(playerid, -1, str); return 1; } } case DIALOG_CHANGENAME: { if(!response) return -1; if(response) { if(doesAccountExist(inputtext)) return SendClientMessage(playerid, -1, "Name is already taken."); new oldName[MAX_PLAYER_NAME], str[150]; GetPlayerName(playerid, oldName, sizeof(oldName)); new name[MAX_PLAYER_NAME]; format(name, sizeof(name), "%s", inputtext); SetPlayerName(playerid, name); new PlayerName[MAX_PLAYER_NAME], Length; GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); Length = strlen(PlayerName); if(oldName[playerid] == PlayerName[playerid]) return 1; if(PlayerName[Length - 1] == '_' || PlayerName[0] == '_' || strfind(PlayerName, "_", false) == -1) { SetPlayerName(playerid, oldName); SendClientMessage(playerid, COLOR_CYAN, "You failed to select a role play name, please select another name."); ShowPlayerDialog(playerid, DIALOG_CHANGENAME, DIALOG_STYLE_INPUT,""COL_WHITE"Name Change",""COL_WHITE"Type in another name to use.","Change","No!"); return 1; } format(str, sizeof(str), "AdmWarn: %s (ID: %i) has changed name to %s.", oldName, playerid, name); SendClientMessageToAdmins(COLOR_YELLOW, str, 1); new account[126]; format(account, sizeof(account), "/users/%s.ini", oldName); pass[playerid] = PlayerInfo[playerid][pPass]; SetPVarInt(playerid, "RecentlyChangedName", 1); fremove(account); Log("/logs/changename.txt", str); SaveChar(playerid); INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); return 1; } } case DIALOG_REGISTER: { if (!response) return Kick(playerid); if(response) { if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\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,"Health", 100); INI_Close(File); ShowPlayerDialog(playerid, DIALOG_QUIZ, DIALOG_STYLE_LIST, "Quiz - What is deathmatching?", "Duelling someone.\nHaving a boxing fight with someone to death.\nShooting someone for no In Character reason.", "Answer", "Quit"); ForceClassSelection(playerid); Connected[playerid] = 1; SetPlayerCameraPos(playerid, 1545.2980, -1361.2811, 368.0274); SetPlayerCameraLookAt(playerid, 1545.1799, -1362.2729, 367.2717); InterpolateCameraLookAt(playerid, 1590.0299, -1689.4938, 47.3620, 1412.5718, -1690.9845, 41.9617, 5000, CAMERA_MOVE); } } case DIALOG_BUYCAR: { if (!response) return RemovePlayerFromVehicle(playerid); if(response) { new car, str[126], ownedcar; car = GetVehicleModel(GetPlayerVehicleID(playerid)); for(new x;x<MAX_PLAYER_VEHICLES;x++) { if(GetVehicleCost(car) == -1) { SendClientMessage(playerid, -1, "Default price has not been changed yet, you can not buy this vehicle."); RemovePlayerFromVehicle(playerid); return 1; } if(PlayerInfo[playerid][pVehicle][x] == 0) { new rand = random(255), rand2 = random(255); if(PlayerInfo[playerid][pCash] < GetVehicleCost(car)) { SendClientMessage(playerid, -1, "You don't have enough cash."); RemovePlayerFromVehicle(playerid); return 1; } PlayerInfo[playerid][pVehicle][x] = car; PlayerInfo[playerid][pCash] -= GetVehicleCost(car); SetVehicleToRespawn(GetPlayerVehicleID(playerid)); RemovePlayerFromVehicle(playerid); PlayerInfo[playerid][pVehicleSpawned][x] = 1; PlayerInfo[playerid][pVehiclePosX][x] = 555.87; PlayerInfo[playerid][pVehiclePosY][x] = -1265.16; PlayerInfo[playerid][pVehiclePosZ][x] = 17.24; PlayerInfo[playerid][pVehicleCol1][x] = rand; PlayerInfo[playerid][pVehicleCol1][x] = rand2; ownedcar = CreateVehicle(car, PlayerInfo[playerid][pVehiclePosX][x], PlayerInfo[playerid][pVehiclePosY][x], PlayerInfo[playerid][pVehiclePosZ][x], 0, rand, rand2, 0); PlayerInfo[playerid][pVehicleSpawnedID][x] = ownedcar; PutPlayerInVehicle(playerid, ownedcar, 0); format(str, sizeof(str), "MoneyTrace: %s bought a car (MID: %i) for %i.", GetName(playerid), car, GetVehicleCost(car)); Log("/logs/moneytrace.txt", str); format(str, sizeof(str), "You bought a car for %i. (%i)", GetVehicleCost(car), ownedcar); SendClientMessage(playerid, -1, str); new plate[126]; format(plate, sizeof(plate), "LS%i", ownedcar); SetVehicleNumberPlate(ownedcar, plate); break; } } } } case DIALOG_QUIZ: { if (!response) return Kick(playerid); if(response) { if(listitem != 2) { SendClientMessage(playerid, COLOR_NEWBIE, "~~ ~~ Wrong Answer! ~~! ~~"); ShowPlayerDialog(playerid, DIALOG_QUIZ3, DIALOG_STYLE_LIST, "Quiz - What is powergaming?", "Forcing a roleplay action towards a player, not giving them a chance to resist.\nUsing the powers of fast cars to escape the police.\nFlying a plane without a pilot's license.", "Answer", "Quit"); quizwrong[playerid] += 1; } if(listitem == 2) { SendClientMessage(playerid, COLOR_NEWBIE, "~~ ~~ Correct answer! ~~! ~~"); ShowPlayerDialog(playerid, DIALOG_QUIZ2, DIALOG_STYLE_LIST, "Quiz - What is metagaming?", "Forcing roleplay action towards a player, not giving them a chance to resist.\nUsing OOC information ICly.\nCommitting crimes in a crowded place.", "Answer", "Quit"); InterpolateCameraPos(playerid, 1544.7931, -1362.1440, 366.9819, 1459.6842, -1661.7963, 57.8967, 5000, CAMERA_MOVE); InterpolateCameraLookAt(playerid, 1412.5718, -1690.9845, 41.9617, 1531.1875, -1672.8884, 27.4342, 5000, CAMERA_MOVE); } } return 1; } case DIALOG_QUIZ2: { if (!response) return Kick(playerid); if(response) { if(listitem != 1) { SendClientMessage(playerid, COLOR_NEWBIE, "~~ Wrong Answer! ~~."); quizwrong[playerid] += 1; ShowPlayerDialog(playerid, DIALOG_QUIZ5, DIALOG_STYLE_LIST, "Quiz - What do you do if you spot a hacker?", "PM them to stop hacking.\nCalmly report the player, and try to avoid him.\nPM admins in game.", "Answer", "Quit"); } if(quizwrong[playerid] > 2) { SendClientMessage(playerid, -1, "You failed the quiz."); Kick(playerid); } if(listitem == 1) { InterpolateCameraPos(playerid, 1459.6842, -1661.7963, 57.8967, 1474.3441, -1709.7754, 37.5671, 5000, CAMERA_MOVE); InterpolateCameraLookAt(playerid, 1531.1875, -1672.8884, 27.4342, 1477.4785, -1726.4415, 30.8563, 5000, CAMERA_MOVE); SendClientMessage(playerid, COLOR_NEWBIE, "~~ Correct answer! ~~."); ShowPlayerDialog(playerid, DIALOG_QUIZ3, DIALOG_STYLE_LIST, "Quiz - What is powergaming?", "Forcing a roleplay action toward a player, not giving them a chance to resist.\nUsing the powers of fast cars to escape the police.\nFlying a plane without a pilot's license.", "Answer", "Quit"); } } return 1; } case DIALOG_QUIZ3: { if (!response) return Kick(playerid); if(response) { if(listitem != 0) { SendClientMessage(playerid, COLOR_NEWBIE, "~~ Wrong Answer! ~~."); quizwrong[playerid] += 1; ShowPlayerDialog(playerid, DIALOG_QUIZ5, DIALOG_STYLE_LIST, "Quiz - How do you properly take out a big weapon?", "/me takes out a gun\n/me pops open the trunk as he grasps his shotgun.\nJust take it out.", "Answer", "Quit"); } if(quizwrong[playerid] > 2) { SendClientMessage(playerid, -1, "You failed the quiz."); Kick(playerid); } if(listitem == 0) { InterpolateCameraPos(playerid, 1474.3441, -1709.7754, 37.5671, 2162.6824, -1756.9773, 45.1830, 5000, CAMERA_MOVE); InterpolateCameraLookAt(playerid, 1477.4785, -1726.4415, 30.8563, 2220.4507, -1726.3226, 18.5690, 3000, CAMERA_MOVE); SendClientMessage(playerid, COLOR_NEWBIE, "~~ Correct answer! ~~."); ShowPlayerDialog(playerid, DIALOG_QUIZ4, DIALOG_STYLE_LIST, "Quiz - What do you do if you spot a hacker?", "PM them to stop hacking.\nCalmly report the player, and try to avoid him.\nPM admins in game.", "Answer", "Quit"); } } return 1; } case DIALOG_QUIZ4: { if (!response) return Kick(playerid); if(response) { if(listitem != 1) { SendClientMessage(playerid, COLOR_NEWBIE, "~~ Wrong Answer! ~~."); quizwrong[playerid] += 1; ShowPlayerDialog(playerid, DIALOG_QUIZ6, DIALOG_STYLE_LIST, "Quiz - What is roleplay?", "Playing a role as a serial killer.\nHelping in /newb.\nActing out a character realisticly and using /me and /do.", "Answer", "Quit"); } if(quizwrong[playerid] > 2) { SendClientMessage(playerid, -1, "You failed the quiz."); Kick(playerid); } if(listitem == 1) { SendClientMessage(playerid, COLOR_NEWBIE, "~~ Correct answer! ~~."); InterpolateCameraPos(playerid, 2162.6824, -1756.9773, 45.1830, 2265.1353, -2682.1121, 88.5434, 5000, CAMERA_MOVE); InterpolateCameraLookAt(playerid, 2220.4507, -1726.3226, 18.5690, 2201.1077, -2638.2690, 16.4266, 3000, CAMERA_MOVE); ShowPlayerDialog(playerid, DIALOG_QUIZ5, DIALOG_STYLE_LIST, "Quiz - How do you properly take out a big weapon?", "/me takes out a gun\n/me pops open the trunk as he grasps his shotgun.\nJust take it out.", "Answer", "Quit"); } } return 1; } case DIALOG_QUIZ5: { if (!response) return Kick(playerid); if(response) { if(listitem != 1) { SendClientMessage(playerid, COLOR_NEWBIE, "~~ Wrong Answer! ~~."); quizwrong[playerid] += 1; ShowPlayerDialog(playerid, DIALOG_QUIZ7, DIALOG_STYLE_LIST, "Quiz - If you need help, what do you do?", "Ask politely on /newb about your issues.\nPM the admins that are online.\nAsk everyone around you on /b.", "Answer", "Quit"); } if(quizwrong[playerid] > 2) { SendClientMessage(playerid, -1, "You failed the quiz."); Kick(playerid); } if(listitem == 1) { SendClientMessage(playerid, COLOR_NEWBIE, "~~ Correct answer! ~~."); InterpolateCameraPos(playerid, 2265.1353, -2682.1121, 88.5434, 1306.0331, -1283.6243, 52.5546, 5000, CAMERA_MOVE); InterpolateCameraLookAt(playerid, 2201.1077, -2638.2690, 16.4266, 1360.0269, -1280.1663, 18.9822, 3000, CAMERA_MOVE); ShowPlayerDialog(playerid, DIALOG_QUIZ6, DIALOG_STYLE_LIST, "Quiz - What is roleplay?", "Playing a role as a serial killer.\nHelping in /newb.\nActing out a character realisticly and using /me and /do.", "Answer", "Quit"); } } return 1; } case DIALOG_QUIZ6: { if (!response) return Kick(playerid); if(response) { if(listitem != 2) { SendClientMessage(playerid, COLOR_NEWBIE, "~~ Wrong Answer! ~~."); quizwrong[playerid] += 1; ShowPlayerDialog(playerid, DIALOG_QUIZ8, DIALOG_STYLE_LIST, "Quiz - What is IC and OOC?", "In Car and Out Of Car.\nInjured Crackhead and Out Of Crack\nIn Character and Out Of Character", "Answer", "Quit"); } if(quizwrong[playerid] > 2) { SendClientMessage(playerid, -1, "You failed the quiz."); Kick(playerid); } if(listitem == 2) { SendClientMessage(playerid, COLOR_NEWBIE, "~~ Correct answer! ~~."); InterpolateCameraPos(playerid, 1306.0331, -1283.6243, 52.5546, 1223.0563, -1304.5181, 59.4092, 5000, CAMERA_MOVE); InterpolateCameraLookAt(playerid, 1360.0269, -1280.1663, 18.9822, 1177.9976, -1353.1117, 29.8385, 3000, CAMERA_MOVE); ShowPlayerDialog(playerid, DIALOG_QUIZ7, DIALOG_STYLE_LIST, "Quiz - If you need help, what do you do?", "Ask politely on /newb about your issues.\nPM the admins that are online.\nAsk everyone around you on /b.", "Answer", "Quit"); } } return 1; } case DIALOG_QUIZ7: { if (!response) return Kick(playerid); if(response) { if(listitem != 0) { SendClientMessage(playerid, COLOR_NEWBIE, "~~ Wrong Answer! ~~."); quizwrong[playerid] += 1; if(quizwrong[playerid] > 2) { SendClientMessage(playerid, -1, "You failed the quiz."); Kick(playerid); } ShowPlayerDialog(playerid, DIALOG_SKIN, DIALOG_STYLE_INPUT,""COL_WHITE"Select Skin",""COL_WHITE"You passed the test. Select a skin to start with. Valid skin IDs are 0 to 299.","Change","No"); } if(listitem == 0) { SendClientMessage(playerid, COLOR_NEWBIE, "~~ Correct answer! ~~."); InterpolateCameraPos(playerid, 1223.0563, -1304.5181, 59.4092, 1395.4175, -937.2007, 106.7558, 5000, CAMERA_MOVE); InterpolateCameraLookAt(playerid, 1177.9976, -1353.1117, 29.8385, 1407.9408, -840.4412, 86.2264, 3000, CAMERA_MOVE); ShowPlayerDialog(playerid, DIALOG_QUIZ8, DIALOG_STYLE_LIST, "Quiz - What is IC and OOC?", "In Car and Out Of Car.\nInjured Crackhead and Out Of Crack\nIn Character and Out Of Character", "Answer", "Quit"); } } return 1; } case DIALOG_QUIZ8: { if (!response) return Kick(playerid); if(response) { if(listitem != 2) { SendClientMessage(playerid, COLOR_NEWBIE, "~~ Wrong answer! ~~"); quizwrong[playerid] += 1; } if(quizwrong[playerid] > 2) { SendClientMessage(playerid, -1, "You failed the quiz."); Kick(playerid); } if(listitem == 2) { SendClientMessage(playerid, COLOR_NEWBIE, "You have passed the test."); InterpolateCameraPos(playerid, 1395.4175, -937.2007, 106.7558, 1543.3014, -1329.3446, 647.5134, 5000, CAMERA_MOVE); InterpolateCameraLookAt(playerid, 1407.9408, -840.4412, 86.2264, 1543.0229, -1358.7617, 334.1657, 3000, CAMERA_MOVE); ShowPlayerDialog(playerid, DIALOG_SKIN, DIALOG_STYLE_INPUT,""COL_WHITE"Select Skin",""COL_WHITE"You passed the test. Select a skin to start with. Valid skin IDs are 0 to 299.","Change","No"); } } return 1; } case DIALOG_247: { if(!response) { ProxDetector(50.0, playerid, "Shop Clerk: Alright, come back later then.", COLOR_WHITE); ProxDetector(50.0, playerid, "Shop Clerk waves you off, once again!", COLOR_PURPLE); return 1; } if(response) { new cost, str[126]; if(listitem == 0) { new numb = 1 + random(100000); if(numb == 911) { numb = numb + random(100000-numb); } if(numb == 555) { numb = numb + random(100000-numb); } if(numb == 0) { numb = 1 + random(100000); } if(CheckPh(numb) == 1) { numb = random(100000); } if(CheckPh(numb) == 1) { ProxDetector(50.0, playerid, "Shop Clerk: Uh, we had an error setting up your phone. Try again.", COLOR_GRAD1); return 1; } AddPh(PlayerInfo[playerid][pPhone], numb); PlayerInfo[playerid][pPhone] = numb; cost = 600; SendClientMessage(playerid, -1, "You bought a cellphone."); PlayerInfo[playerid][pCash] -= cost; format(str, sizeof(str), "MoneyTrace: %s bought a cellphone for $%i", GetName(playerid), cost); Log("/logs/moneytrace.txt", str); format(str, sizeof(str), "Your number is %i.", numb); SendClientMessage(playerid, -1, str); return 1; } if(listitem == 1) { cost = 300; if(PlayerInfo[playerid][pSpraycan] > 25) return SendClientMessage(playerid, COLOR_GREY, "You can't hold more spraycans."); SendClientMessage(playerid, -1, "You bought 5 spraycans."); PlayerInfo[playerid][pCash] -= cost; PlayerInfo[playerid][pSpraycan] += 5; format(str, sizeof(str), "MoneyTrace: %s bought 5 spraycans for $%i", GetName(playerid), cost); Log("/logs/moneytrace.txt", str); return 1; } if(listitem == 2) { cost = 1; SendClientMessage(playerid, -1, "Item 3"); PlayerInfo[playerid][pCash] -= cost; format(str, sizeof(str), "MoneyTrace: %s bought Item 3 for $%i", GetName(playerid), cost); Log("/logs/moneytrace.txt", str); return 1; } if(listitem == 3) { cost = 1; SendClientMessage(playerid, -1, "Item 4"); PlayerInfo[playerid][pCash] -= cost; format(str, sizeof(str), "MoneyTrace: %s bought Item 4 for $%i", GetName(playerid), cost); Log("/logs/moneytrace.txt", str); return 1; } if(listitem == 4) { cost = 1; SendClientMessage(playerid, -1, "Item 5"); PlayerInfo[playerid][pCash] -= cost; format(str, sizeof(str), "MoneyTrace: %s bought Item 5 for $%i", GetName(playerid), cost); Log("/logs/moneytrace.txt", str); return 1; } if(listitem == 5) { cost = 1; SendClientMessage(playerid, -1, "Item 6"); PlayerInfo[playerid][pCash] -= cost; format(str, sizeof(str), "MoneyTrace: %s bought Item 6 for $%i", GetName(playerid), cost); Log("/logs/moneytrace.txt", str); return 1; } } } case DIALOG_CIA: { if(!response) { return 1; } if(response) { if(listitem == 0) { if(badge[playerid] == 0) { SetPlayerColor(playerid, COLOR_LIGHTRED); badge[playerid] = 1; SkipWepCheck(playerid); SkipACheck(playerid); PlayerInfo[playerid][pArmor] = 100; SetPlayerArmour(playerid, 100); SetPlayerHealth(playerid, 100); GivePlayerValidWeapon(playerid, 24, 999999); GivePlayerValidWeapon(playerid, 29, 999999); GivePlayerValidWeapon(playerid, 3, 999999); GivePlayerValidWeapon(playerid, 25, 999999); GivePlayerValidWeapon(playerid, 41, 999999); PlayerInfo[playerid][pSkin] = 286; SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); return 1; } if(badge[playerid] == 1) { SetPlayerColor(playerid, 0xFFFFFF00); badge[playerid] = 0; SkipWepCheck(playerid); SkipACheck(playerid); PlayerInfo[playerid][pArmor] = 100; SetPlayerArmour(playerid, 100); SetPlayerHealth(playerid, 100); ResetPlayerWeapons(playerid); ResetPlayerWeaponsEx(playerid); PlayerInfo[playerid][pSkin] = 2; SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); return 1; } } if(listitem == 1) { ShowPlayerDialog(playerid, DIALOG_CIA2, DIALOG_STYLE_LIST, "Equipment", "Desert Eagle ($0)\nShotgun ($0)\nMP5 ($0)\nM4($0)\nSpray Can ($0)\nNitestick\nSpas-12 ($600)\nSniper ($700)\nFirst Aid Kit\nKevlar Vest", "Ok", "Close"); return 1; } if(listitem == 2) { ShowPlayerDialog(playerid, DIALOG_CIA3, DIALOG_STYLE_LIST, "Uniform", "CIA Agent (Blue Coat)\nAgent\nAgent\nDark Agent\nBlack Agent", "Ok", "Close"); return 1; } if(listitem == 3) { ShowPlayerDialog(playerid, DIALOG_UNINVITESKIN, DIALOG_STYLE_INPUT,""COL_WHITE"Skin change",""COL_WHITE"Select a skin to use. Valid skin IDs are 0 to 299.","Change","No"); return 1; } if(listitem == 4) { ShowPlayerDialog(playerid, DIALOG_CHANGENAME, DIALOG_STYLE_INPUT,""COL_WHITE"Name Change",""COL_WHITE"Change your identity to go undercover.","Change","No"); return 1; } } return 1; } case DIALOG_CIA2: { if(!response) { ShowPlayerDialog(playerid, DIALOG_CIA, DIALOG_STYLE_LIST, "Locker", "Duty\nEquipment\nUniform\nSelect Skin\nChange Name", "Ok", "Close"); return 1; } if(response) { switch(listitem) { case 0: { SkipWepCheck(playerid); GivePlayerValidWeapon(playerid, 24, 99999); } case 1: { SkipWepCheck(playerid); GivePlayerValidWeapon(playerid, 25, 99999); } case 2: { SkipWepCheck(playerid); GivePlayerValidWeapon(playerid, 29, 99999); } case 3: { SkipWepCheck(playerid); GivePlayerValidWeapon(playerid, 31, 99999); } case 4: { SkipWepCheck(playerid); GivePlayerValidWeapon(playerid, 41, 99999); } case 5: { SkipWepCheck(playerid); GivePlayerValidWeapon(playerid, 3, 1); } case 6: { if(PlayerInfo[playerid][pCash] < 600) { SendClientMessage(playerid, -1, "You don't have enough cash to buy this."); return -1; } GivePlayerValidWeapon(playerid, 27, 99999); PlayerInfo[playerid][pCash] -= 600; } case 7: { if(PlayerInfo[playerid][pCash] < 700) { SendClientMessage(playerid, -1, "You don't have enough cash to buy this."); return -1; } GivePlayerValidWeapon(playerid, 34, 99999); PlayerInfo[playerid][pCash] -= 700; } case 8: { SetPlayerHealth(playerid, 100); } case 9: { SkipACheck(playerid); PlayerInfo[playerid][pArmor] = 100; SetPlayerArmour(playerid, 100); } } return 1; } return 1; } case DIALOG_CIA3: { if(!response) { ShowPlayerDialog(playerid, DIALOG_CIA, DIALOG_STYLE_LIST, "Locker", "Duty\nEquipment\nUniform\nSelect Skin\nChange Name", "Ok", "Close"); return 1; } if(response) { if(listitem == 0) { PlayerInfo[playerid][pSkin] = 286; // CIA skin SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); } if(listitem == 1) { PlayerInfo[playerid][pSkin] = 165; // White Agent with a black suit SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); } if(listitem == 2) { PlayerInfo[playerid][pSkin] = 164; // White Agent with a black suit SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); } if(listitem == 3) { PlayerInfo[playerid][pSkin] = 163; // Dark Agent with a black suit SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); } if(listitem == 4) { PlayerInfo[playerid][pSkin] = 166; // Black Agent SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); } return 1; } return 1; } case DIALOG_LSPD: { if(!response) { return 1; } if(response) { if(listitem == 0) { if(badge[playerid] == 0) { SetPlayerColor(playerid, 0x0800FF00); badge[playerid] = 1; SkipWepCheck(playerid); SkipACheck(playerid); PlayerInfo[playerid][pArmor] = 100; SetPlayerArmour(playerid, 100); SetPlayerHealth(playerid, 100); GivePlayerValidWeapon(playerid, 24, 99999); GivePlayerValidWeapon(playerid, 29, 99999); GivePlayerValidWeapon(playerid, 3, 99999); GivePlayerValidWeapon(playerid, 25, 99999); GivePlayerValidWeapon(playerid, 41, 99999); PlayerInfo[playerid][pSkin] = 280; SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); return 1; } if(badge[playerid] == 1) { SetPlayerColor(playerid, 0xFFFFFF00); badge[playerid] = 0; SkipWepCheck(playerid); SkipACheck(playerid); PlayerInfo[playerid][pArmor] = 100; SetPlayerArmour(playerid, 100); SetPlayerHealth(playerid, 100); ResetPlayerWeapons(playerid); ResetPlayerWeaponsEx(playerid); PlayerInfo[playerid][pSkin] = 2; SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); return 1; } } if(listitem == 1) { ShowPlayerDialog(playerid, DIALOG_LSPD2, DIALOG_STYLE_LIST, "Equipment", "Desert Eagle ($0)\nShotgun ($0)\nMP5 ($0)\nM4($0)\nSpray Can ($0)\nNitestick\nSpas-12 ($700)\nSniper ($800)\nFirst Aid Kit\nKevlar Vest", "Ok", "Close"); return 1; } if(listitem == 2) { ShowPlayerDialog(playerid, DIALOG_LSPD3, DIALOG_STYLE_LIST, "Uniform", "Cadet\nOfficer\nCorporal\nCorporal2\nCorporal3\nBike Officer\nSergeant\nLieutenant\nChief\nSWAT", "Ok", "Close"); return 1; } if(listitem == 2) { ShowPlayerDialog(playerid, DIALOG_UNINVITESKIN, DIALOG_STYLE_INPUT,""COL_WHITE"Skin change",""COL_WHITE"Select a skin to use. Valid skin IDs are 0 to 299.","Change","No"); return 1; } } return 1; } case DIALOG_LSPD2: { if(!response) { ShowPlayerDialog(playerid, DIALOG_LSPD, DIALOG_STYLE_LIST, "Locker", "Duty\nEquipment\nUniform\nSelect Skin", "Ok", "Close"); return 1; } if(response) { switch(listitem) { case 0: { SkipWepCheck(playerid); GivePlayerValidWeapon(playerid, 24, 99999); } case 1: { SkipWepCheck(playerid); GivePlayerValidWeapon(playerid, 25, 99999); } case 2: { SkipWepCheck(playerid); GivePlayerValidWeapon(playerid, 29, 99999); } case 3: { SkipWepCheck(playerid); GivePlayerValidWeapon(playerid, 31, 99999); } case 4: { SkipWepCheck(playerid); GivePlayerValidWeapon(playerid, 41, 99999); } case 5: { SkipWepCheck(playerid); GivePlayerValidWeapon(playerid, 3, 1); } case 6: { if(PlayerInfo[playerid][pCash] < 700) { SendClientMessage(playerid, -1, "You don't have enough cash to buy this."); return -1; } GivePlayerValidWeapon(playerid, 27, 99999); PlayerInfo[playerid][pCash] -= 700; } case 7: { if(PlayerInfo[playerid][pCash] < 800) { SendClientMessage(playerid, -1, "You don't have enough cash to buy this."); return -1; } GivePlayerValidWeapon(playerid, 34, 99999); PlayerInfo[playerid][pCash] -= 800; } case 8: { SetPlayerHealth(playerid, 100); } case 9: { SkipACheck(playerid); PlayerInfo[playerid][pArmor] = 100; SetPlayerArmour(playerid, 100); } } return 1; } return 1; } case DIALOG_LSPD3: { if(!response) { ShowPlayerDialog(playerid, DIALOG_LSPD, DIALOG_STYLE_LIST, "Locker", "Duty\nEquipment\nUniform\nSelect Skin", "Ok", "Close"); return 1; } if(response) { if(listitem == 0) { PlayerInfo[playerid][pSkin] = 71; // cadet SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); } if(listitem == 1) { PlayerInfo[playerid][pSkin] = 280; // officer SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); } if(listitem == 2) { PlayerInfo[playerid][pSkin] = 281; // corporal 1 SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); } if(listitem == 3) { PlayerInfo[playerid][pSkin] = 266; // corporal 2 SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); } if(listitem == 4) { PlayerInfo[playerid][pSkin] = 267; // corporal 3 SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); } if(listitem == 5) { PlayerInfo[playerid][pSkin] = 284; // bike officer SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); } if(listitem == 6) { PlayerInfo[playerid][pSkin] = 282; // sergeant SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); } if(listitem == 7) { PlayerInfo[playerid][pSkin] = 283; // lieutenant SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); } if(listitem == 8) { PlayerInfo[playerid][pSkin] = 288; // chief SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); } if(listitem == 9) { PlayerInfo[playerid][pSkin] = 285; // SWAT SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); } return 1; } return 1; } case DIALOG_NAME: { if(!response) { Kick(playerid); } if(response) { SetPlayerName(playerid, inputtext); new Name[MAX_PLAYER_NAME], Len; GetPlayerName(playerid, Name, sizeof(Name)); Len = strlen(Name); if(Name[Len - 1] == '_' || Name[0] == '_' || strfind(Name, "_", false) == -1) { SendClientMessage(playerid, COLOR_CYAN, "You failed to select a role play name, please select another name."); ShowPlayerDialog(playerid, DIALOG_NAME, DIALOG_STYLE_INPUT,""COL_WHITE"Name Change",""COL_WHITE"Type in another name to use.","Change","No!"); return 1; } INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit"); } } case DIALOG_SKIN: { if(!response) { PlayerInfo[playerid][pCash] = 300; PlayerInfo[playerid][pBank] = 300; PlayerInfo[playerid][pLevel] = 1; SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]); TogglePlayerSpectating(playerid, 0); PlayerInfo[playerid][pSkin] = 299; SetSpawnInfo(playerid, 0, 299, 1780.1759,-1933.6698,13.3859,356.5534, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); Connected[playerid] = 1; SetPVarInt(playerid, "prelogin", 0); TogglePlayerControllable(playerid, 1); SetPVarInt(playerid, "Quiz", 0); SaveChar(playerid); SetCameraBehindPlayer(playerid); } if(response) { new skin = strval(inputtext); if(skin < 0 || skin > 299) return ShowPlayerDialog(playerid, DIALOG_SKIN, DIALOG_STYLE_INPUT,""COL_WHITE"Skin change",""COL_WHITE"Invalid skin. Valid skin IDs are 0 to 299.","Change","No"); TogglePlayerSpectating(playerid, 0); PlayerInfo[playerid][pCash] = 300; PlayerInfo[playerid][pBank] = 300; PlayerInfo[playerid][pLevel] = 1; SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]); PlayerInfo[playerid][pSkin] = skin; SetSpawnInfo(playerid, 0, skin, 1780.1759,-1933.6698,13.3859,356.5534, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); Connected[playerid] = 1; SetPVarInt(playerid, "prelogin", 0); TogglePlayerControllable(playerid, 1); SetPVarInt(playerid, "Quiz", 0); SaveChar(playerid); SetCameraBehindPlayer(playerid); } return 1; } case DIALOG_UNINVITESKIN: { if(!response) { PlayerInfo[playerid][pSkin] = 299; SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); } if(response) { new skin = strval(inputtext); if(skin < 0 || skin > 299) return ShowPlayerDialog(playerid, DIALOG_UNINVITESKIN, DIALOG_STYLE_INPUT,""COL_WHITE"Skin change",""COL_WHITE"Invalid skin. Valid skin IDs are 0 to 299.","Change","No"); PlayerInfo[playerid][pSkin] = skin; SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); } return 1; } case DIALOG_BUYSKIN: { if(!response) { ProxDetector(50.0, playerid, "Shop Clerk says: Alright, come back later.", COLOR_WHITE); } if(response) { new skin = strval(inputtext); if(skin < 0 || skin > 299) return ShowPlayerDialog(playerid, DIALOG_BUYSKIN, DIALOG_STYLE_INPUT,""COL_WHITE"Buy clothes",""COL_WHITE"Invalid skin. Valid skin IDs are 0 to 299.","Buy","No"); if(PlayerInfo[playerid][pCash] < 300) { ProxDetector(50.0, playerid, "Shop Clerk says: Oh I am sorry, I don't think that's enough cash.", COLOR_WHITE); ProxDetector(50.0, playerid, "Shop Clerk lowers his smile - frowning.", COLOR_PURPLE); return 1; } PlayerInfo[playerid][pCash] -= 300; PlayerInfo[playerid][pSkin] = skin; SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); ProxDetector(50.0, playerid, "Shop Clerk says: Excellent choice!", COLOR_WHITE); ProxDetector(50.0, playerid, "Shop Clerk lays his hands onto the table, giggling. ", COLOR_PURPLE); new str[126]; format(str, sizeof(str), "MoneyTrace: %s bought clothes for $300", GetName(playerid)); Log("/logs/moneytrace.txt", str); } return 1; } case DIALOG_ADS: { new str[128]; format(str, 128, "%s: %s", GetName(playerid), inputtext); SendClientMessageToAll(COLOR_RED, str); return 1; } case DIALOG_LOGIN: { if ( !response ) return Kick ( playerid ); if( response ) { if(udb_hash(inputtext) != PlayerInfo[playerid][pPass]) return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit"); if(udb_hash(inputtext) == PlayerInfo[playerid][pPass]) { TogglePlayerSpectating(playerid, 0); INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); SetPVarInt(playerid, "prelogin", 0); SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pX], PlayerInfo[playerid][pY], PlayerInfo[playerid][pZ], 0, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); SetPlayerWeapons(playerid); SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]); SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVW]); SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]); SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]); SetPlayerArmour(playerid, PlayerInfo[playerid][pArmor]); SetPlayerWeaponsEx(playerid); SetTimerEx("PlayerTime", 1000, true, "i", playerid); SetTimerEx("CheckArmHack", 5000, true, "i", playerid); SetTimerEx("CheckWepHack", 1000, true, "i", playerid); SetTimerEx("CheckTPHack", 3000, true, "i", playerid); SetTimerEx("CheckWarpHack", 3000, true, "i", playerid); SetTimerEx("SaveChar", 200000, true, "i", playerid); SendClientMessage(playerid, -1, "~~ Welcome back to Sublime Roleplay! ~~"); Connected[playerid] = 1; SetCameraBehindPlayer(playerid); TogglePlayerControllable(playerid, 1); // if(PlayerInfo[playerid][pX] == 0 && PlayerInfo[playerid][pY] == 0 && PlayerInfo[playerid][pZ] == 0) { PlayerInfo[playerid][pX] = 1780.1759; PlayerInfo[playerid][pY] = -1933.6698; PlayerInfo[playerid][pZ] = 13.3859; SetPlayerHealth(playerid, 100); SetPlayerVirtualWorld(playerid, 0); SetPlayerInterior(playerid, 0); SetPlayerPos(playerid, PlayerInfo[playerid][pX], PlayerInfo[playerid][pY], PlayerInfo[playerid][pZ]); SendClientMessage(playerid, COLOR_CYAN, "Your spawn location got saved inproperly, you have been sent to Los Santos."); } // if(PlayerInfo[playerid][pHealth] == -1337) { SetPlayerInterior(playerid, 0); SetPlayerVirtualWorld(playerid, 0); SetPlayerHealth(playerid, 40); TogglePlayerControllable(playerid, 0); SetPlayerCameraPos(playerid, 1201.5009,-1325.1001,16.6868); SetPlayerCameraLookAt(playerid, 1176.9282,-1323.5554,14.0455); RecoverHospital(playerid); SetTimerEx("RecoverHospital2", 6000, false, "i", playerid); SetTimerEx("RecoverHospital3", 8000, false, "i", playerid); SetTimerEx("RecoverHospital4", 10000, false, "i", playerid); SetTimerEx("RecoverHospital5", 12000, false, "i", playerid); SetTimerEx("RecoverHospital6", 14000, false, "i", playerid); SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], 1178, -1324, 8.11, 0, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); SetPVarInt(playerid, "Injured", 0); SetPVarInt(playerid, "Recovering", 1); } if(PlayerInfo[playerid][pJail] >= 1) { rtimer[playerid] = SetTimerEx("arrestrelease", 1000, true, "i", playerid); SendClientMessage(playerid, COLOR_CYAN, "You got sent back to jail."); } } return 1; } } } return 1; }
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == DIALOG_EDITID) { if(response) { new string[144], file[50]; hid = strval(inputtext); format(file, sizeof(file), "Houses/%d.ini", hid); if(!fexist(file)) return SendClientMessage(playerid, -1, "{FF0000}ERROR: {FFFFFF}This house doesn't exist in data-base."); format(string, sizeof(string), "{FF0000}[EDIT-MODE]: {FFFFFF}Currently editing house: {FF0000}%d.", strval(inputtext)); SendClientMessage(playerid, -1, string); ShowPlayerDialog(playerid, DIALOG_EDIT, DIALOG_STYLE_LIST, "Edit House:", "Edit Price\nEdit Interior\nSet Owned\nLock House\nUnlock House\nTeleport House\nEnter House\nExit House", "Select", "Back"); } else { SendClientMessage(playerid, -1, "{FF0000}[HOUSE]: {FFFFFF}You don't edit house now."); } } if(dialogid == DIALOG_EDIT) { if(response) { if(listitem == 0) { ShowPlayerDialog(playerid, DIALOG_EDITPRICE, DIALOG_STYLE_INPUT, "Edit Price", "{FFFFFF}Please, input below new house's price:", "Continue", "Back"); } if(listitem == 1) { ShowPlayerDialog(playerid, DIALOG_EDITINTERIOR, DIALOG_STYLE_INPUT, "Edit Interior", "{FFFFFF}Please, input below house's interior:", "Continue", "Back"); } if(listitem == 2) { new file[50], string[144]; HouseInfo[hid][hOwned] = 0; format(file, sizeof(file), "Houses/%d.ini", hid); if(fexist(file)) { dini_IntSet(file, "Owned", 0); } format(string, sizeof(string), "{FF0000}[EDIT-MODE]: {FFFFFF}House setted ownable."); SendClientMessage(playerid, -1, string); ShowPlayerDialog(playerid, DIALOG_EDIT, DIALOG_STYLE_LIST, "Edit House:", "Edit Price\nEdit Interior\nSet Owned\nLock House\nUnlock House\nTeleport House\nEnter House\nExit House", "Select", "Back"); } if(listitem == 3) { HouseInfo[hid][hLocked] = 1; SendClientMessage(playerid, -1, "{FF0000}[EDIT-MODE]: {FFFFFF}House locked."); ShowPlayerDialog(playerid, DIALOG_EDIT, DIALOG_STYLE_LIST, "Edit House:", "Edit Price\nEdit Interior\nSet Owned\nLock House\nUnlock House\nTeleport House\nEnter House\nExit House", "Select", "Back"); } if(listitem == 4) { HouseInfo[hid][hLocked] = 0; SendClientMessage(playerid, -1, "{FF0000}[EDIT-MODE]: {FFFFFF}House unlocked."); ShowPlayerDialog(playerid, DIALOG_EDIT, DIALOG_STYLE_LIST, "Edit House:", "Edit Price\nEdit Interior\nSet Owned\nLock House\nUnlock House\nTeleport House\nEnter House\nExit House", "Select", "Back"); } if(listitem == 5) { SetPlayerPos(playerid, HouseInfo[hid][hX], HouseInfo[hid][hY], HouseInfo[hid][hZ]); SendClientMessage(playerid, -1, "{FF0000}[EDIT-MODE]: {FFFFFF}Teleported to house."); ShowPlayerDialog(playerid, DIALOG_EDIT, DIALOG_STYLE_LIST, "Edit House:", "Edit Price\nEdit Interior\nSet Owned\nLock House\nUnlock House\nTeleport House\nEnter House\nExit House", "Select", "Back"); } if(listitem == 6) { SetPlayerPos(playerid, HouseInfo[hid][hX], HouseInfo[hid][hY], HouseInfo[hid][hZ]); SetPlayerInterior(playerid, HouseInfo[hid][hInterior]); SendClientMessage(playerid, -1, "{FF0000}[EDIT-MODE]: {FFFFFF}Entered in house."); } if(listitem == 7) { SetPlayerPos(playerid, HouseInfo[hid][hX], HouseInfo[hid][hY], HouseInfo[hid][hZ]); SetPlayerInterior(playerid, 0); SendClientMessage(playerid, -1, "{FF0000}[EDIT-MODE]: {FFFFFF}House exited to pick-up position."); ShowPlayerDialog(playerid, DIALOG_EDIT, DIALOG_STYLE_LIST, "Edit House:", "Edit Price\nEdit Interior\nSet Owned\nLock House\nUnlock House\nTeleport House\nEnter House\nExit House", "Select", "Back"); } } else { ShowPlayerDialog(playerid, DIALOG_EDITID, DIALOG_STYLE_INPUT, "House ID", "{FFFFFF}Please, input below house ID wich you want to edit:", "Continue", "Exit"); } } if(dialogid == DIALOG_EDITPRICE) { if(response) { new file[50], string[144]; HouseInfo[hid][hPrice] = strval(inputtext); format(file, sizeof(file), "Houses/%d.ini", hid); if(fexist(file)) { dini_IntSet(file, "Price", HouseInfo[hid][hPrice]); } format(string, sizeof(string), "{FF0000}[EDIT-MODE]: {FFFFFF}New price of house: {FF0000}%d {FFFFFF}it's {FF0000}%d.", hid, HouseInfo[hid][hPrice]); SendClientMessage(playerid, -1, string); ShowPlayerDialog(playerid, DIALOG_EDIT, DIALOG_STYLE_LIST, "Edit House:", "Edit Price\nEdit Interior\nSet Owned\nLock House\nUnlock House\nTeleport House\nEnter House\nExit House", "Select", "Back"); } else { ShowPlayerDialog(playerid, DIALOG_EDIT, DIALOG_STYLE_LIST, "Edit House:", "Edit Price\nEdit Interior\nSet Owned\nLock House\nUnlock House\nTeleport House\nEnter House\nExit House", "Select", "Back"); } } if(dialogid == DIALOG_EDITINTERIOR) { if(response) { new file[50], string[144]; HouseInfo[hid][hInterior] = strval(inputtext); format(file, sizeof(file), "Houses/%d.ini", hid); if(fexist(file)) { dini_IntSet(file, "Interior", HouseInfo[hid][hInterior]); } format(string, sizeof(string), "{FF0000}[EDIT-MODE]: {FFFFFF}New interior of house: {FF0000}%d {FFFFFF}it's {FF0000}%d.", hid, HouseInfo[hid][hInterior]); SendClientMessage(playerid, -1, string); ShowPlayerDialog(playerid, DIALOG_EDIT, DIALOG_STYLE_LIST, "Edit House:", "Edit Price\nEdit Interior\nSet Owned\nLock House\nUnlock House\nTeleport House\nEnter House\nExit House", "Select", "Back"); } else { ShowPlayerDialog(playerid, DIALOG_EDIT, DIALOG_STYLE_LIST, "Edit House:", "Edit Price\nEdit Interior\nSet Owned\nLock House\nUnlock House\nTeleport House\nEnter House\nExit House", "Select", "Back"); } } return 1; }