Raised This Month: $ Target: $400
 0% 

make_deathmsg usage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 08-06-2010 , 18:27   make_deathmsg usage
Reply With Quote #1

Alright so I'm using make_deathmsg but there is an argument.
Since the fourth param has to be const, can I do this:

PHP Code:
public eDeathiVictimiAttacker )
{
     new 
iWeapon[33];
     
     if( 
cs_get_user_team(iVictim) == CS_TEAM_T )
     {
          
iWeapon[iAttacker] = get_user_weaponiAttacker )
          
make_deathmsgiAttackeriVictim0iWeapon )
          return 
PLUGIN_HANDLED;
     }

__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 08-06-2010 , 18:39   Re: make_deathmsg usage
Reply With Quote #2

No, get_user_weapon( id ) returns the weapon id of the currently carried weapon. You must do this:
PHP Code:
new iWeapon[32]
new 
wepid get_user_weaponid )
get_weaponnamewepidiWeapon31 
Even then, I think that will return something like "weapon_" so, do actually get the weapon name that is normally used, you are going to have to make a constant or something with the names the same as the weapon id. Which are these:
Code:
/* Id of weapons in CS */
#define CSW_P228        1
#define CSW_SCOUT        3
#define CSW_HEGRENADE        4
#define CSW_XM1014        5
#define CSW_C4            6
#define CSW_MAC10        7
#define CSW_AUG            8
#define CSW_SMOKEGRENADE    9
#define CSW_ELITE        10
#define CSW_FIVESEVEN        11
#define CSW_UMP45        12
#define CSW_SG550        13
#define CSW_GALI        14
#define CSW_GALIL        14
#define CSW_FAMAS        15
#define CSW_USP            16
#define CSW_GLOCK18        17
#define CSW_AWP            18
#define CSW_MP5NAVY        19
#define CSW_M249        20
#define CSW_M3            21
#define CSW_M4A1        22
#define CSW_TMP            23
#define CSW_G3SG1        24
#define CSW_FLASHBANG        25
#define CSW_DEAGLE        26
#define CSW_SG552        27
#define CSW_AK47        28
#define CSW_KNIFE        29
#define CSW_P90            30

Last edited by RedRobster; 08-06-2010 at 18:43.
RedRobster is offline
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 08-06-2010 , 18:45   Re: make_deathmsg usage
Reply With Quote #3

Quote:
Originally Posted by RedRobster View Post
No, get_user_weapon( id ) returns the weapon id of the currently carried weapon. You must do this:
PHP Code:
new iWeapon[32]
new 
wepid get_user_weaponid )
get_weaponnamewepidiWeapon31 
Even then, I think that will return something like "weapon_" so, do actually get the weapon name that is normally used, you are going to have to make a constant or something with the names the same as the weapon id. Which are these:
Code:
/* Id of weapons in CS */
#define CSW_P228        1
#define CSW_SCOUT        3
#define CSW_HEGRENADE        4
#define CSW_XM1014        5
#define CSW_C4            6
#define CSW_MAC10        7
#define CSW_AUG            8
#define CSW_SMOKEGRENADE    9
#define CSW_ELITE        10
#define CSW_FIVESEVEN        11
#define CSW_UMP45        12
#define CSW_SG550        13
#define CSW_GALI        14
#define CSW_GALIL        14
#define CSW_FAMAS        15
#define CSW_USP            16
#define CSW_GLOCK18        17
#define CSW_AWP            18
#define CSW_MP5NAVY        19
#define CSW_M249        20
#define CSW_M3            21
#define CSW_M4A1        22
#define CSW_TMP            23
#define CSW_G3SG1        24
#define CSW_FLASHBANG        25
#define CSW_DEAGLE        26
#define CSW_SG552        27
#define CSW_AK47        28
#define CSW_KNIFE        29
#define CSW_P90            30
Well can you possibly post a fix for this that I could use? <3
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 08-06-2010 , 18:45   Re: make_deathmsg usage
Reply With Quote #4

Code:
new name[20] get_weaponname( cs_get_weapon_id( get_user_weapon( id ) ), name, 19 ) make_deathmsg( iAttacker, iVictim, 0, name )
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 08-06-2010 , 18:49   Re: make_deathmsg usage
Reply With Quote #5

Quote:
Originally Posted by wrecked_ View Post
Code:
new name[20] get_weaponname( cs_get_weapon_id( get_user_weapon( id ) ), name, 19 ) make_deathmsg( iAttacker, iVictim, 0, name )
Does it automatically truncate it? As deathmsg uses truncated weapon name.
Or isn't it required at all?

Also... don't you need the actual entity index for cs_get_weapon_id? It should be fine with just get_user_weapon(iAttacker), as far as I know.
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 08-06-2010 , 18:55   Re: make_deathmsg usage
Reply With Quote #6

The get_weaponname() function requires the CSW_* id.

Code:
new name[20] get_weaponname( get_user_weapon( id ), name, 19 ) format( name, 19, "%s", name[7] ) make_deathmsg( iAttacker, iVictim, 0, name )
Give that a shot.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT

Last edited by wrecked_; 08-06-2010 at 19:34.
wrecked_ is offline
DarkGod
SourceMod DarkCrab
Join Date: Jul 2007
Location: Sweden
Old 08-06-2010 , 18:57   Re: make_deathmsg usage
Reply With Quote #7

Quote:
Originally Posted by wrecked_ View Post
The get_weaponname() function requires the CSW_* id.
get_user_weapon() returns the CSW_* index.
__________________
DarkGod is offline
Send a message via AIM to DarkGod Send a message via MSN to DarkGod
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 08-06-2010 , 19:34   Re: make_deathmsg usage
Reply With Quote #8

Quote:
Originally Posted by DarkGod View Post
get_user_weapon() returns the CSW_* index.
Fixed.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-06-2010 , 21:25   Re: make_deathmsg usage
Reply With Quote #9

Quote:
Originally Posted by wrecked_ View Post
The get_weaponname() function requires the CSW_* id.

Code:
new name[20] get_weaponname( get_user_weapon( id ), name, 19 ) format( name, 19, "%s", name[7] ) make_deathmsg( iAttacker, iVictim, 0, name )
Give that a shot.
format() is not needed, wrecked.

"weapon_ak47"
"ak47" can be accessed with name[ 7 ].
PHP Code:
new name[20]
get_weaponnameget_user_weaponiAttacker ) , name charsmaxname ) )
make_deathmsgiAttacker iVictim name] ) 
GXLZPGX, where is this being called? If you are using DeathMsg then you cannot pass victim and attacker as params like that; you must use read_data.
PHP Code:
public plugin_init()
{
    
register_event"DeathMsg" "EvDeathMsg" "a" "1>0" );    
}

public 
EvDeathMsg()
{
    new 
iKiller read_data);
    new 
iVictim read_data);

    static 
name[20]
    
get_weaponnameget_user_weaponiKiller ) , name charsmaxname ) )
    
make_deathmsgiKiller iVictim name] )

__________________

Last edited by Bugsy; 08-06-2010 at 21:33.
Bugsy is offline
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 08-06-2010 , 20:24   Re: make_deathmsg usage
Reply With Quote #10

I was just under the assumption that get_weaponname( ) would return the "weapon_name". But, I'm not sure.

As for the const thing I was talking about earlier, I would just do something like this:

PHP Code:
new const gszWeaponNames[][] =
{
    
"p228",
    
"",
    
"scout",
    
"grenade",
    
"xm1014",
    
"C4",
    
"mac10",
    
"aug",
    
"",
    
"dual elites",
    
"fiveseven",
    
"ump45"
    "sg550"
,
    
"galil",
    
"famas",
    
"usp",
    
"glock",
    
"awp",
    
"mp5",
    
"m249",
    
"m3",
    
"m4a1",
    
"tmp",
    
"g3sg1",
    
"",
    
"deagle",
    
"sg552",
    
"ak-47",
    
"knife",
    
"p90"

^If wrecked's version doesn't work. Then, do use a weapon, just do gszWeaponNames[wepid].
RedRobster 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 00:06.


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