View Single Post
karceWZROKIEM
Junior Member
Join Date: Sep 2008
Location: Poland
Old 10-26-2009 , 11:40   Re: [INC] Fakemeta Utilities ready to be the AMXX default!
Reply With Quote #168

Quote:
Originally Posted by VEN View Post
The function gets what weapon type (CSW_*) a "grenade" entity is.
"grenade" entity is either the throwed grenade or the planted C4.

Returns 0 on failure. Win32 only. Provided as is (no warranties).
It's similar to the cs_get_armoury_type which work for "armoury_entity".

This function are useful because the old model check method aren't practical.
1. The model could be changed to the custom one by the 3rd party addon.
2. There are the moments when the grenade doesn't have the model (on explosion).

You shouldn't use the offsets and it's values for altering the grenade type.
This is not the data which controls the actual type, neither i think it's possible
to alter the type that way.

I'm not including this to the fakemeta_util.inc at least because it's win32 only.
I do realise that there are probably the more evident way but at least this work.
If you think something is incorrect or needs to be improved, feel free to post.
Code:
stock fm_cs_get_grenade_type(index) { // you can comment/remove this // if you are sure that the entity // with the given index are valid if (!pev_valid(index)) return 0 // you can comment/remove this // if you are sure that the entity // with the given index are "grenade" new classname[9] pev(index, pev_classname, classname, 8) if (!equal(classname, "grenade")) return 0 if (get_pdata_int(index, 96) & (1<<8)) return CSW_C4

new bits = get_pdata_int(index, 114) if (bits & (1<<0)) return CSW_HEGRENADE
else if (bits & (1<<1)) return CSW_SMOKEGRENADE
else if (!bits) return CSW_FLASHBANG

return 0 }

for both get_pdata_int OFFSET should be 5 not (default) 4....
__________________
"Smoking" or Drinking - THE Choice is Yours
I don't drink
karceWZROKIEM is offline