View Single Post
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 07-03-2014 , 13:36   Re: [CSGO] CSGO items - plugin
Reply With Quote #4

Quote:
Originally Posted by SynRobin View Post
I'm using player_death already and there is no weapon_itemid available.
url: https://wiki.alliedmods.net/Counter-...fensive_Events
I tested and it exist but return as 0 always.
But seems after previous(es) csgo updates, "weapon" string return already with weapon right item name.
I tough it still return with default entity classname (or what was that proplem...)

I get confused and I assume now you want weapon item index from event weapon name ?
PHP Code:
#include <csgo_items>

public OnPluginStart()
{
    
HookEventEx("player_death"event);
}

public 
event(Handle:event,const String:name[],bool:dontBroadcast)
{
    new 
String:weapon[100];
    
GetEventString(event"weapon"weaponsizeof(weapon));
    
Format(weaponsizeof(weapon), "weapon_%s"weapon);
    
PrintToServer("weapon %s"weapon);

    
PrintToServer("weapon item index %i"CSGO_GetItemDefinitionIndexByName(weapon));


Last edited by Bacardi; 07-03-2014 at 13:38.
Bacardi is offline