Quote:
Originally Posted by Drixevel
Either the 'm_hOriginalLauncher' netprop or the 'm_hLauncher' netprop.
|
Sorry, but how would one go about checking this? I'm new to all of this netprop stuff... Lets say I'd like to check if the weapon is the loose cannon, would I do something like this:
Code:
public OnEntityDestroyed(iEntity)
{
decl String:classname[64];
GetEntityClassname(iEntity, classname, sizeof(classname));
if((!strcmp(classname, "tf_projectile_pipe")))
{
new weapon = GetEntProp(iEntity, Prop_Data, "m_hLauncher");
if(weapon == 996){
//do something
}
}
}
EDIT: I tried both m_hLauncher and m_hOriginalLauncher, they both return:
Code:
[SM] Exception reported: Property "m_hOriginalLauncher" not found (entity 341/tf_projectile_pipe)
[SM] Exception reported: Property "m_hLauncher" not found (entity 341/tf_projectile_pipe)
EDIT2: Nvm I found a way that works! Instead of directly finding the gun that fired the projectile, I first find the owner of the projectile with "m_hThrower", and then find out what the primary weapon that player is using:
Code:
public OnEntityDestroyed(iEntity)
{
decl String:classname[64];
GetEntityClassname(iEntity, classname, sizeof(classname));
if((!strcmp(classname, "tf_projectile_pipe")))
{
new owner = GetEntPropEnt(iEntity, Prop_Data, "m_hThrower");
new weaponind = GetIndexOfWeaponSlot(owner, TFWeaponSlot_Primary);
if(weaponind == 996){
//do something
}
}
}
stock GetIndexOfWeaponSlot(client, slot)
{
new weapon = GetPlayerWeaponSlot(client, slot);
return (weapon > MaxClients && IsValidEntity(weapon) ? GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex") : -1);
}
Thanks anyways!