Quote:
Originally Posted by hornet
@Baneado its hard to say unless you show your code or explain what your trying to do otherwise its really going to be XY problem. However, I can't imagine why you would need to use get_user_weapon() inside client_PreThink.
|
Quote:
Originally Posted by ConnorMcLeod
I second that.
Anyway, your question is abstract, we need to know exactly what you are doing in plugins with PreThink so we can tell you if there are alternatives or not.
For sure, PreThink is a bad function to hook in many situations.
|
It's simple, I have got a variable in the main plugin, this variable saves the currentweapon of a player. (of course this variable it's used in the plugin, I don't use get_user_weapon)
I asked about what is more efficient method for a subplugin, make a native or use get_user_weapon.
Native would be something like this:
PHP Code:
public native_weapon(id)
{
if (!is_user_valid_connected(id))
{
//log error in a file...
return;
}
return g_wpn_current[id];
}
Then, in the subplugin what it's better, use the new native
PHP Code:
public client_PreThink(id)
{
if (!g_alive[id] || my_new_native_getweapon(id) != CSW_KNIFE)
return;
}
or get_user_weapon??
PHP Code:
public client_PreThink(id)
{
if (!g_alive[id] || get_user_weapon(id) != CSW_KNIFE)
return;
}