View Single Post
VEN
Veteran Member
Join Date: Jan 2005
Old 01-19-2007 , 11:23   Re: Snark Glitch Fix 1.1
Reply With Quote #7

Quote:
entity_set_int is only in engine
You a correct here, while the fakemeta module have an equivalent natives. pev are similar to entity_get_* natives and set_pev are similar to entity_set_* natives.

Here is how you would use that natives:
Code:
new owner = pev(ent, pev_owner) // get an integer set_pev(ent, pev_owner, owner) // set an integer   new classname[32] pev(ent, pev_classname, classname, 31) // get a string set_pev(ent, pev_classname, classname) // set a string   new Float:float_ pev(ent, pev_health, float_) // get a float set_pev(ent, pev_health, float_) // set a float   new Float:origin[3] pev(ent, pev_origin, origin) // get a vector set_pev(ent, pev_origin, origin) // set a vector

I would highly not recommend to hardcode such common constants as weapon indeces. It is complicate reading of the code. You rather should define the constant once as shown above and then operating with the constant name, not the value itself. For example: if (MY_CONSTANT != something) // ... You should note that this will not affect the performance at all.
VEN is offline