AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Get weapon in DeathMsg (https://forums.alliedmods.net/showthread.php?t=92754)

xbatista 05-19-2009 07:47

Get weapon in DeathMsg
 
So I've put chat in debug mod, why it won't print? What is wrong?

PHP Code:

register_event("DeathMsg""Ev_DeathMsg""a"); 

PHP Code:

public Ev_DeathMsg()
{
    new 
attacker read_data(1);
    new 
szWeapon[20
    
read_data(4szWeapon19)
    if ( 
equali(szWeapon"weapon_glock18") ) 
    { 
        
client_print(attackerprint_chat"Example!"); 
        
//do thing 
    
}



xPaw 05-19-2009 07:56

Re: Get weapon in DeathMsg
 
try to print szWeapon in chat.

if it will not work, you can try to use get_user_weapon of attacker

shine771 05-19-2009 08:00

Re: Get weapon in DeathMsg
 
remove weapon_.

xbatista 05-19-2009 08:10

Re: Get weapon in DeathMsg
 
Quote:

remove weapon_.
Works. :0


@xPaw ,get_user_weapon already tryied and read in forum,it won't work

ConnorMcLeod 05-19-2009 10:49

Re: Get weapon in DeathMsg
 
Be carefull weapon_hegrenade will show "grenade".

xbatista 05-19-2009 10:53

Re: Get weapon in DeathMsg
 
Yea I know ^_^ searched a lot :) but don't find "remove weapon_ "

hleV 05-19-2009 11:23

Re: Get weapon in DeathMsg
 
Quote:

Originally Posted by xbatista (Post 830457)
searched a lot :) but don't find "remove weapon_ "

First place I would search for an event arguments would be this page. And guess what? The answer is there! It clearly says
Quote:

Originally Posted by AMXX Wiki
Note: TruncatedWeaponName doesn't contain a "weapon_" prefix.


xbatista 05-19-2009 11:59

Re: Get weapon in DeathMsg
 
I am never searching in Wiki :]

xPaw 05-19-2009 12:15

Re: Get weapon in DeathMsg
 
Quote:

Originally Posted by xbatista (Post 830509)
I am never searching in Wiki :]

Try next time :)


All times are GMT -4. The time now is 01:30.

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