Raised This Month: $ Target: $400
 0% 

Solved weapon names


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-08-2021 , 11:21   Re: weapon names
Reply With Quote #7

This will allow you to have a standard and custom weapon name.

GetWeaponName() allows you to retrieve either the standard or custom name. If you ask for the custom name and the custom name is not defined, it will return the standard name instead.

You can build a function to populate this array with a weapon name as needed:
PHP Code:
copyg_weaponsCSW_M4A1 ][ CustomName ] , charsmaxg_weapons[][] ) , "M4A-One" ); 
PHP Code:

#include <amxmodx>

enum WeaponNameTypes
{
    
StandardName,
    
CustomName
}

new 
g_weapons[33][ WeaponNameTypes ][32] = 

    { 
"""" },
    { 
"P250""" }, 
    { 
"""" }, 
    { 
"Steyr Scout""" }, 
    { 
"HE Grenade""" }, 
    { 
"XM1014""" }, 
    { 
"C4 Explosive""" }, 
    { 
"MAC-10""" }, 
    { 
"AUG""" }, 
    { 
"Smoke Grenade""" }, 
    { 
"Dual Berettas""" }, 
    { 
"Five-SeveN""" }, 
    { 
"UMP-45""" }, 
    { 
"SCAR-20""" }, 
    { 
"Galil AR""" }, 
    { 
"FAMAS""" }, 
    { 
"USP-S""" }, 
    { 
"Glock-18""" }, 
    { 
"AWP""" }, 
    { 
"MP5""" }, 
    { 
"M249""" }, 
    { 
"M3""" }, 
    { 
"M4A1-S""" }, 
    { 
"Steyr TMP""" }, 
    { 
"G3SG1""" }, 
    { 
"Flashbang""" }, 
    { 
"Desert Eagle""" }, 
    { 
"SG 552""" }, 
    { 
"AK47""" }, 
    { 
"Classic Knife""" }, 
    { 
"P90""" }, 
    { 
"vest""" }, 
    { 
"vest + helmet" "" }
}


public 
plugin_init() 
{
    new 
szTemp32 ];
    
    
GetWeaponNameCSW_M4A1 CustomName szTemp charsmaxszTemp ) );
    
    
server_printszTemp );
}

GetWeaponNameWeaponID WeaponNameTypes:wnType szBuffer32 ] , maxchars )
{
    new 
WeaponNameTypes:wnWeaponNameType = ( ( wnType == CustomName ) && ( g_weaponsWeaponID ][ wnType ][ ] != EOS ) ) ? CustomName StandardName;
    
    return 
copyszBuffer maxchars g_weaponsWeaponID ][ wnWeaponNameType ] );

__________________

Last edited by Bugsy; 05-08-2021 at 11:21.
Bugsy is offline
 



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 02:30.


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