help in addons of mission system menu ( new idea)

Unpaid Requests, Public Plugins
Post Reply
Mohamed_dz
Member
Member
Algeria
Posts: 4
Joined: 3 years ago
Contact:

help in addons of mission system menu ( new idea)

#1

Post by Mohamed_dz » 3 years ago

I have sma of mission system but It just contains human kill zombie and zombie infect huamn not work can someone help me to put mission human escape and zombie infect human ..... ( New missions)

Link of Addons : [download=blue]Download-link https://github.com/CrXane/MissionSystem[/download]

SMA :
  1. . /* Zombie Plague Missions System */
  2.  
  3. #include <amxmodx>
  4. #include <amxmisc>
  5. #include <cstrike>
  6. #include <hamsandwich>
  7. #include <zombieplague>
  8.  
  9. /* Download CromChat from GitHub
  10.  * https://github.com/OciXCrom/CromChat */
  11. #include <cromchat>
  12.  
  13. #define team(%1) get_user_team(%1)
  14.  
  15. #define VERSION "3.2"
  16. #define MENU_MAX_ITEMS 64
  17.  
  18. new filename[256];
  19. new menu, j;
  20.  
  21. enum _:Items{
  22.     MenuLevel[20],
  23.     MenuType[2],
  24.     MenuAmount[10],
  25.     MenuTypeReward[2],
  26.     MenuReward[10],
  27. };
  28.  
  29. new Menu[MENU_MAX_ITEMS][Items];
  30.  
  31. enum _:Player_Info{
  32.     //Player_Container[32],
  33.     Player_MenuName[128],
  34.     Player_MenuType[2],
  35.     Player_MenuAmount[10],
  36.     Player_MenuTypeReward[2],
  37.     Player_MenuReward[10],
  38.     Player_Infects,
  39.     Player_Kills,
  40.     Player_iMenuAmount,
  41.     Player_iMenuReward,
  42.     bool:challange,
  43.     bool:complete
  44. }
  45.  
  46. enum _:TYPE{
  47.     CASH = 0,
  48.     AMMO_PACKS
  49. };
  50.  
  51. enum _:PLAYER{
  52.     ZOMBIE = 1,
  53.     HUMAN = 2
  54. };
  55.  
  56. new Player_Challange[33][Player_Info];
  57. new item_name[128], send_data[32];
  58.  
  59. new filename_content[][] = {
  60.     "; Params",
  61.     "; 1 - Mode [EASY, MEDIUM, HARD, any...]",
  62.     "; 2 - Type [(k)ills, (i)nfectors]",
  63.     "; 3 - Amount of required kills/infections",
  64.     "; 4 - Reward Type [(c)ash, (a)mmo packs]",
  65.     "; 5 - Amount",
  66.     "",
  67.     "; e.g:",
  68.     "; ^"MEDIUM^" ^"K^" ^"5^" ^"C^" ^"5000^""
  69. };
  70.  
  71. public plugin_init(){
  72.     register_plugin("Missions Menu", VERSION, "Relaxing");
  73.     register_clcmd("say /missions", "clcmd_menu");
  74.  
  75.     register_event("DeathMsg", "event_death", "a");
  76.     register_logevent("logevent_round_end", 2, "1=Round_End");
  77.     register_dictionary("missions.txt");
  78.    
  79.     RegisterHam(Ham_Spawn, "player", "reset_user_challange", 1);
  80.    
  81.     CC_SetPrefix("[!gMission System!n]");
  82.    
  83.     get_configsdir(filename, charsmax(filename));
  84.     add(filename, charsmax(filename), "/missions.ini");
  85.  
  86.     if (!file_exists(filename)){
  87.         for (new i = 0; i < sizeof(filename_content); i++){
  88.             write_file(filename, filename_content[i]);
  89.         }
  90.     }
  91.    
  92.     ReadData();
  93. }
  94.  
  95. ReadData(){
  96.     new Line[64];
  97.     new f = fopen(filename, "rt");
  98.     if (!f){
  99.         set_fail_state("Error opening %s file", filename);
  100.     }
  101.  
  102.     while (!feof(f)){
  103.         fgets(f, Line, charsmax(Line));
  104.         trim(Line);
  105.        
  106.         if (Line[0] == ';' || !Line[0] || Line[0] == '^n'){
  107.             continue;
  108.         }
  109.        
  110.         remove_quotes(Line);
  111.         parse(Line, Menu[j][MenuLevel], charsmax(Menu[][MenuLevel]),
  112.             Menu[j][MenuType],  charsmax(Menu[][MenuType]),
  113.             Menu[j][MenuAmount],    charsmax(Menu[][MenuAmount]),
  114.             Menu[j][MenuTypeReward],charsmax(Menu[][MenuTypeReward]),
  115.             Menu[j][MenuReward],    charsmax(Menu[][MenuReward]));
  116.            
  117.         trim(Menu[j][MenuLevel]);
  118.         trim(Menu[j][MenuType]);
  119.         trim(Menu[j][MenuAmount]);
  120.         trim(Menu[j][MenuTypeReward]);
  121.         trim(Menu[j][MenuReward]);
  122.  
  123.         j++;
  124.     }
  125.     fclose(f);
  126.    
  127.     if (!j){
  128.         set_fail_state("No missions found on %s file", filename);
  129.     }
  130. }
  131.  
  132. public client_disconnected(id){
  133.     reset_user_challange(id);
  134. }
  135.  
  136. public clcmd_menu(id){
  137.     if (!is_user_alive(id)){
  138.         CC_SendMessage(id, "%L", id, "ALIVE_ONLY");
  139.         return PLUGIN_HANDLED;
  140.     }
  141.    
  142.     if (Player_Challange[id][challange] == true){
  143.         new kills[32], finished[32], amount;
  144.        
  145.         switch (team(id)){
  146.             case HUMAN: {
  147.                 amount = Player_Challange[id][Player_Kills];
  148.                 formatex(kills, charsmax(kills), "\wInfects\r: \w%d\y/\w%d",
  149.                     amount, Player_Challange[id][Player_iMenuAmount]);
  150.             }
  151.            
  152.             case ZOMBIE: {
  153.                 amount = Player_Challange[id][Player_Infects];
  154.                 formatex(kills, charsmax(kills), "\wKills\r: \w%d\y/\w%d",
  155.                     amount, Player_Challange[id][Player_iMenuAmount]);
  156.             }
  157.         }
  158.        
  159.         if (amount >= Player_Challange[id][Player_iMenuAmount]){
  160.             formatex(finished, charsmax(finished), "You completed this mission");
  161.         }
  162.        
  163.         //CC_SendMessage(id, "%L", id, "CHANGED_NEXTMAP");
  164.         menu = menu_create("Current Mission Selected", "menu_current");
  165.         menu_additem(menu, Player_Challange[id][Player_MenuName]);
  166.         menu_additem(menu, kills);
  167.         if (finished[0]){
  168.             menu_additem(menu, finished);
  169.         }
  170.         menu_additem(menu, "Exit");
  171.        
  172.         menu_setprop(menu, MPROP_EXIT, MEXIT_NEVER);
  173.         menu_display(id, menu);
  174.        
  175.         return PLUGIN_HANDLED;
  176.     }
  177.        
  178.     menu = menu_create("Missions Menu", "menu_handler");
  179.  
  180.     switch (team(id)){
  181.         case HUMAN: MenuAddT(menu);
  182.         case ZOMBIE: MenuAddCT(menu);
  183.     }
  184.  
  185.     menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
  186.     menu_display(id, menu, 0);
  187.     return PLUGIN_HANDLED;
  188. }
  189.  
  190. public menu_handler(id, menu, item){
  191.     if (item == MENU_EXIT){
  192.         menu_destroy(menu);
  193.     }
  194.    
  195.     new receive_data[32], Menu_Item_Name[64];
  196.     new _access, item_callback;
  197.     menu_item_getinfo(menu, item, _access, receive_data, charsmax(receive_data), Menu_Item_Name, charsmax(Menu_Item_Name), item_callback);
  198.    
  199.     copy(Player_Challange[id][Player_MenuName], charsmax(Player_Challange[][Player_MenuName]), Menu_Item_Name);
  200.     //copy(Player_Challange[id][Player_Container], charsmax(Player_Challange[][Player_Container]), receive_data);
  201.    
  202.     parse(receive_data, Player_Challange[id][Player_MenuType],  charsmax(Player_Challange[][Player_MenuType]),
  203.         Player_Challange[id][Player_MenuAmount],        charsmax(Player_Challange[][Player_MenuAmount]),
  204.         Player_Challange[id][Player_MenuTypeReward],        charsmax(Player_Challange[][Player_MenuTypeReward]),
  205.         Player_Challange[id][Player_MenuReward],        charsmax(Player_Challange[][Player_MenuReward]));
  206.    
  207.     Player_Challange[id][Player_iMenuAmount] = str_to_num(Player_Challange[id][Player_MenuAmount]);
  208.     Player_Challange[id][Player_iMenuReward] = str_to_num(Player_Challange[id][Player_MenuReward]);
  209.     Player_Challange[id][challange] = true;
  210.     Player_Challange[id][complete]  = false;
  211.    
  212.     CC_SendMessage(id, "%L", id, "SELECTED_SUCCESSFULLY");
  213.    
  214.     menu_destroy(menu);
  215.     return PLUGIN_HANDLED;
  216. }
  217.  
  218. public menu_current(id, menu, item){
  219.     if (item || !item){
  220.         menu_destroy(menu);
  221.     }
  222.     return PLUGIN_HANDLED;
  223. }
  224.  
  225. public event_death(){
  226.     new Attacker    = read_data(1);
  227.     new Victim  = read_data(2);
  228.    
  229.     if (team(Attacker) == team(Victim) || Attacker == Victim
  230.         || !is_user_connected(Attacker) || !is_user_connected(Victim)){
  231.             return PLUGIN_HANDLED;
  232.     }
  233.    
  234.     if (Player_Challange[Victim][challange] == true){
  235.         CC_SendMessage(Victim, "%L", Victim, "MISSION_FAILED");
  236.         reset_user_challange(Victim);
  237.     }
  238.    
  239.     user_challange_complete(Attacker);
  240.    
  241.     return PLUGIN_CONTINUE;        
  242. }
  243.  
  244. public reset_user_challange(id){
  245.     //Player_Challange[id][Player_Container]    = "";
  246.     Player_Challange[id][Player_MenuName]       = "";
  247.     Player_Challange[id][Player_MenuType]       = "";
  248.     Player_Challange[id][Player_MenuAmount]     = "";
  249.     Player_Challange[id][Player_MenuTypeReward]     = "";
  250.     Player_Challange[id][Player_MenuReward]     = "";
  251.     Player_Challange[id][Player_Infects]        = 0;
  252.     Player_Challange[id][Player_Kills]      = 0;
  253.     Player_Challange[id][Player_iMenuAmount]    = 0;
  254.     Player_Challange[id][Player_iMenuReward]    = 0;
  255.     Player_Challange[id][challange]         = false;
  256.     Player_Challange[id][complete]          = false;
  257. }
  258.  
  259. public logevent_round_end(){
  260.     new players[32], num, pid;
  261.     get_players(players, num);
  262.  
  263.     for (new i = 0; i < num; i++){
  264.         pid = players[i];
  265.         if (Player_Challange[pid][challange] == true
  266.             && Player_Challange[pid][complete] == false){
  267.             CC_SendMessage(pid, "%L", pid, "MISSION_FAILED");
  268.         }
  269.     }
  270. }
  271.  
  272. ////////////////////////////////
  273. //           Stocks           //
  274. ////////////////////////////////
  275.  
  276. stock challange_completed(id, type){
  277.     new reward;
  278.    
  279.     switch (type){
  280.         case CASH: {
  281.             reward = cs_get_user_money(id);
  282.             cs_set_user_money(id, reward + Player_Challange[id][Player_iMenuReward]);
  283.             CC_SendMessage(id, "%L", id, "MISSION_ACCOMPLISHED_CASH", Player_Challange[id][Player_iMenuReward]);
  284.         }
  285.        
  286.         case AMMO_PACKS: {
  287.             reward = zp_get_user_ammo_packs(id);
  288.             zp_set_user_ammo_packs(id, reward + Player_Challange[id][Player_iMenuReward]);
  289.             CC_SendMessage(id, "%L", id, "MISSION_ACCOMPLISHED_AP", Player_Challange[id][Player_iMenuReward]);
  290.         }
  291.     }
  292.     Player_Challange[id][complete] = true;
  293. }
  294.  
  295. stock user_challange_complete(id){
  296.     if (Player_Challange[id][challange] == true && Player_Challange[id][complete] == false){
  297.         new amount;
  298.         switch (team(id)){
  299.             case HUMAN: {
  300.                 Player_Challange[id][Player_Kills]++
  301.                 amount = Player_Challange[id][Player_Kills];
  302.             }
  303.            
  304.             case ZOMBIE: {
  305.                 Player_Challange[id][Player_Infects]++;
  306.                 amount = Player_Challange[id][Player_Infects];
  307.             }
  308.         }
  309.        
  310.         if (amount >= Player_Challange[id][Player_iMenuAmount]){
  311.             if (equali(Player_Challange[id][Player_MenuTypeReward], "c")){
  312.                 challange_completed(id, CASH);
  313.             }
  314.                    
  315.             else if (equali(Player_Challange[id][Player_MenuTypeReward], "a")){
  316.                 challange_completed(id, AMMO_PACKS);
  317.             }
  318.         }
  319.     }
  320. }
  321.  
  322. stock MenuAddCT(menuid){
  323.     for (new i = 0; i < j; i++){
  324.         if (equali(Menu[i][MenuType], "k")){
  325.             if (equali(Menu[i][MenuTypeReward], "a")){
  326.                 formatex(item_name, charsmax(item_name), "\r[\y%s\r] \wKill %s zombies \r(\y%s \wAP\r)",
  327.                     Menu[i][MenuLevel], Menu[i][MenuAmount], Menu[i][MenuReward]);
  328.                 formatex(send_data, charsmax(send_data), "%s %s %s %s", Menu[i][MenuType],
  329.                     Menu[i][MenuAmount], Menu[i][MenuTypeReward], Menu[i][MenuReward]);
  330.             }
  331.            
  332.             else if (equali(Menu[i][MenuTypeReward], "c")){
  333.                 formatex(item_name, charsmax(item_name), "\r[\y%s\r] \wKill %s zombies \r(\w$\y%s\r)",
  334.                     Menu[i][MenuLevel], Menu[i][MenuAmount], Menu[i][MenuReward]);
  335.                 formatex(send_data, charsmax(send_data), "%s %s %s %s", Menu[i][MenuType],
  336.                     Menu[i][MenuAmount], Menu[i][MenuTypeReward], Menu[i][MenuReward]);
  337.             }
  338.             menu_additem(menuid, item_name, send_data);
  339.         }
  340.     }
  341. }
  342.  
  343. stock MenuAddT(menuid){
  344.     for (new i = 0; i < j; i++){
  345.         if (equali(Menu[i][MenuType], "i")){
  346.             if (equali(Menu[i][MenuTypeReward], "a")){
  347.                 formatex(item_name, charsmax(item_name), "\r[\y%s\r] \wInfect %s humans \r(\y%s \wAP\r)",
  348.                     Menu[i][MenuLevel], Menu[i][MenuAmount], Menu[i][MenuReward]);
  349.                 formatex(send_data, charsmax(send_data), "%s %s %s %s", Menu[i][MenuType],
  350.                     Menu[i][MenuAmount], Menu[i][MenuTypeReward], Menu[i][MenuReward]);
  351.             }
  352.  
  353.             else if (equali(Menu[i][MenuTypeReward], "c")){
  354.                 formatex(item_name, charsmax(item_name), "\r[\y%s\r] \wInfect %s humans \r(\w$\y%s\r)",
  355.                     Menu[i][MenuLevel], Menu[i][MenuAmount], Menu[i][MenuReward]);
  356.                 formatex(send_data, charsmax(send_data), "%s %s %s %s", Menu[i][MenuType],
  357.                     Menu[i][MenuAmount], Menu[i][MenuTypeReward], Menu[i][MenuReward]);
  358.             }
  359.             menu_additem(menuid, item_name, send_data);
  360.         }
  361.     }
  362. }

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#2

Post by Raheem » 3 years ago

Please ask OxciXCorm to add as he is the author, he is helpful and will do it. Because I don't know really how this works and I never tested it. Ask him here: https://amxx-bg.info/. You can give him our Mod API: api/ so he can do it easily.
He who fails to plan is planning to fail

ngamerz
Member
Member
Philippines
Posts: 37
Joined: 3 years ago
Location: Philippines From South Korea

#3

Post by ngamerz » 3 years ago

Raheem wrote: 3 years ago Please ask OxciXCorm to add as he is the author, he is helpful and will do it. Because I don't know really how this works and I never tested it. Ask him here: https://amxx-bg.info/. You can give him our Mod API: api/ so he can do it easily.
OciXcrom isn't author of it, it's relaxing

Original thread: https://forums.alliedmods.net/showthread.php?t=317025

Edit: The code is complex, i'm sure no one can edit that easily. It takes time.

Mohamed_dz
Member
Member
Algeria
Posts: 4
Joined: 3 years ago
Contact:

#4

Post by Mohamed_dz » 3 years ago

ngamerz wrote: 3 years ago
Raheem wrote: 3 years ago Please ask OxciXCorm to add as he is the author, he is helpful and will do it. Because I don't know really how this works and I never tested it. Ask him here: https://amxx-bg.info/. You can give him our Mod API: api/ so he can do it easily.
OciXcrom isn't author of it, it's relaxing

Original thread: https://forums.alliedmods.net/showthread.php?t=317025

Edit: The code is complex, i'm sure no one can edit that easily. It takes time.
Do you have facebook of him oe steam discord ... !?

ngamerz
Member
Member
Philippines
Posts: 37
Joined: 3 years ago
Location: Philippines From South Korea

#5

Post by ngamerz » 3 years ago

Mohamed_dz wrote: 3 years ago
ngamerz wrote: 3 years ago
Raheem wrote: 3 years ago Please ask OxciXCorm to add as he is the author, he is helpful and will do it. Because I don't know really how this works and I never tested it. Ask him here: https://amxx-bg.info/. You can give him our Mod API: api/ so he can do it easily.
OciXcrom isn't author of it, it's relaxing

Original thread: https://forums.alliedmods.net/showthread.php?t=317025

Edit: The code is complex, i'm sure no one can edit that easily. It takes time.
Do you have facebook of him oe steam discord ... !?
Didn't see his thread? He did mention that he won't support this plugin or continue it. If you want to edit it, simply go to alliedmodders and ask someone.
1. IDK if he has facebook
2. He doesn't use discord? did he?
Image

Mohamed_dz
Member
Member
Algeria
Posts: 4
Joined: 3 years ago
Contact:

#6

Post by Mohamed_dz » 3 years ago

ngamerz wrote: 3 years ago
Mohamed_dz wrote: 3 years ago
ngamerz wrote: 3 years ago

OciXcrom isn't author of it, it's relaxing

Original thread: https://forums.alliedmods.net/showthread.php?t=317025

Edit: The code is complex, i'm sure no one can edit that easily. It takes time.
Do you have facebook of him oe steam discord ... !?
Didn't see his thread? He did mention that he won't support this plugin or continue it. If you want to edit it, simply go to alliedmodders and ask someone.
1. IDK if he has facebook
2. He doesn't use discord? did he?
Image
Ty bro ❤️

Mohamed_dz
Member
Member
Algeria
Posts: 4
Joined: 3 years ago
Contact:

#7

Post by Mohamed_dz » 3 years ago

Raheem wrote: 3 years ago Please ask OxciXCorm to add as he is the author, he is helpful and will do it. Because I don't know really how this works and I never tested it. Ask him here: https://amxx-bg.info/. You can give him our Mod API: api/ so he can do it easily.
Raheem can you made menu of missions zombie escape

Post Reply

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

Register

Sign in

Who is online

Users browsing this forum: No registered users and 3 guests