AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Help me with this menu (https://forums.alliedmods.net/showthread.php?t=311982)

MITAR 11-10-2018 22:31

Help me with this menu
 
hello can help me make this plugin work and only be open 1 once per round and add revive to the menu ie when selected the player who selected a respawn
the menu to be opened by the flag "t"

Yes I tried this menu alone but without success




#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>
#include <fun>
#pragma tabsize 0

#define ADMIN_VIP ADMIN_MENU


new cvar_on
new entlist[][] = {
"func_button",
"trigger_multiple",
"trigger_once"
}

public plugin_init() {
register_plugin("open jail","1.0","danielkza","MITAR");
register_concmd("open_jail","open_jail_cmd");
cvar_on = register_cvar("open_jail_on","1");
register_clcmd("say /vmenu", "HandleMenu");
}

public open_jail_cmd(id,level,cid) {
if(!cmd_access(id,level,cid,0))
return PLUGIN_HANDLED

new map[32]
get_mapname(map,31)

if(!get_pcvar_num(cvar_on)) {
client_print(id,print_console,"[HLEP] Jail opening disabled")
return PLUGIN_HANDLED
}

else if(!equali(map,"surf",4)) {
client_print(id,print_console,"[HELP] Not in a Surf map")
return PLUGIN_HANDLED
}

else {
if(read_argc()>1) {
new arg[8]
read_argv(1,arg,7)
set_task(str_to_float(arg),"open_jail",id)
}
else
open_jail(id)
}
return PLUGIN_HANDLED
}
new menu = menu_create("\yVMENU", "HandleMenu");
menu_additem(g_iMenuId, "M3 + Deagle + He + Armor", "1");
menu_additem(g_iMenuId, "M4a1 + Deagle + He + Armor", "2");
menu_additem(g_iMenuId, "Ak47 + Deagle + He + Armor", "3");
menu_additem(g_iMenuId, "AWP + Deagle + HE + Armor", "4");

public HandleMenu(id, iMenuId, iItem)
{
if(iItem == MENU_EXIT || !is_user_alive(id))
return PLUGIN_HANDLED;

switch(iItem)
{
case 0:
{
give_item(id, "weapon_m3");
give_item(id, "weapon_deagle");
give_item(id, "weapon_hegrenade");
set_user_armor(id, 100);
cs_set_user_bpammo(id, CSW_DEAGLE, 35);
cs_set_user_bpammo(id, CSW_M3, 32);
}

case 1:
{
give_item(id, "weapon_m4a1");
give_item(id, "weapon_deagle");
give_item(id, "weapon_hegrenade");
set_user_armor(id, 100);
cs_set_user_bpammo(id, CSW_DEAGLE, 35);
cs_set_user_bpammo(id, CSW_M4A1, 90);
}

case 2:
{
give_item(id, "weapon_ak47");
give_item(id, "weapon_deagle");
give_item(id, "weapon_hegrenade");
set_user_armor(id, 100);
cs_set_user_bpammo(id, CSW_DEAGLE, 35);
cs_set_user_bpammo(id, CSW_M4A1, 90);
}
case 3:
{
give_item(id, "weapon_awp");
give_item(id, "weapon_deagle");
give_item(id, "weapon_hegrenade");
set_user_armor(id, 100);
cs_set_user_bpammo(id, CSW_DEAGLE, 35);
cs_set_user_bpammo(id, CSW_AWP, 30);
}

public open_jail(id) {
new ent,target[32],ent2

for(new i=0;i < sizeof entlist;i++) {
ent=0
ent2=0
while((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", entlist[i]))) {
if(pev_valid(ent)) {
//dllfunc(DLLFunc_Touch,ent,id)
pev(ent,pev_target,target,31)
while((ent2 = engfunc(EngFunc_FindEntityByString, ent2, "targetname", target))) {
dllfunc(DLLFunc_Use,ent2,id)
client_print(id,print_console,"[HELP] A jail esta agora aberta")
return PLUGIN_HANDLED

}

SHIELD755 11-10-2018 23:19

Re: Help me with this menu
 
paste the code in PHP or code tag
like this way

PHP Code:



#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>
#include <fun>
#pragma tabsize 0 

#define ADMIN_VIP ADMIN_MENU


new cvar_on
new entlist[][] = {
"func_button",
"trigger_multiple",
"trigger_once"
}

public 
plugin_init() {
register_plugin("open jail","1.0","danielkza","MITAR");
register_concmd("open_jail","open_jail_cmd");
cvar_on register_cvar("open_jail_on","1");
register_clcmd("say /vmenu""HandleMenu");
}

public 
open_jail_cmd(id,level,cid) {
if(!
cmd_access(id,level,cid,0))
return 
PLUGIN_HANDLED

new map[32]
get_mapname(map,31)

if(!
get_pcvar_num(cvar_on)) {
client_print(id,print_console,"[HLEP] Jail opening disabled")
return 
PLUGIN_HANDLED
}

else if(!
equali(map,"surf",4)) {
client_print(id,print_console,"[HELP] Not in a Surf map")
return 
PLUGIN_HANDLED
}

else {
if(
read_argc()>1) {
new 
arg[8]
read_argv(1,arg,7)
set_task(str_to_float(arg),"open_jail",id)
}
else
open_jail(id)
}
return 
PLUGIN_HANDLED
}
new 
menu menu_create("\yVMENU""HandleMenu");
menu_additem(g_iMenuId"M3 + Deagle + He + Armor""1");
menu_additem(g_iMenuId"M4a1 + Deagle + He + Armor""2");
menu_additem(g_iMenuId"Ak47 + Deagle + He + Armor""3");
menu_additem(g_iMenuId"AWP + Deagle + HE + Armor""4");

public 
HandleMenu(idiMenuIdiItem)
{
if(
iItem == MENU_EXIT || !is_user_alive(id))
return 
PLUGIN_HANDLED;

switch(
iItem)
{
case 
0
{
give_item(id"weapon_m3");
give_item(id"weapon_deagle");
give_item(id"weapon_hegrenade");
set_user_armor(id100);
cs_set_user_bpammo(idCSW_DEAGLE35);
cs_set_user_bpammo(idCSW_M332);
}

case 
1:
{
give_item(id"weapon_m4a1");
give_item(id"weapon_deagle");
give_item(id"weapon_hegrenade");
set_user_armor(id100);
cs_set_user_bpammo(idCSW_DEAGLE35);
cs_set_user_bpammo(idCSW_M4A190);
}

case 
2:
{
give_item(id"weapon_ak47");
give_item(id"weapon_deagle");
give_item(id"weapon_hegrenade");
set_user_armor(id100);
cs_set_user_bpammo(idCSW_DEAGLE35);
cs_set_user_bpammo(idCSW_M4A190);
}
case 
3:
{
give_item(id"weapon_awp");
give_item(id"weapon_deagle");
give_item(id"weapon_hegrenade");
set_user_armor(id100);
cs_set_user_bpammo(idCSW_DEAGLE35);
cs_set_user_bpammo(idCSW_AWP30);
}

public 
open_jail(id) {
new 
ent,target[32],ent2

for(new i=0;sizeof entlist;i++) {
ent=0
ent2
=0
while((ent engfunc(EngFunc_FindEntityByStringent"classname"entlist[i]))) {
if(
pev_valid(ent)) {
//dllfunc(DLLFunc_Touch,ent,id)
pev(ent,pev_target,target,31)
while((
ent2 engfunc(EngFunc_FindEntityByStringent2"targetname"target))) {
dllfunc(DLLFunc_Use,ent2,id)
client_print(id,print_console,"[HELP] A jail esta agora aberta")
return 
PLUGIN_HANDLED




Mr Misw 11-11-2018 04:43

Re: Help me with this menu
 
Try This
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>
#include <fun>
#pragma tabsize 0 

new cvar_on
new bool:i_Menu[33];

new 
entlist[][] = 
{
    
"func_button",
    
"trigger_multiple",
    
"trigger_once"
}

public 
plugin_init() 
{
    
register_plugin("open jail","1.0","danielkza,MITAR");
    
register_logevent("RoundNew"2"1=Round_Start");
    
register_concmd("open_jail","open_jail_cmd");
    
cvar_on register_cvar("open_jail_on","1");
    
register_clcmd("say /vmenu""HandleMenu",ADMIN_LEVEL_H);
}
public 
RoundNew()
{
    
arrayset(i_Menu,false,33);
}
public 
open_jail_cmd(id,level,cid
{
    if(!
cmd_access(id,level,cid,0))
    {
        return 
PLUGIN_HANDLED
    
}

    new 
map[32]
    
get_mapname(map,31)

    if(!
get_pcvar_num(cvar_on)) 
    {
        
client_print(id,print_console,"[HLEP] Jail opening disabled")
        return 
PLUGIN_HANDLED
    
}

    else if(!
equali(map,"surf",4)) 
    {
        
client_print(id,print_console,"[HELP] Not in a Surf map")
        return 
PLUGIN_HANDLED
    
}

    else 
    {
        if(
read_argc()>1
        {
            new 
arg[8]
            
read_argv(1,arg,7)
            
set_task(str_to_float(arg),"open_jail",id)
        }
        
        else
        {
            
open_jail(id)
        }
    }
    return 
PLUGIN_HANDLED

}

public 
HandleMenu(id)
{
    if(!
is_allow_use(id)) 
    {
        return 
0;
    }
    new 
menu menu_create("\yVMENU""HandleMenuH");
    
menu_additem(menu"M3 + Deagle + He + Armor""1");
    
menu_additem(menu"M4a1 + Deagle + He + Armor""2");
    
menu_additem(menu"Ak47 + Deagle + He + Armor""3");
    
menu_additem(menu"AWP + Deagle + HE + Armor""4");
    
menu_setpropmenuMPROP_EXITMEXIT_ALL );
    
menu_display(id menu )
    return 
PLUGIN_HANDLED;
}

public 
HandleMenuH(idmenuitem)
{
    
i_Menu[id] = true;
    if(
item == MENU_EXIT || !is_user_alive(id))
    {
        return 
PLUGIN_HANDLED;
    }

    switch(
item)
    {
        case 
0
        {
            
give_item(id"weapon_m3");
            
give_item(id"weapon_deagle");
            
give_item(id"weapon_hegrenade");
            
set_user_armor(id100);
            
cs_set_user_bpammo(idCSW_DEAGLE35);
            
cs_set_user_bpammo(idCSW_M332);
        }

        case 
1:
        {
            
give_item(id"weapon_m4a1");
            
give_item(id"weapon_deagle");
            
give_item(id"weapon_hegrenade");
            
set_user_armor(id100);
            
cs_set_user_bpammo(idCSW_DEAGLE35);
            
cs_set_user_bpammo(idCSW_M4A190);
        }

        case 
2:
        {    
            
give_item(id"weapon_ak47");
            
give_item(id"weapon_deagle");
            
give_item(id"weapon_hegrenade");
            
set_user_armor(id100);
            
cs_set_user_bpammo(idCSW_DEAGLE35);
            
cs_set_user_bpammo(idCSW_M4A190);
        }
        case 
3:
        {
            
give_item(id"weapon_awp");
            
give_item(id"weapon_deagle");
            
give_item(id"weapon_hegrenade");
            
set_user_armor(id100);
            
cs_set_user_bpammo(idCSW_DEAGLE35);
            
cs_set_user_bpammo(idCSW_AWP30);
        }
    }
    
menu_destroymenu );
    return 
PLUGIN_HANDLED;
 } 

public 
open_jail(id
{
    new 
ent,target[32],ent2

    
for(new i=0;sizeof entlist;i++) 
    {
        
ent=0
        ent2
=0
        
while((ent engfunc(EngFunc_FindEntityByStringent"classname"entlist[i]))) 
        {
            if(
pev_valid(ent)) 
            {
                
pev(ent,pev_target,target,31)
            }
        }
        while((
ent2 engfunc(EngFunc_FindEntityByStringent2"targetname"target))) 
        {
            
dllfunc(DLLFunc_Use,ent2,id)
            
client_print(id,print_console,"[HELP] A jail esta agora aberta")
        }
    }
    return 
PLUGIN_HANDLED;
}
bool:is_allow_use(id)
{    
    if (
i_Menu[id] )
    {
        
client_print(id,print_chat,"You Can You It Only Once Every Round")
        return 
false;
    }
    return 
true;



MITAR 11-11-2018 07:02

Re: Help me with this menu
 
Thank you for making this pluguin work but I needed the prison to be opened by the menu and that the respawn option be added to the menu without any bugs, the respawn option can only be used every 5 rounds so as not to get too abusive. I also liked that the menu had 1 knife with or without model, but when giving the knife hit the adversary dies or change the knife damage I do not ask you to do it only if you want

I apologize for not posting in php because I did not know how to do it.


All times are GMT -4. The time now is 22:04.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.