Raised This Month: $ Target: $400
 0% 

get_user_weapon2() give me only one letter


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 10-01-2009 , 06:33   get_user_weapon2() give me only one letter
Reply With Quote #1

Well the problem is with the stock by xPaw:

http://forums.alliedmods.net/showthread.php?t=88242

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

#define PLUGIN    "New Plugin"
#define AUTHOR    "Alucard"
#define VERSION    "1.0"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /test""Test")
}

public 
Test(id)
{
    
client_print(idprint_chat"Your weapon is: %s"get_user_weapon2(id) )
}

public 
get_user_weapon2(id)
{
    new 
szWeapon[20]
    
get_weaponname(get_user_weapon(id), szWeaponcharsmax(szWeapon) )
    
    return 
szWeapon[7]

For example with USP, i get this message:

Quote:
Your weapon is: uVfnz
And with knife i get:

Quote:
Your weapon is: k
o.O
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 10-01-2009 , 07:21   Re: get_user_weapon2() give me only one letter
Reply With Quote #2

Why don't you pass it byref?
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 10-01-2009 , 08:10   Re: get_user_weapon2() give me only one letter
Reply With Quote #3

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

#define PLUGIN    "New Plugin"
#define AUTHOR    "Alucard"
#define VERSION    "1.0"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /test""Test")
}

public 
Test(id)
{
    
client_print(idprint_chat"Your weapon is: %s"get_user_weapon2(id) )
}

public 
get_user_weapon2(id)
{
    new 
szWeapon[20]
    
get_weaponname(get_user_weapon(id), szWeaponcharsmax(szWeapon) )
    
copy(szWeapon19szWeapon[7])
    return 
szWeapon

__________________
Impossible is Nothing
Sylwester is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 10-01-2009 , 08:58   Re: get_user_weapon2() give me only one letter
Reply With Quote #4

PHP Code:
public get_user_weapon2id )
{
    new 
szWeapon20 ]
    
get_weaponnameget_user_weaponid ), szWeaponcharsmaxszWeapon ) )
    return 
stringszWeapon] )
}  
stringoper[ ] )
    return 
oper
SnoW is offline
Send a message via MSN to SnoW
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-01-2009 , 19:42   Re: get_user_weapon2() give me only one letter
Reply With Quote #5

IMO, easier to just do

PHP Code:
new szWeapon20 ]
get_weaponnameget_user_weaponid ), szWeapon19 
Then use szWeapon[ 7 ] to retrieve weapon name without the "weapon_"

PHP Code:
new szWeapon20 ]
get_weaponnameget_user_weaponid ), szWeapon19 )

client_printid print_chat "I am using %s" szWeapon] ); 
__________________

Last edited by Bugsy; 10-01-2009 at 20:10.
Bugsy is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 10-01-2009 , 22:29   Re: get_user_weapon2() give me only one letter
Reply With Quote #6

Thx all, i tested bugsy code and work perfect.
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
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 22:35.


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