Raised This Month: $ Target: $400
 0% 

[solved] [help] get_weaponname


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 01-06-2015 , 04:44   [solved] [help] get_weaponname
Reply With Quote #1

How to get current weapon name of players ?
give me example
__________________
Thanks everyone. #miss_you_all

Last edited by indraraj striker; 01-06-2015 at 09:52.
indraraj striker is offline
Xablau
Member
Join Date: Dec 2014
Old 01-06-2015 , 05:49   Re: [help] get_weaponname
Reply With Quote #2

PHP Code:
static weapon
weapon 
get_user_weapon(id)
if(
weapon == CSW_KNIFE
                
client_print(idprint_chat"You have a knife"
Xablau is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 01-06-2015 , 08:54   Re: [help] get_weaponname
Reply With Quote #3

Quote:
Originally Posted by Xablau View Post
PHP Code:
static weapon
weapon 
get_user_weapon(id)
if(
weapon == CSW_KNIFE
                
client_print(idprint_chat"You have a knife"
its to hard to do with every weapon
i want any other way
__________________
Thanks everyone. #miss_you_all
indraraj striker is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 01-06-2015 , 09:06   Re: [help] get_weaponname
Reply With Quote #4

Just use native get_weaponname(id, weapon[], len).

Last edited by zmd94; 01-06-2015 at 09:06.
zmd94 is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 01-06-2015 , 09:12   Re: [help] get_weaponname
Reply With Quote #5

Quote:
Originally Posted by zmd94 View Post
Just use native get_weaponname(id, weapon[], len).
Please example
i know native but i didnt understand
__________________
Thanks everyone. #miss_you_all

Last edited by indraraj striker; 01-06-2015 at 09:13.
indraraj striker is offline
wiwi249
Member
Join Date: Oct 2013
Old 01-06-2015 , 09:12   Re: [help] get_weaponname
Reply With Quote #6

Code:
new weaponname[32]
new weapon = get_user_weapon(id);
get_weaponname(CSW_M4A1, weaponname, charsmax(weaponname));
replace(weaponname, charsmax(weaponname), "weapon_", "");
client_print(id, print_chat, "You have a %s", weaponname);

Last edited by wiwi249; 01-06-2015 at 09:18.
wiwi249 is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 01-06-2015 , 09:19   Re: [help] get_weaponname
Reply With Quote #7

Quote:
Originally Posted by wiwi249 View Post
Code:
new weaponname[32]
new weapon = get_user_weapon(id);
get_weaponname(CSW_M4A1, weaponname, charsmax(weaponname));replace(weaponname, charsmax(weaponname), "weapon_", "");
client_print(id, print_chat, "You have a %s", weaponname);
I tried your code but still one error

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_clcmd("say /test","ShowWeaponName");
}

public 
ShowWeaponName(id)
{
new 
weaponname[32];
new 
weapon get_user_weapon(id);
get_weaponname(CSW_M4A1weaponnamecharsmax(weaponname));
replace(weaponnamecharsmax(weaponname), "weapon_""");
client_print(idprint_chat"You have a %s"weaponname);

when i m compile its showing
test.sma(19) : warning 204: symbol is assigned a value that is never used: "weapon"
__________________
Thanks everyone. #miss_you_all

Last edited by indraraj striker; 01-06-2015 at 09:22.
indraraj striker is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 01-06-2015 , 09:36   Re: [help] get_weaponname
Reply With Quote #8

PHP Code:
new szWeapon[32]
new 
szWeaponID get_user_weapon(id);
get_weaponname(szWeaponIDszWeaponcharsmax(szWeapon))

client_print(idprint_chat"Now, you are using %s"szWeapon[7]) 
zmd94 is offline
wiwi249
Member
Join Date: Oct 2013
Old 01-06-2015 , 09:40   Re: [help] get_weaponname
Reply With Quote #9

You're right, now it's correct (btw. it was no error, just warning)
Code:
new weaponname[32];
new weapon = get_user_weapon(id);
get_weaponname(weapon, weaponname, charsmax(weaponname));
replace(weaponname, charsmax(weaponname), "weapon_", "");
client_print(id, print_chat, "You have a %s", weaponname);

wiwi249 is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 01-06-2015 , 09:52   Re: [help] get_weaponname
Reply With Quote #10

Thank you
Quote:
Originally Posted by zmd94 View Post
PHP Code:
new szWeapon[32]
new 
szWeaponID get_user_weapon(id);
get_weaponname(szWeaponIDszWeaponcharsmax(szWeapon))

client_print(idprint_chat"Now, you are using %s"szWeapon[7]) 

Quote:
Originally Posted by wiwi249 View Post
You're right, now it's correct (btw. it was no error, just warning)
Code:
new weaponname[32];
new weapon = get_user_weapon(id);
get_weaponname(weapon, weaponname, charsmax(weaponname));
replace(weaponname, charsmax(weaponname), "weapon_", "");
client_print(id, print_chat, "You have a %s", weaponname);

__________________
Thanks everyone. #miss_you_all
indraraj striker is offline
Old 09-15-2016, 08:38
pupdebox
This message has been deleted by pupdebox.
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 11:00.


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