Raised This Month: $32 Target: $400
 8% 

Weapon Menu API


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   General Purpose       
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 07-07-2022 , 21:50   Weapon Menu API
Reply With Quote #1

SIZE="6"]I'm done, I won't waste any more time for nothing but before I leave, I'll try to share all my plugins[/SIZE]

Why did i create this plugin? I've seen weapon menu hard code in ze and zp mods and to edit or add something you need to do this on the original source.

Requirements:
  • ReAPI
  • AMX-MODX v1.9+

Supports:
  • Zombie plague 5+ ( #include <zombieplague> )
  • Zombie plague 4+ ( #include <zombieplague> )
  • OciXCrom rank system ( #include <crxranks> )
  • My VIP system ( #include <vip> )

About the description:
I have no idea what to write but you need to test it to see how it works
Note: This plugin is working on any mod like classic, furien, zp, bb etc..
Images:






API:
PHP Code:
 #if defined _weapon_system_included
    #endinput
#endif

#define _weapon_system_included

const MAX_HANDLE_LENGTH 32;

enum
{
    
SECTION_PRIMARY,
    
SECTION_SECONDARY,
    
MAX_SECTION
}

enum ( += )
{
    
WEAPON_INVALID = -1,
    
WEAPON_AVAILABLE,
    
WEAPON_UNAVAILABLE,
    
WEAPON_DONT_SHOW
}

native register_weaponiSection, const szHandle[ ], const szReference[ ], const szName[ ], const szViewModel[ ], const szPlayerModel[ ], const szWorldModel[ ], iLevel 0iAdminFlag ADMIN_ALLiVIPFlag )
native add_weapon_text( const szText[ ], any:... );
native weapon_size( );
native is_valid_weapon( const iWeaponID )
native weapon_forceidiWeaponID )
native get_selected_weaponidiWeaponSection )
native get_weapon_nameiWeaponID, const szWeaponName[ ], iSize )
native get_weapon_id( const szWeaponName[ ] )
native show_weapon_menuid )
native is_auto_buy_enabledid )
native disable_auto_buyid )
native is_default_weaponiWeaponID )
native set_default_weaponiWeaponID )
forward weapon_select_preid iWeapon )

forward weapon_select_postid iWeapon 
Confing file that you can find the registered weapon data and do changes on the data.
Quote:
[Golden AK47]
SECTION = Primary
NAME = Golden AK47
HANDLE = weapon_ak47
REFERENCE = weapon_goldenak
VIEW_MODEL = models/v_golden_ak47.mdl
PLAYER_MODEL = models/p_golden_ak47.mdl
WORLD_MODEL = models/w_golden_ak47.mdl
LEVEL = 10
FLAG =
VIP_FLAG =
DEFAULT = true
Lang file:
Quote:
[en] -- Supremache
AUTO_SELECTED = Weapon [ %s ] was selected automatically!
NOT_EXIST = There's no weapons has created yet...
GET_SELECT_FIELD = Get Selection
AUTO_SELECT_FIELD = Auto Selection
ENABLE_AUTO_SELECT = ^3Enable^1 automatic purchase of weapon^4 [ %s ]
DISABLE_AUTO_SELECT = ^3Disable^1 automatic purchase of weapon^4 [ %s ]
ALVIE_ONLY = This is only available for alives
HUMAN_ONLY = This is only available for humans
ADMIN_ONLY = ADMIN ONLY
VIP_ONLY = VIP ONLY
UNAVAILABLE_LEVEL = Unlock ( Lv: %i )
UNAVAILABLE_SELECT = This is only available for &x04%s&x01.
ALREAY_SELECTED = You already have been selected a weapons.
TIMER_END = The menu time has ended.
MENU_PRIMARY_TITLE = Primary Menu:
MENU_SECONDARY_TITLE = Secondary Menu:
NOT_REGISTRED_PRIM = No primary weapons were registered
NOT_REGISTRED_SEC = No secondry weapons were registered
NOT_REGISTRED_YET = No weapons registered.
MENU_TIMER = Timer:\d
MENU_BACK = Back
MENU_NEXT = More
MENU_EXIT = Exit
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 08-22-2022 at 12:39.
Supremache is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 07-07-2022 , 21:53   Re: Weapon Menu API
Reply With Quote #2

Subplugin: GoldenAK47


Code
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 07-09-2022 at 00:13.
Supremache is offline
LiZou Mapper
Member
Join Date: Oct 2018
Location: Morocco
Old 08-03-2022 , 13:35   Re: Weapon Menu API
Reply With Quote #3

useful!
__________________

-------------
My Maps !
Zombie Escape Mod !
-------------

LiZou Mapper is offline
QuickDroLLL
Senior Member
Join Date: Dec 2021
Location: AMX Mod X Land
Old 08-17-2022 , 17:39   Re: Weapon Menu API
Reply With Quote #4

nice one !

i have realy cool idea like adding native thats add limit per player its will be cool and more advanced

Last edited by QuickDroLLL; 08-17-2022 at 17:43.
QuickDroLLL is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 08-18-2022 , 07:52   Re: Weapon Menu API
Reply With Quote #5

The timer menu has been ended



The menu time has ended.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 08-22-2022 , 12:38   Re: Weapon Menu API
Reply With Quote #6

Quote:
Originally Posted by QuickDroLLL View Post
nice one !

i have realy cool idea like adding native thats add limit per player its will be cool and more advanced
You can do something like this:
PHP Code:
#include <amxmodx>
#include <weapon>

const MAX_WEAPON_LENGTH 64;

new 
g_iWeaponLimitMAX_WEAPON_LENGTH ];
new 
g_iPlayerLimitMAX_PLAYERS ][ MAX_WEAPON_LENGTH ];

public 
plugin_init( )
{
    
register_plugin"Weapons Api: Limit""1.0""Supremache"  )
}

public 
weapon_select_preid iWeaponID )
{
    new 
iWpnLimit g_iWeaponLimitiWeaponID ];
    
    if( 
iWpnLimit && g_iPlayerLimitid ][ iWeaponID ] >= iWpnLimit )
    {
        
add_weapon_text"\r(%d/%d)"g_iPlayerLimitid ][ iWeaponID ], iWpnLimit );
        return 
WEAPON_UNAVAILABLE;
    }
    
    return 
WEAPON_AVAILABLE;
}

public 
weapon_select_postid iWeaponID )
{
    
g_iPlayerLimitid ][ iWeaponID ]++;
}


public 
plugin_natives( )
{
    
register_native("set_wpn_limit""_set_wpn_limit" )
    
register_native("get_user_limit""_get_user_limit" )
    
register_native("get_wpn_limit""_get_wpn_limit" )
}

public 
_get_user_limitiPluginiParams )
{
    new 
id get_param), iWeaponID get_param);
    
    if( !
is_valid_weaponiWeaponID ) )
    {
        
log_errorAMX_ERR_NATIVE"Invalid weapon id (%d)"iWeaponID )
        return 
WEAPON_INVALID;
    }
    
    return 
g_iPlayerLimitid ][ iWeaponID ];
}


public 
_set_wpn_limitiPluginiParams )
{
    new 
iWeaponID get_param), iWeaponLimit get_param);
    
    if( !
is_valid_weaponiWeaponID ) )
    {
        
log_errorAMX_ERR_NATIVE"Invalid weapon id (%d)"iWeaponID )
        return 
WEAPON_INVALID;
    }
    
    if( !
iWeaponLimit )
    {
        
log_error(AMX_ERR_NATIVE"Invalid Limit (%d)"iWeaponLimit )
        return 
0;
    }
    
    
g_iWeaponLimitiWeaponID ] = iWeaponLimit;
    
    return 
1;
}



public 
_get_wpn_limitiPluginiParams )
{
    new 
iWeaponID get_param);
    
    if( !
is_valid_weaponiWeaponID ) )
    {
        
log_errorAMX_ERR_NATIVE"Invalid weapon id (%d)"iWeaponID )
        return 
WEAPON_INVALID;
    }
    
    return 
g_iWeaponLimitiWeaponID ];

@Natsheh, Replaced, thanks.
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 09-10-2022 at 02:50.
Supremache is offline
Reply


Thread Tools
Display Modes

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 09:36.


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