Raised This Month: $ Target: $400
 0% 

menu open


Post New Thread Reply   
 
Thread Tools Display Modes
TRUE RED
Senior Member
Join Date: Mar 2012
Location: Ukraine
Old 04-13-2013 , 13:47   Re: menu open
Reply With Quote #11

PHP Code:
#include <amxmodx>
#include <fun>
#include <cstrike>

#define PLUGIN "vSmenu"
#define VERSION "1.0.0"
#define AUTHOR "NapoleoN#"

new iRoundsHasC4[33]

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_logevent("RoundStart"2"1=Round_Start")
    
register_logevent("LogEvent_GameCommencing"2"0=World triggered""1=Game_Commencing")
    
register_event("TextMsg","Event_RoundRestart","a","2&#Game_w")
}

public 
RoundStart() {
    
iRounds++;
    if(
iRounds 2) {
        new 
players[32], count
        get_players
(playerscount"a")
        
        for(new 
icounti++) {
            
cmd_vSmenu(players[i])
        }
    }
}

public 
LogEvent_GameCommencing() {
    
iRounds 0;
}

public 
Event_RoundRestart() {
    
iRounds 0;
}

public 
cmd_vSmenu(id) {
    if(!
is_user_alive(id))
        return 
PLUGIN_HANDLED
    
    
new menu menu_create("\yAlege" "dArc_submenu")
    
    
menu_additem(menu"\wAK47 + DEAGLE + He""1"0)
    
menu_additem(menu"\wM4A1 + DEAGLE + He""2"0)
    
menu_additem(menu"\wAWP + DEAGLE + He""3"0)
    
    
menu_setprop(menu,MPROP_EXITMEXIT_ALL)
    
menu_display(idmenu0)
    
    return 
PLUGIN_CONTINUE
}

public 
dArc_submenu(idmenuitem)
{
    if(
item == MENU_EXIT) {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    
HasC4[id] = (user_has_weapon(idCSW_C4))
    
    new 
Data[7], Name[64]
    new 
AccessCallback
    menu_item_getinfo
(menuitemAccessData5Name63Callback)
    
    new 
key str_to_num(Data)
    
    
strip_user_weapons(id)
    switch(
key) {
        case 
1: {
            
give_item(id"weapon_ak47")
            
cs_set_user_bpammo(idCSW_AK4790)
        }
        case 
2: {
            
give_item(id"weapon_m4a1")
            
cs_set_user_bpammo(idCSW_M4A190)
        }
        case 
3: {
            
give_item(id"weapon_awp")
            
cs_set_user_bpammo(idCSW_AWP30)
        }
    }
    if (
HasC4[id])
    {
        
give_item(id"weapon_c4");
        
cs_set_user_plantid );
    }
    
give_item(id"weapon_hegrenade")
    
give_item(id"weapon_knife")
    
give_item(id"weapon_deagle")
    
cs_set_user_bpammo(idCSW_DEAGLE35)
    return 
PLUGIN_HANDLED

now all works fine but after 3rd round C4 not appears on the back of any players but he/she can plant take and drob it.
also menu did not appears couple times.

Last edited by TRUE RED; 04-13-2013 at 13:52.
TRUE RED is offline
Send a message via ICQ to TRUE RED Send a message via Skype™ to TRUE RED
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-13-2013 , 13:52   Re: menu open
Reply With Quote #12

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <fun>

#tryinclude <cstrike_pdatas>

#if !defined _cbaseentity_included
        #assert Cstrike Pdatas and Offsets library required! Read the below instructions:   \
                
1. Download it at forums.alliedmods.net/showpost.php?p=1712101#post1712101   \
                
2. Put it into amxmodx/scripting/include/ folder   \
                
3. Compile this plugin locallydetailswiki.amxmodx.org/index.php/Compiling_Plugins_%28AMX_Mod_X%29   \
                
4. Install compiled plugindetailswiki.amxmodx.org/index.php/Configuring_AMX_Mod_X#Installing
#endif


#define PLUGIN "Free Weapons Menu"
#define VERSION "0.0.1"

enum _:ammoIndexes
{
    
ammo_none,
    
ammo_338magnum 1// 30
    
ammo_762nato// 90
    
ammo_556natobox// 200
    
ammo_556nato// 90
    
ammo_buckshot// 32
    
ammo_45acp// 100
    
ammo_57mm// 100
    
ammo_50ae// 35
    
ammo_357sig// 52
    
ammo_9mm// 120
    
ammo_flashbang// 2
    
ammo_hegrenade// 1
    
ammo_smokegrenade// 1
    
ammo_c4 // 1
}

enum _:hudHide ( <<= )
{
    
HUD_HIDE_CAL 1,
    
HUD_HIDE_FLASH,
    
HUD_HIDE_ALL,
    
HUD_HIDE_RHA,
    
HUD_HIDE_TIMER,
    
HUD_HIDE_MONEY,
    
HUD_HIDE_CROSS,
    
HUD_DRAW_CROSS
}

new 
bool:g_bIsRestarting

new g_iWeaponsMenu

new HamHook:g_iHhCBasePlayerSpawnP

public plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" )

    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")
    
register_event("TextMsg""Event_TextMsg_Restart""a""2&#Game_C""2&#Game_w")

    
DisableHamForwardg_iHhCBasePlayerSpawnP RegisterHam(Ham_Spawn"player""OnCBasePlayer_Spawn_Post"true) )
    
CreateWeaponsMenu()
}

public 
Event_TextMsg_Restart()
{
    
g_bIsRestarting true
}

public 
Event_HLTV_New_Round()
{
    static 
iRoundCount 1
    
if( g_bIsRestarting )
    {
        
g_bIsRestarting false
        iRoundCount 
1
        DisableHamForward
g_iHhCBasePlayerSpawnP )
    }
    else if( ++
iRoundCount == )
    {
        
EnableHamForwardg_iHhCBasePlayerSpawnP )
    }
}

CreateWeaponsMenu()
{
    
g_iWeaponsMenu menu_create("\yWeapons Menu""Weapons_Menu_Handler")
    
menu_setprop(g_iWeaponsMenuMPROP_NUMBER_COLOR"\w");
    
    
menu_additem(g_iWeaponsMenu"AK47 + Deagle + HE")
    
menu_additem(g_iWeaponsMenu"M4A1 + Deagle + HE")
    
menu_additem(g_iWeaponsMenu"AWP + Deagle + HE")
}

public 
OnCBasePlayer_Spawn_Postid )
{
    if( 
is_user_alive(id) )
    {
        
menu_displayid g_iWeaponsMenu )
    }
}

public 
Weapons_Menu_Handler(idmenuitem)
{
    if( 
is_user_alive(id) && (CS_TEAM_T <= cs_get_user_team(id) <= CS_TEAM_CT) )
    {
        switch( 
item )
        {
            case 
0:
            {
                
GiveUniqueWeapon(id"weapon_ak47"CSW_AK47190)
            }
            case 
1:
            {
                
GiveUniqueWeapon(id"weapon_m4a1"CSW_M4A1190)
            }
            case 
2:
            {
                
GiveUniqueWeapon(id"weapon_awp"CSW_AWP130)
            }
            default:
            {
                return
            }
        }
        
GiveUniqueWeapon(id"weapon_deagle"CSW_DEAGLE135)
        
GiveUniqueWeapon(id"weapon_hegrenade"CSW_DEAGLE11)
    }
}

GiveUniqueWeapon(idszName[], iIdiSlotiBpAmmo)
{
    if( !
user_has_weapon(idiId) )
    {
        if( 
get_pdata_cbase(idm_rgpPlayerItems_CBasePlayeriSlot ]) )
        {
            
RemovePlayerSlotsItem(idiSlot)
        }
        
give_item(idszName)
    }
    
cs_set_user_bpammo(idiIdiBpAmmo)
}

RemovePlayerSlotsItem(idiSlot)
{
    if( !(
<= iSlot <= 5) )
    {
        return 
0
    
}

    new 
iActiveItem get_pdata_cbase(idm_pActiveItem)

    if( 
iSlot == && get_pdata_bool(idm_bHasShield) )
    {
        
RemoveUserShieldid )
        if( 
<= ExecuteHamB(Ham_Item_ItemSlotiActiveItem) <= )
        {
            
ExecuteHamB(Ham_Item_DeployiActiveItem)
        }
        return 
1
    
}

    new 
iItemiWeapons pev(idpev_weapons)
    while( ( 
iItem get_pdata_cbase(idm_rgpPlayerItems_CBasePlayer[iSlot]) ) > )
    {
        if( 
iItem == iActiveItem )
        {
            
ExecuteHamB(Ham_Weapon_RetireWeaponiItem// only to call GetNextBestWeapon so player still have a weapon in hands.
        
}
        
iWeapons &= ~get_pdata_int(iItemm_iIdXO_CBASEPLAYERITEM)
        
ExecuteHamB(Ham_RemovePlayerItemidiItem)
        
ExecuteHamB(Ham_Item_KilliItem)
    }
    
set_pev(idpev_weaponsiWeapons)

    if( 
iSlot == )
    {
        
set_pdata_int(idm_fHasPrimary0)
    }
    else if( 
iSlot == )
    {
        
set_pdata_int(idm_rgAmmo_CBasePlayer[ammo_flashbang], 0)
        
set_pdata_int(idm_rgAmmo_CBasePlayer[ammo_hegrenade], 0)
        
set_pdata_int(idm_rgAmmo_CBasePlayer[ammo_smokegrenade], 0)
    }
    return 
1
}

RemoveUserShieldid )
{
    if ( 
get_pdata_bool(idm_bHasShield) )
    {
        
set_pdata_bool(idm_bHasShieldfalse)
        
set_pdata_int(idm_fHasPrimary0)
        
set_pdata_bool(idm_bUsesShieldfalse)
        
set_pev(idpev_gamestate1)
        new 
iHideHUD get_pdata_int(idm_iHideHUD)
        if( 
iHideHUD HUD_HIDE_CROSS )
        {
            
set_pdata_int(idm_iHideHUDiHideHUD & ~HUD_HIDE_CROSS)
        }
        return 
1
    
}
    return 
0

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Unkolix
Veteran Member
Join Date: Sep 2012
Old 04-13-2013 , 14:10   Re: menu open
Reply With Quote #13

Quote:
Originally Posted by TRUE RED View Post
now all works fine but after 3rd round C4 not appears on the back of any players but he/she can plant take and drob it.
also menu did not appears couple times.
Didn't quite understand it...
Unkolix is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-13-2013 , 14:25   Re: menu open
Reply With Quote #14

You have to set pev(id, pev_body, 1) on c4 carrier.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
TRUE RED
Senior Member
Join Date: Mar 2012
Location: Ukraine
Old 04-13-2013 , 14:27   Re: menu open
Reply With Quote #15

Quote:
Originally Posted by Unkolix
Didn't quite understand it...
when i look to a terrorist with C4 it is like he hasn't one but he tells me he has it. he can drop it but when he pick it i can't see C4 model on his back. it's kind no one can see who has C4.
and also menu with weapons wasn't showed few times.

Quote:
Originally Posted by ConnorMcLeod
PHP Code:
#include <amxmodx> 
#include <hamsandwich> 
#include <cstrike> 
#include <fun> 

#tryinclude <cstrike_pdatas> 

#if !defined _cbaseentity_included 
        #assert Cstrike Pdatas and Offsets library required! Read the below instructions:   \ 
                
1. Download it at forums.alliedmods.net/showpost.php?p=1712101#post1712101   \ 
                
2. Put it into amxmodx/scripting/include/ folder   
                
3. Compile this plugin locallydetailswiki.amxmodx.org/index.php/Compiling_Plugins_%28AMX_Mod_X%29   
                
4. Install compiled plugindetailswiki.amxmodx.org/index.php/Configuring_AMX_Mod_X#Installing 
#endif 


#define PLUGIN "Free Weapons Menu" 
#define VERSION "0.0.1" 

enum _:ammoIndexes 

    
ammo_none
    
ammo_338magnum 1// 30 
    
ammo_762nato// 90 
    
ammo_556natobox// 200 
    
ammo_556nato// 90 
    
ammo_buckshot// 32 
    
ammo_45acp// 100 
    
ammo_57mm// 100 
    
ammo_50ae// 35 
    
ammo_357sig// 52 
    
ammo_9mm// 120 
    
ammo_flashbang// 2 
    
ammo_hegrenade// 1 
    
ammo_smokegrenade// 1 
    
ammo_c4 // 1 


enum _:hudHide ( <<= 

    
HUD_HIDE_CAL 1
    
HUD_HIDE_FLASH
    
HUD_HIDE_ALL
    
HUD_HIDE_RHA
    
HUD_HIDE_TIMER
    
HUD_HIDE_MONEY
    
HUD_HIDE_CROSS
    
HUD_DRAW_CROSS 


new 
bool:g_bIsRestarting 

new g_iWeaponsMenu 

new HamHook:g_iHhCBasePlayerSpawnP 

public plugin_init() 

    
register_pluginPLUGINVERSION"ConnorMcLeod" 

    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0"
    
register_event("TextMsg""Event_TextMsg_Restart""a""2&#Game_C""2&#Game_w"

    
DisableHamForwardg_iHhCBasePlayerSpawnP RegisterHam(Ham_Spawn"player""OnCBasePlayer_Spawn_Post"true) ) 
    
CreateWeaponsMenu() 


public 
Event_TextMsg_Restart() 

    
g_bIsRestarting true 


public 
Event_HLTV_New_Round() 

    static 
iRoundCount 
    
if( g_bIsRestarting 
    { 
        
g_bIsRestarting false 
        iRoundCount 

        DisableHamForward
g_iHhCBasePlayerSpawnP 
    } 
    else if( ++
iRoundCount == 
    { 
        
EnableHamForwardg_iHhCBasePlayerSpawnP 
    } 


CreateWeaponsMenu() 

    
g_iWeaponsMenu menu_create("\yWeapons Menu""Weapons_Menu_Handler"
    
menu_setprop(g_iWeaponsMenuMPROP_NUMBER_COLOR"\w"); 
     
    
menu_additem(g_iWeaponsMenu"AK47 + Deagle + HE"
    
menu_additem(g_iWeaponsMenu"M4A1 + Deagle + HE"
    
menu_additem(g_iWeaponsMenu"AWP + Deagle + HE"


public 
OnCBasePlayer_Spawn_Postid 

    if( 
is_user_alive(id) ) 
    { 
        
menu_displayid g_iWeaponsMenu 
    } 


public 
Weapons_Menu_Handler(idmenuitem

    if( 
is_user_alive(id) && (CS_TEAM_T <= cs_get_user_team(id) <= CS_TEAM_CT) ) 
    { 
        switch( 
item 
        { 
            case 
0
            { 
                
GiveUniqueWeapon(id"weapon_ak47"CSW_AK47190
            } 
            case 
1
            { 
                
GiveUniqueWeapon(id"weapon_m4a1"CSW_M4A1190
            } 
            case 
2
            { 
                
GiveUniqueWeapon(id"weapon_awp"CSW_AWP130
            } 
            default: 
            { 
                return 
            } 
        } 
        
GiveUniqueWeapon(id"weapon_deagle"CSW_DEAGLE135
        
GiveUniqueWeapon(id"weapon_hegrenade"CSW_DEAGLE11
    } 


GiveUniqueWeapon(idszName[], iIdiSlotiBpAmmo

    if( !
user_has_weapon(idiId) ) 
    { 
        if( 
get_pdata_cbase(idm_rgpPlayerItems_CBasePlayeriSlot ]) ) 
        { 
            
RemovePlayerSlotsItem(idiSlot
        } 
        
give_item(idszName
    } 
    
cs_set_user_bpammo(idiIdiBpAmmo


RemovePlayerSlotsItem(idiSlot

    if( !(
<= iSlot <= 5) ) 
    { 
        return 

    


    new 
iActiveItem get_pdata_cbase(idm_pActiveItem

    if( 
iSlot == && get_pdata_bool(idm_bHasShield) ) 
    { 
        
RemoveUserShieldid 
        if( 
<= ExecuteHamB(Ham_Item_ItemSlotiActiveItem) <= 
        { 
            
ExecuteHamB(Ham_Item_DeployiActiveItem
        } 
        return 

    


    new 
iItemiWeapons pev(idpev_weapons
    while( ( 
iItem get_pdata_cbase(idm_rgpPlayerItems_CBasePlayer[iSlot]) ) > 
    { 
        if( 
iItem == iActiveItem 
        { 
            
ExecuteHamB(Ham_Weapon_RetireWeaponiItem// only to call GetNextBestWeapon so player still have a weapon in hands. 
        

        
iWeapons &= ~get_pdata_int(iItemm_iIdXO_CBASEPLAYERITEM
        
ExecuteHamB(Ham_RemovePlayerItemidiItem
        
ExecuteHamB(Ham_Item_KilliItem
    } 
    
set_pev(idpev_weaponsiWeapons

    if( 
iSlot == 
    { 
        
set_pdata_int(idm_fHasPrimary0
    } 
    else if( 
iSlot == 
    { 
        
set_pdata_int(idm_rgAmmo_CBasePlayer[ammo_flashbang], 0
        
set_pdata_int(idm_rgAmmo_CBasePlayer[ammo_hegrenade], 0
        
set_pdata_int(idm_rgAmmo_CBasePlayer[ammo_smokegrenade], 0
    } 
    return 



RemoveUserShieldid 

    if ( 
get_pdata_bool(idm_bHasShield) ) 
    { 
        
set_pdata_bool(idm_bHasShieldfalse
        
set_pdata_int(idm_fHasPrimary0
        
set_pdata_bool(idm_bUsesShieldfalse
        
set_pev(idpev_gamestate1
        new 
iHideHUD get_pdata_int(idm_iHideHUD
        if( 
iHideHUD HUD_HIDE_CROSS 
        { 
            
set_pdata_int(idm_iHideHUDiHideHUD & ~HUD_HIDE_CROSS
        } 
        return 

    

    return 


i really appreciate your help thank you for your post. i hugely respect you here! i tried your code but no menu to be shown at all, sorry.

Last edited by TRUE RED; 04-13-2013 at 14:28.
TRUE RED is offline
Send a message via ICQ to TRUE RED Send a message via Skype™ to TRUE RED
Unkolix
Veteran Member
Join Date: Sep 2012
Old 04-14-2013 , 04:29   Re: menu open
Reply With Quote #16

Quote:
Originally Posted by ConnorMcLeod View Post
You have to set pev(id, pev_body, 1) on c4 carrier.
Ooooh. Thanks. ;)

PHP Code:
#include <amxmodx>
#include <fun>
#include <cstrike>
#include <fakemeta>

#define PLUGIN "vSmenu"
#define VERSION "1.0.0"
#define AUTHOR "NapoleoN#"

new iRoundsHasC4[33]

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_logevent("RoundStart"2"1=Round_Start")
    
register_logevent("LogEvent_GameCommencing"2"0=World triggered""1=Game_Commencing")
    
register_event("TextMsg","Event_RoundRestart","a","2&#Game_w")
}

public 
RoundStart() {
    
iRounds++;
    if(
iRounds 2) {
        new 
players[32], count
        get_players
(playerscount"a")
        
        for(new 
icounti++) {
            
cmd_vSmenu(players[i])
        }
    }
}

public 
LogEvent_GameCommencing() {
    
iRounds 0;
}

public 
Event_RoundRestart() {
    
iRounds 0;
}

public 
cmd_vSmenu(id) {
    if(!
is_user_alive(id))
        return 
PLUGIN_HANDLED
    
    
new menu menu_create("\yAlege" "dArc_submenu")
    
    
menu_additem(menu"\wAK47 + DEAGLE + He""1"0)
    
menu_additem(menu"\wM4A1 + DEAGLE + He""2"0)
    
menu_additem(menu"\wAWP + DEAGLE + He""3"0)
    
    
menu_setprop(menu,MPROP_EXITMEXIT_ALL)
    
menu_display(idmenu0)
    
    return 
PLUGIN_CONTINUE
}

public 
dArc_submenu(idmenuitem)
{
    if(
item == MENU_EXIT) {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    
HasC4[id] = (user_has_weapon(idCSW_C4))
    
    new 
Data[7], Name[64]
    new 
AccessCallback
    menu_item_getinfo
(menuitemAccessData5Name63Callback)
    
    new 
key str_to_num(Data)
    
    
strip_user_weapons(id)
    switch(
key) {
        case 
1: {
            
give_item(id"weapon_ak47")
            
cs_set_user_bpammo(idCSW_AK4790)
        }
        case 
2: {
            
give_item(id"weapon_m4a1")
            
cs_set_user_bpammo(idCSW_M4A190)
        }
        case 
3: {
            
give_item(id"weapon_awp")
            
cs_set_user_bpammo(idCSW_AWP30)
        }
    }
    if (
HasC4[id])
    {
        
give_item(id"weapon_c4");
        
cs_set_user_plantid );
        
set_pev(idpev_body1);
    }
    
give_item(id"weapon_hegrenade")
    
give_item(id"weapon_knife")
    
give_item(id"weapon_deagle")
    
cs_set_user_bpammo(idCSW_DEAGLE35)
    return 
PLUGIN_HANDLED

Unkolix is offline
TRUE RED
Senior Member
Join Date: Mar 2012
Location: Ukraine
Old 04-14-2013 , 11:15   Re: menu open
Reply With Quote #17

works fine now, thank you very much! weapon menu wasn't shown once or twice i dunno why.

Last edited by TRUE RED; 04-15-2013 at 15:37.
TRUE RED is offline
Send a message via ICQ to TRUE RED Send a message via Skype™ to TRUE RED
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:58.


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