AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   New Plugin Submissions (https://forums.alliedmods.net/forumdisplay.php?f=26)
-   -   Weapon Menu API (https://forums.alliedmods.net/showthread.php?t=338481)

Supremache 07-07-2022 21:50

Weapon Menu API
 
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:
https://i.ibb.co/YN4S32x/t12.png
https://i.ibb.co/8gNLk37/gas.png
https://i.ibb.co/ZKqpnZ4/gada.png
https://i.ibb.co/MPW883Q/13123.png
https://i.ibb.co/XFZdFxn/aacac.png
https://i.ibb.co/5cbdzyg/adaa.png
https://i.ibb.co/bK6N57X/afa.png
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

Supremache 07-07-2022 21:53

Re: Weapon Menu API
 
Subplugin: GoldenAK47
https://i.ibb.co/vd0xMnG/gaga.png

Code

LiZou Mapper 08-03-2022 13:35

Re: Weapon Menu API
 
useful!

QuickDroLLL 08-17-2022 17:39

Re: Weapon Menu API
 
nice one !

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

Natsheh 08-18-2022 07:52

Re: Weapon Menu API
 
The timer menu has been ended

:arrow:

The menu time has ended.

Supremache 08-22-2022 12:38

Re: Weapon Menu API
 
Quote:

Originally Posted by QuickDroLLL (Post 2786724)
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.

s1mpLeRS 06-12-2024 20:30

Re: Weapon Menu API
 
Quote:

WeaponAPI.sma(833 -- 837) : error 047: array sizes do not match, or destination array is too small
GoldenAK47.sma(4) : fatal error 100: cannot read from file: "weapon"
Can someone fix this please? I really like to use this plugins.


All times are GMT -4. The time now is 06:29.

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