- #include <amxmodx>
- #include <amxmisc>
- #include <cstrike>
- #include <fun>
- #include <engine>
- #include <fakemeta>
- #include <hamsandwich>
- #include <zombieplague>
- #pragma compress 1 // Защита от декомпиляра
- // -> Инфо о плагине <- //{
- new g_Plugin[] = "[ZP] Quests";
- new g_Version[] = "29.05.2018";
- new g_Author[] = "vk.com/cs_jump";
- // -> Инфо о плагине <- //}
- native zp_get_user_ptz(id, ptz)
- const RIGHT_PER_PAGE = 8; // Игроков на одной странице (9 - далее | 0 - выход)
- new g_iMenuPosition[33], Target[33];
- enum _:DATA_LIST { Name[64], Description[64], Number[64], Type[64], Reward[64] }
- new aDataLIST[DATA_LIST]
- new Array:g_aList;
- new g_iListSize;
- new iKillerNum[33][15];
- public plugin_init()
- {
- register_plugin(g_Plugin, g_Version, g_Author);
- register_menucmd(register_menuid("Show_MainMenu"), (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9), "Handle_MainMenu");
- register_clcmd("say /quests", "ClientCmd");
- register_clcmd("zp_quests", "ClientCmd");
- RegisterHam(Ham_Killed, "player", "Ham_PlayerKilled_Post");
- RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage");
- }
- public plugin_precache()
- {
- new szCfgDir[64], szCfgFile[128];
- get_localinfo("amxx_configsdir", szCfgDir, charsmax(szCfgDir));
- // Получаем список Квестов
- formatex(szCfgFile, charsmax(szCfgFile), "%s/zp_quests.ini", szCfgDir);
- switch(file_exists(szCfgFile))
- {
- case 0:
- {
- write_file(szCfgFile, "; Файл добавления квестов");
- write_file(szCfgFile, "; ^"Название^" ^"Описание^" ^"Кол-во для награды^" ^"Тип^" ^"Награда Аммо^"");
- write_file(szCfgFile, "; Типы:");
- write_file(szCfgFile, "; 1 - Заражение");
- write_file(szCfgFile, "; 2 - Убийство Зомби");
- write_file(szCfgFile, "; 3 - Убийство первого Зомби");
- write_file(szCfgFile, "; 4 - Убийство последнего Зомби");
- write_file(szCfgFile, "; 5 - Убийство Дьявола");
- write_file(szCfgFile, "; 6 - Убийство Выжившего");
- write_file(szCfgFile, "; 7 - Нанесение Урона");
- write_file(szCfgFile, "");
- write_file(szCfgFile, "^"Убийца^" ^"Убить зомби^" ^"10^" ^"2^" ^"20^"");
- write_file(szCfgFile, "^"Киллер^" ^"Убить зомби^" ^"15^" ^"2^" ^"30^"");
- write_file(szCfgFile, "^"1-я Зараза^" ^"Убить первых зомби^" ^"5^" ^"3^" ^"40^"");
- write_file(szCfgFile, "^"Последняя Зараза^" ^"Убить последних зомби^" ^"5^" ^"4^" ^"50^"");
- write_file(szCfgFile, "^"Охотник^" ^"Убить выживших^" ^"5^" ^"6^" ^"70^"");
- write_file(szCfgFile, "^"Мясник^" ^"Убить дьяволов^" ^"5^" ^"5^" ^"70^"");
- write_file(szCfgFile, "^"Зараза^" ^"Заразить людей^" ^"15^" ^"1^" ^"20^"");
- write_file(szCfgFile, "^"Токсичный^" ^"Заразить людей^" ^"25^" ^"1^" ^"40^"");
- write_file(szCfgFile, "^"Ликвидатор^" ^"Нанести урона^" ^"100000^" ^"7^" ^"500^"");
- }
- case 1:
- {
- new szBuffer[128], iLine, iLen;
- g_aList = ArrayCreate(DATA_LIST);
- while(read_file(szCfgFile, iLine++, szBuffer, charsmax(szBuffer), iLen))
- {
- if(!iLen || szBuffer[0] == ';') continue;
- parse
- (
- szBuffer,
- aDataLIST[Name], charsmax(aDataLIST[Name]),
- aDataLIST[Description], charsmax(aDataLIST[Description]),
- aDataLIST[Number], charsmax(aDataLIST[Number]),
- aDataLIST[Type], charsmax(aDataLIST[Type]),
- aDataLIST[Reward], charsmax(aDataLIST[Reward])
- );
- ArrayPushArray(g_aList, aDataLIST);
- }
- g_iListSize = ArraySize(g_aList);
- }
- }
- }
- public plugin_natives()
- {
- register_native("zp_open_quests", "ClientCmd", 1);
- }
- public zp_user_infected_pre(id, infector)
- {
- iKillerNum[infector][1]++;
- }
- public Ham_PlayerKilled_Post(iVictim, iKiller)
- {
- if(iVictim != iKiller)
- {
- if(zp_get_user_nemesis(iVictim)) iKillerNum[iKiller][5]++;
- else if(zp_get_user_survivor(iVictim)) iKillerNum[iKiller][6]++;
- else if(zp_get_user_first_zombie(iVictim)) iKillerNum[iKiller][3]++;
- else if(zp_get_user_last_zombie(iVictim)) iKillerNum[iKiller][4]++;
- else if(zp_get_user_zombie(iVictim)) iKillerNum[iKiller][2]++;
- }
- }
- public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
- {
- if (victim == attacker || zp_get_user_zombie(attacker))
- return HAM_IGNORED;
- iKillerNum[attacker][7] += floatround(damage)
- return HAM_IGNORED// HAM_SUPERCEDE;
- }
- public ClientCmd(id) return Show_MainMenu(id, g_iMenuPosition[id] = 0);
- Show_MainMenu(id, iPos)
- {
- if(zp_get_user_ptz(id, 5)>=1) return PLUGIN_HANDLED;
- new iPlayersNum = g_iListSize;
- new iStart = iPos * RIGHT_PER_PAGE;
- if(iStart > iPlayersNum) iStart = iPlayersNum;
- iStart = iStart - (iStart % RIGHT_PER_PAGE);
- g_iMenuPosition[id] = iStart / RIGHT_PER_PAGE;
- new iEnd = iStart + RIGHT_PER_PAGE;
- if(iEnd > iPlayersNum) iEnd = iPlayersNum;
- new szMenu[512], iLen, iPagesNum = (iPlayersNum / RIGHT_PER_PAGE + ((iPlayersNum % RIGHT_PER_PAGE) ? 1 : 0));
- switch(iPagesNum)
- {
- case 0:
- {
- UTIL_SayText(id, "!g[ZP] !yНет квестов!t.");
- return PLUGIN_HANDLED;
- }
- default: iLen = formatex(szMenu, charsmax(szMenu), "\r[ZM] \wКвесты \r[%d|%d]^n^n", iPos + 1, iPagesNum);
- }
- new iKeys = (1<<9), b;
- for(new a = iStart; a < iEnd; a++)
- {
- ArrayGetArray(g_aList, a, aDataLIST);
- iKeys |= (1<<b);
- iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\r[%d]\w%s %s \r[%d\d|\r%s]^n", ++b, iKillerNum[id][str_to_num(aDataLIST[Type])] >= str_to_num(aDataLIST[Number]) ? "\w":"\d", aDataLIST[Name], iKillerNum[id][str_to_num(aDataLIST[Type])], aDataLIST[Number]);
- }
- for(new i = b; i < 8; i++) iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n");
- if(iEnd < iPlayersNum)
- {
- iKeys |= (1<<8);
- formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r[9]\w Далее^n\r[0]\w %s", iPos ? "Назад" : "Выход");
- }
- else formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r[0]\w %s", iPos ? "Назад" : "Выход");
- return show_menu(id, iKeys, szMenu, -1, "Show_MainMenu");
- }
- public Handle_MainMenu(id, iKey)
- {
- if(zp_get_user_ptz(id, 5)>=1) return PLUGIN_HANDLED;
- switch(iKey)
- {
- case 8: return Show_MainMenu(id, ++g_iMenuPosition[id]);
- case 9: return Show_MainMenu(id, --g_iMenuPosition[id]);
- default:
- {
- Target[id] = g_iMenuPosition[id] * RIGHT_PER_PAGE + iKey;
- ArrayGetArray(g_aList, Target[id], aDataLIST);
- if(iKillerNum[id][str_to_num(aDataLIST[Type])] >= str_to_num(aDataLIST[Number]))
- {
- iKillerNum[id][str_to_num(aDataLIST[Type])] -= str_to_num(aDataLIST[Number]);
- zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + str_to_num(aDataLIST[Reward]))
- UTIL_SayText(id, "!g[ZP] !yВы выполнили задание '!t%s!y' и получили !g%d Аммо!y.", aDataLIST[Name], str_to_num(aDataLIST[Reward]));
- }
- else UTIL_SayText(id, "!g[ZP] !yВы должны: !t%s !g%d !yраз(а). Вам осталось !t%d !yраз(а).", aDataLIST[Description], str_to_num(aDataLIST[Number]), str_to_num(aDataLIST[Number]) - iKillerNum[id][str_to_num(aDataLIST[Type])]);
- }
- }
- return Show_MainMenu(id, g_iMenuPosition[id]);
- }
- stock UTIL_SayText(pPlayer, const szMessage[], any:...)
- {
- new szBuffer[190];
- if(numargs() > 2) vformat(szBuffer, charsmax(szBuffer), szMessage, 3);
- else copy(szBuffer, charsmax(szBuffer), szMessage);
- while(replace(szBuffer, charsmax(szBuffer), "!y", "^1")) {}
- while(replace(szBuffer, charsmax(szBuffer), "!t", "^3")) {}
- while(replace(szBuffer, charsmax(szBuffer), "!g", "^4")) {}
- switch(pPlayer)
- {
- case 0:
- {
- for(new iPlayer = 1; iPlayer <= get_maxplayers(); iPlayer++)
- {
- engfunc(EngFunc_MessageBegin, MSG_ONE_UNRELIABLE, 76, {0.0, 0.0, 0.0}, iPlayer);
- write_byte(iPlayer);
- write_string(szBuffer);
- message_end();
- }
- }
- default:
- {
- engfunc(EngFunc_MessageBegin, MSG_ONE_UNRELIABLE, 76, {0.0, 0.0, 0.0}, pPlayer);
- write_byte(pPlayer);
- write_string(szBuffer);
- message_end();
- }
- }
- }
Quests System
Quests System
I mae an idea of 1.6 version with quests and this can be made as a separate addon. So here it is to be converted. Honestly i don't know how this works and to be converted for our mode. As i said it can be like this: destroy 10 planks or win 10 rounds as a zm or human or infect 15 people or be the first that call the helicopter or press the button.
Last edited by Templaso 3 years ago, edited 1 time in total.
You don't know how it works? Any description?
He who fails to plan is planning to fail
Really dunno. I just get this from other site. What i request is an achievement plugin to work like that.
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute
Sign in
Who is online
Users browsing this forum: No registered users and 0 guests