Raised This Month: $ Target: $400
 0% 

Weapon Name


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
daNzEt
Senior Member
Join Date: Sep 2010
Location: Romania
Old 01-07-2014 , 03:09   Re: Weapon Name
Reply With Quote #1

Thanks it's works also this error cand be solved?

PHP Code:
[AMXXRun time error 10native error (native "get_user_weapon"
daNzEt is offline
Send a message via Yahoo to daNzEt Send a message via Skype™ to daNzEt
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 01-07-2014 , 05:39   Re: Weapon Name
Reply With Quote #2

Quote:
Originally Posted by daNzEt View Post
Thanks it's works also this error cand be solved?

PHP Code:
[AMXXRun time error 10native error (native "get_user_weapon"
show your full code so i can check error myself.
__________________
Blizzard_87 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-22-2014 , 13:12   Re: Weapon Name
Reply With Quote #3

For weapon name, use 4th DeathMsg arg (get_user_weapon fails on grenade kills).
To prevent errors when players are killed by world, add filter "1>0" in register_event
To prevent errors when players are killed by entities, check is killer index is a player index.

PHP Code:
new g_iMaxPlayers;
#define IsPlayer(%0)    ( 1 <= (%0) <= g_iMaxPlayers )

public plugin_init()
{
    
register_event("DeathMsg""event_DeathMsg""a""1>0");
    
g_iMaxPlayers get_maxplayers();
}

public 
event_DeathMsg(id)
{
    new 
iKiller read_data(1);
    new 
iVictim read_data(2);

    if(
iKiller != iVictim && IsPlayer(iKiller))
    {
        new 
name[32], szWeapon[32];

        
get_user_name(iKillernamecharsmax(name));
        
read_data(4szWeaponcharsmax(szWeapon));

        
chat_color(iVictim"!nKilled by !t%s !nwith !g%s !nand remained with !g%d !nhp"nameszWeaponget_user_health(iKiller));
    }


Also, at other places than DeathMsg callback, if you have a weapon name with format "weapon_****" and you want to print it without 'weapon_', just do :
PHP Code:
"weapon is %s"szWeapon[7
Don't use replace it is not needed at all.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 01-22-2014 at 13:15.
ConnorMcLeod is offline
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 20:36.


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