Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define MAX_QUEST_PLAYER_CURRENT MAX_QUEST_CATEGORY*MAX_CATEGORY_QUEST
- static Iterator:i_player_current_quest[MAX_PLAYERS]<MAX_QUEST_PLAYER_CURRENT>;
- stock QuestCategoryPlayerQuest:AddCurrent(playerid, QUEST_CATEGORY:category, quest_id)
- {
- if (!QuestCategoryDataCategory:IsValid(category) || !QuestCategoryDataQuest:IsValid(quest_id))
- {
- return false;
- }
- Iter_Add(i_player_current_quest[playerid], _:category * MAX_CATEGORY_QUEST + quest_id);
- return true;
- }
- stock QuestCategoryPlayerQuest:Remove(playerid, QUEST_CATEGORY:category, quest_id, &safe = -1)
- {
- if (!QuestCategoryDataCategory:IsValid(category) || !QuestCategoryDataQuest:IsValid(quest_id))
- {
- return false;
- }
- Iter_SafeRemove(i_player_current_quest[playerid], _:category * MAX_CATEGORY_QUEST + quest_id, safe);
- return true;
- }
- stock QuestCategoryPlayerQuest:RemoveCurrentAll(playerid)
- {
- if (!QuestCategoryDataCategory:IsValid(category) || !QuestCategoryDataQuest:IsValid(quest_id))
- {
- return false;
- }
- Iter_Clear(i_player_current_quest[playerid]);
- return true;
- }
- stock QuestCategoryPlayerQuest:IsHaveCurrent(playerid)
- {
- return Iter_Count(players_list);
- }
- stock QuestCategoryPlayerQuest:GetCurrentHudJson(playerid, string[], size = sizeof(string))
- {
- SendPlayerQuestDebug(playerid, "[QuestCategoryPlayerQuest:GetCurrentHudJson] зашли ", -1);
- strcpy(string, "\
- \"key\": 'F4', \
- \"quests\": [", size);
- new count, start, end, bool:is_found;
- for (new QUEST_CATEGORY:category = QUEST_CATEGORY:0; category < MAX_QUEST_CATEGORY; ++category)
- {
- if (!QuestCategoryDataCategory:IsInit(category))
- {
- continue;
- }
- start = _:category * MAX_CATEGORY_QUEST;
- end = start + MAX_CATEGORY_QUEST;
- is_found = false;
- foreach(new slot : i_player_current_quest[playerid])
- {
- if (slot >= end)
- {
- break;
- }
- if (slot >= start)
- {
- if (is_found)
- {
- strcat(string, ",", size);
- }
- new result_json[256];
- QuestCategoryPlayerTask:GetHudJson(playerid, category, quest_id, result_json);
- strcat(string, result_json, size);
- count++;
- is_found = true;
- }
- }
- }
- strcat(string, "]", size);
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment