execution88

Untitled

Jul 16th, 2025
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.22 KB | None | 0 0
  1. #define MAX_QUEST_PLAYER_CURRENT        MAX_QUEST_CATEGORY*MAX_CATEGORY_QUEST
  2.  
  3. static Iterator:i_player_current_quest[MAX_PLAYERS]<MAX_QUEST_PLAYER_CURRENT>;
  4.  
  5. stock QuestCategoryPlayerQuest:AddCurrent(playerid, QUEST_CATEGORY:category, quest_id)
  6. {
  7.     if (!QuestCategoryDataCategory:IsValid(category) || !QuestCategoryDataQuest:IsValid(quest_id))
  8.     {
  9.         return false;
  10.     }
  11.  
  12.     Iter_Add(i_player_current_quest[playerid], _:category * MAX_CATEGORY_QUEST + quest_id);
  13.  
  14.     return true;
  15. }
  16.  
  17. stock QuestCategoryPlayerQuest:Remove(playerid, QUEST_CATEGORY:category, quest_id, &safe = -1)
  18. {
  19.     if (!QuestCategoryDataCategory:IsValid(category) || !QuestCategoryDataQuest:IsValid(quest_id))
  20.     {
  21.         return false;
  22.     }
  23.  
  24.     Iter_SafeRemove(i_player_current_quest[playerid], _:category * MAX_CATEGORY_QUEST + quest_id, safe);
  25.  
  26.     return true;
  27. }
  28.  
  29. stock QuestCategoryPlayerQuest:RemoveCurrentAll(playerid)
  30. {
  31.     if (!QuestCategoryDataCategory:IsValid(category) || !QuestCategoryDataQuest:IsValid(quest_id))
  32.     {
  33.         return false;
  34.     }
  35.  
  36.     Iter_Clear(i_player_current_quest[playerid]);
  37.  
  38.     return true;
  39. }
  40.  
  41. stock QuestCategoryPlayerQuest:IsHaveCurrent(playerid)
  42. {
  43.     return Iter_Count(players_list);
  44. }
  45.  
  46. stock QuestCategoryPlayerQuest:GetCurrentHudJson(playerid, string[], size = sizeof(string))
  47. {
  48.     SendPlayerQuestDebug(playerid, "[QuestCategoryPlayerQuest:GetCurrentHudJson] зашли ", -1);
  49.     strcpy(string, "\
  50.         \"key\": 'F4', \
  51.         \"quests\": [", size);
  52.  
  53.     new count, start, end, bool:is_found;
  54.  
  55.     for (new QUEST_CATEGORY:category = QUEST_CATEGORY:0; category < MAX_QUEST_CATEGORY; ++category)
  56.     {
  57.         if (!QuestCategoryDataCategory:IsInit(category))
  58.         {
  59.             continue;
  60.         }
  61.  
  62.         start = _:category * MAX_CATEGORY_QUEST;
  63.         end = start + MAX_CATEGORY_QUEST;
  64.         is_found = false;
  65.        
  66.         foreach(new slot : i_player_current_quest[playerid])
  67.         {
  68.             if (slot >= end)
  69.             {
  70.                 break;
  71.             }
  72.  
  73.             if (slot >= start)
  74.             {
  75.                 if (is_found)
  76.                 {
  77.                     strcat(string, ",", size);
  78.                 }
  79.  
  80.                 new result_json[256];
  81.                 QuestCategoryPlayerTask:GetHudJson(playerid, category, quest_id, result_json);
  82.  
  83.                 strcat(string, result_json, size);
  84.                 count++;
  85.  
  86.                 is_found = true;
  87.             }
  88.         }
  89.     }
  90.  
  91.     strcat(string, "]", size);
  92.  
  93.     return true;
  94. }
Advertisement
Add Comment
Please, Sign In to add comment