ZP Request

Šiame forume rašomi vartotojų klausimai/problemos su kuriomis jie susidūrė kuriant pluginus.
Post Reply
Kenzy
Jau po truputį tampa savu
Posts: 106
Joined: 2017 Jan 22 20:41

ZP Request

Post by Kenzy »

Hi There,
Please anyone can help me for change some permission on this Plugin ZP [Admin Menu]

Explain
when to open admin menu and choose something like start nemesis or swar mod or turn someone zombie/human, but use it just one time, and every 10 minute, and when you want use it again on this same time/round or next round, then you cant because you must wait, and u will get the message written like This, You can't use the Admin Menu right now, you'll have to wait 10 minutes.
and if Admin use this commend on consol:
zp_nemesis player
or like this commends for use Admin Menu, then he will get the same message for wait 10 minute .
I hope you can help me for change it, because I don't want admins being abused on zp server and always using the Admin Menu.,

and i found this, but i want change to use admin menu every 10 minute not 5 times on map
https://forums.alliedmods.net/showthread.php?t=288795
i hope to understand me, thanks :)
3.png

Code: Select all

new g_iAdMenuUsage[33]    #define ADMINMENUUSAGE_LIMIT 5 // Limit for how many times an admin can open admin menu per map         public plugin_init()    {        // Plugin disabled?        if (!g_pluginenabled) return;

Code: Select all

// Game Menupublic menu_game(id, key){    switch (key)    {        case 0: // Buy Weapons        {            // Custom buy menus enabled?            if (get_pcvar_num(cvar_buycustom))            {                // Disable the remember selection setting                WPN_AUTO_ON = 0                zp_colored_print(id, "^x04[ZP]^x01 %L", id, "BUY_ENABLED")                                // Show menu if player hasn't yet bought anything                if (g_canbuy[id]) show_menu_buy1(id)            }            else                zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")        }        case 1: // Extra Items        {            // Extra items enabled?            if (get_pcvar_num(cvar_extraitems))            {                // Check whether the player is able to buy anything                if (g_isalive[id])                    show_menu_extras(id)                else                    zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")            }            else                zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT_EXTRAS")        }        case 2: // Zombie Classes        {            // Zombie classes enabled?            if (get_pcvar_num(cvar_zclasses))                show_menu_zclass(id)            else                zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT_ZCLASSES")        }        case 3: // Unstuck        {            // Check if player is stuck            if (g_isalive[id])            {                if (is_player_stuck(id))                {                    // Move to an initial spawn                    if (get_pcvar_num(cvar_randspawn))                        do_random_spawn(id) // random spawn (including CSDM)                    else                        do_random_spawn(id, 1) // regular spawn                }                else                    zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT_STUCK")            }            else                zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")        }        case 4: // Help Menu        {            show_menu_info(id)        }        case 5: // Join Spectator        {            // Player alive?            if (g_isalive[id])            {                // Prevent abuse by non-admins if block suicide setting is enabled                if (get_pcvar_num(cvar_blocksuicide) && !(get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MENU]))                {                    zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT")                    return PLUGIN_HANDLED;                }                                // Check that we still have both humans and zombies to keep the round going                check_round(id)                                // Kill him before he switches team                dllfunc(DLLFunc_ClientKill, id)            }                        // Temporarily save player stats?            if (get_pcvar_num(cvar_statssave)) save_stats(id)                        // Remove previous tasks            remove_task(id+TASK_TEAM)            remove_task(id+TASK_MODEL)            remove_task(id+TASK_FLASH)            remove_task(id+TASK_CHARGE)            remove_task(id+TASK_SPAWN)            remove_task(id+TASK_BLOOD)            remove_task(id+TASK_AURA)            remove_task(id+TASK_BURN)                        // Then move him to the spectator team            fm_cs_set_user_team(id, FM_CS_TEAM_SPECTATOR)            fm_user_team_update(id)        }        case 8: // Admin Menu        {            // Check if player has the required access            if (get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MENU])            {                if(g_iAdMenuUsage[id] >= ADMINMENUUSAGE_LIMIT)                {                    zp_colored_print(id, "^x04[ZP]^x01 You have used up all your admin menu allowance for this map bro!")                    zp_colored_print(id, "^x04[ZP]^x01 You can use admin menu %d times every map!", ADMINMENUUSAGE_LIMIT)                }                else                {                    show_menu_admin(id)                                        g_iAdMenuUsage[id] ++                }            }        }    }        return PLUGIN_HANDLED;}
Can anyone please show me the code like i say !?
i hope to understand :)

-- 2019 Mar 25 13:46 --

Hi,
i try a lots for can do it but i still not yet,
i dont know which one can use for can edite Admin menu, i hope if i get help

Code: Select all

#define SECONDS_IN_MINUTE 60 
http://www.amxmodx.org/api/time

Code: Select all

Time unit types for get_time_length()#enum {    timeunit_seconds = 0,    timeunit_minutes,    timeunit_hours,    timeunit_days,    timeunit_weeks,}; 
i did this code ..

Code: Select all

case 8: // Admin Menu        {            // Check if player has the required access            if (get_user_flags(id) & g_access_flag[ACCESS_ADMIN_MENU])            {                if(g_iAdMenuUsage[id] >= get_time_length()                {                                 enum                                 {                                    timeunit_minutes, = 10                     zp_colored_print(id, "^x04[ZP]^x01 You have used up all your admin menu allowance for this map bro!")                    zp_colored_print(id, "^x04[ZP]^x01 You can use admin menu %d times every map!", ADMINMENUUSAGE_LIMIT)                }                else                {                    show_menu_admin(id)                                        g_iAdMenuUsage[id] ++                }            }        }    }
Attachments
zombie_plague40.sma
(384.42 KiB) Downloaded 564 times
Last edited by Kenzy on 2019 Mar 25 13:50, edited 1 time in total.

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests