Raised This Month: $ Target: $400
 0% 

Set_user_rendering or Rg_set_user_rendering


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 07-09-2018 , 17:52   Re: Set_user_rendering or Rg_set_user_rendering
Reply With Quote #1

Both are the same thing.
If you used reAPI, use reAPI fuction to optimize the code
reAPI currrent is kind of like mixed hotpot which provide some unique function but most of the fuction could be done by other module.
For example, you can't hook weaponbox on the groud to prevent people get it (Zombie Mod)
__________________
My plugin:

Last edited by Celena Luna; 07-09-2018 at 17:52.
Celena Luna is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-09-2018 , 17:56   Re: Set_user_rendering or Rg_set_user_rendering
Reply With Quote #2

Quote:
Originally Posted by Celena Luna View Post
Both are the same thing.
If you used reAPI, use reAPI fuction to optimize the code
reAPI currrent is kind of like mixed hotpot which provide some unique function but most of the fuction could be done by other module.
For example, you can't hook weaponbox on the groud to prevent people get it (Zombie Mod)
Hm?

Code:
    /*     * Description:      The player is touching a CBasePlayerItem, do I give it to him?     * Return type:      BOOL     * Params:           (const index, const item)     */     RG_CSGameRules_CanHavePlayerItem,
__________________








CrazY. is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 07-09-2018 , 19:34   Re: Set_user_rendering or Rg_set_user_rendering
Reply With Quote #3

Quote:
Originally Posted by CrazY. View Post
Hm?

Code:
    /*     * Description:      The player is touching a CBasePlayerItem, do I give it to him?     * Return type:      BOOL     * Params:           (const index, const item)     */     RG_CSGameRules_CanHavePlayerItem,
I hooked it and block it but somehow it also block give weapon by normal way (not touch).
So it turn out that after I strip the weapon, the Zombie have no hand/knife
__________________
My plugin:
Celena Luna is offline
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 07-09-2018 , 19:48   Re: Set_user_rendering or Rg_set_user_rendering
Reply With Quote #4

Quote:
Originally Posted by Celena Luna View Post
I hooked it and block it but somehow it also block give weapon by normal way (not touch).
So it turn out that after I strip the weapon, the Zombie have no hand/knife
You can also use this. It works.

PHP Code:
RegisterHookChain(RG_CBasePlayer_AddPlayerItem"CBasePlayer_AddPlayerItem"); 
__________________
A plugin that is needed for every server.
PHP Code:
public client_connect(id)
{
    if(
get_user_iq(id) < 80)
    {
        
server_cmd("kick #%d 'You have kicked from the server because your IQ is not high enough'"get_user_userid(id));
    }

PurposeLessx is offline
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 07-09-2018 , 19:06   Re: Set_user_rendering or Rg_set_user_rendering
Reply With Quote #5

I really searched about reapi. It's really different include according to others. I just wonder that is it really
more optimized than fakemeta & engine or another include.

Which include works perfect and fastter than others?
__________________
A plugin that is needed for every server.
PHP Code:
public client_connect(id)
{
    if(
get_user_iq(id) < 80)
    {
        
server_cmd("kick #%d 'You have kicked from the server because your IQ is not high enough'"get_user_userid(id));
    }

PurposeLessx is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-09-2018 , 20:02   Re: Set_user_rendering or Rg_set_user_rendering
Reply With Quote #6

This hook is called in both events, weaponbox touch or when weapon is given to player. You can check if weapon is on the ground, or use ham to register touch in weaponbox entity. As an I said, the purpose of reapi is not replace other modules.

Quote:
Originally Posted by PurposeLessx View Post
Which include works perfect and fastter than others?
If you are meaning the comparasion between fakemeta and engine, both have has almost the same purpose, but the fakemeta have more hooks that you can register trough register_forward. Really doesn't matter which one you use, you can use the one be your preference.
__________________








CrazY. is offline
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 07-09-2018 , 20:23   Re: Set_user_rendering or Rg_set_user_rendering
Reply With Quote #7

Quote:
Originally Posted by CrazY. View Post
This hook is called in both events, weaponbox touch or when weapon is given to player. You can check if weapon is on the ground, or use ham to register touch in weaponbox entity. As an I said, the purpose of reapi is not replace other modules.



If you are meaning the comparasion between fakemeta and engine, both have has almost the same purpose, but the fakemeta have more hooks that you can register trough register_forward. Really doesn't matter which one you use, you can use the one be your preference.
I got it. So do you have anything to recommend for optimize. I have read all things in
https://wiki.alliedmods.net/Optimizi...od_X_Scripting).

Can you help me about more optimizing plugins.
__________________
A plugin that is needed for every server.
PHP Code:
public client_connect(id)
{
    if(
get_user_iq(id) < 80)
    {
        
server_cmd("kick #%d 'You have kicked from the server because your IQ is not high enough'"get_user_userid(id));
    }

PurposeLessx is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-09-2018 , 20:31   Re: Set_user_rendering or Rg_set_user_rendering
Reply With Quote #8

This really depends of what you are trying to do. I believe if you want some suggestions about how to improve your plugins, you need to share your code with us in another thread.
__________________








CrazY. is offline
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 07-09-2018 , 20:36   Re: Set_user_rendering or Rg_set_user_rendering
Reply With Quote #9

For example using stocks. Is there anything about these?

PHP Code:
stock bool:Stuck(Id)
{
    static 
Float:Origin[3];
    
get_entvar(Idvar_originOrigin);
    
engfunc(EngFunc_TraceHullOriginOriginIGNORE_MONSTERSget_entvar(Idvar_flags) & FL_DUCKING HULL_HEAD HULL_HUMAN00);
    return (
get_tr2(0TR_StartSolid)) ? true:false;
}

//

bool:Stuck(Id)
{
    static 
Float:Origin[3];
    
get_entvar(Idvar_originOrigin);
    
engfunc(EngFunc_TraceHullOriginOriginIGNORE_MONSTERSget_entvar(Idvar_flags) & FL_DUCKING HULL_HEAD HULL_HUMAN00);
    return (
get_tr2(0TR_StartSolid)) ? true:false;

What if I don't use stock? What changes? Or use "public" instead of stock?

What should I use "new or static" while using "register_message"

Example;
PHP Code:
#define BYTE_HA ((1<<3) | (1<<5))
HideWeapon get_user_msgid("HideWeapon");

register_message(HideWeapon"message_HideWeapon");

public 
message_HideWeapon()
{
//new or static here? Or instead of them, using get_msg_arg_int() | BYTE_HA
    
new getmsgargint get_msg_arg_int(1);
    
set_msg_arg_int(1ARG_BYTE,  getmsgargint BYTE_HA);

__________________
A plugin that is needed for every server.
PHP Code:
public client_connect(id)
{
    if(
get_user_iq(id) < 80)
    {
        
server_cmd("kick #%d 'You have kicked from the server because your IQ is not high enough'"get_user_userid(id));
    }


Last edited by PurposeLessx; 07-09-2018 at 20:36.
PurposeLessx is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-09-2018 , 21:09   Re: Set_user_rendering or Rg_set_user_rendering
Reply With Quote #10

First, let me explain the difference between public, stocks and private ("untagged") functions, although posts related to your question already exists some where in this forum.


1° public functions is the only ones that can be set as an callback and doesn't output compilation errors if the function is not being used in your plugin, so you can add them to includes.

2° stocks generally it's only used in includes. As an public function, doesn't output compilation error if is not being used, but CANNOT be set as an callback.

3° private functions CANNOT be set as an callback and WILL output compilation errors if is not being used in your plugin.


In the question of performance, I believe doesn't change anything, also, take in mind that all will output errors if is there something written wrong or missing in your code.


Static variables it's recommended to use in functions that will be called repeatedly in a short period of time, like Ham_Think, FM_AddToFullPack, Ham_Item_PostFrame, etc.
__________________









Last edited by CrazY.; 07-09-2018 at 21:10.
CrazY. is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:56.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode