Raised This Month: $32 Target: $400
 8% 

Optimize Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 07-17-2018 , 15:27   Re: Optimize Plugin
Reply With Quote #11

What about increasing heap size by #pragma dynamic ? (default value = 4096)
__________________

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM
Ghosted is offline
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 07-17-2018 , 15:28   Re: Optimize Plugin
Reply With Quote #12

Quote:
Originally Posted by OciXCrom View Post
If it wasn't, would I be writing this in a thread that says "OPTIMIZE PLUGIN"?
Wow, you are right. So can you give me some examples about using "stock bool or nothing"

For example;

First; there is anything tag of command. What if I add a tag (stock or public)
Second; there is stock and bool. What if I delete stock or bool?
Code:
rg_set_user_rendering(index, fx = kRenderFxNone, {Float,_}:color[3] = {0.0,0.0,0.0}, render = kRenderNormal, Float:amount = 0.0)
{
	set_entvar(index, var_renderfx, fx);
	set_entvar(index, var_rendercolor, color);
	set_entvar(index, var_rendermode, render);
	set_entvar(index, var_renderamt, amount);
}

stock bool:Stuck(index)
{
	static Float:origin[3];
	get_entvar(index, var_origin, origin);
	engfunc(EngFunc_TraceHull, origin,origin, IGNORE_MONSTERS, get_entvar(index, var_flags) & FL_DUCKING ? HULL_HEAD : HULL_HUMAN, 0, 0);
	return (get_tr2(0, TR_StartSolid)) ? true:false;
}
__________________
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
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 07-17-2018 , 15:38   Re: Optimize Plugin
Reply With Quote #13

You shouldn't be using "stock" in the .sma files. This tag is used only if there is a possibility that the function will not be used at all. Since this is your code and you added the function, you're probably going to use it as well, so remove the "stock" tag. Only use "stock" in include files where not all functions must be used in the code when included.

"bool" is pretty self-explainatory. If the variable is tagged with "bool", then the return value of the function should also be "bool". Bools can be only true or false.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 07-17-2018 , 16:09   Re: Optimize Plugin
Reply With Quote #14

Quote:
Originally Posted by OciXCrom View Post
You shouldn't be using "stock" in the .sma files. This tag is used only if there is a possibility that the function will not be used at all. Since this is your code and you added the function, you're probably going to use it as well, so remove the "stock" tag. Only use "stock" in include files where not all functions must be used in the code when included.

"bool" is pretty self-explainatory. If the variable is tagged with "bool", then the return value of the function should also be "bool". Bools can be only true or false.
Got it perfectly. If I use true,false, I should use bool. If not, I should not use any tag as stock
I guess it is not wrong?
__________________
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
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 07-17-2018 , 16:20   Re: Optimize Plugin
Reply With Quote #15

Bool limits the variable to true or false (or 1 and 0). You don't need any tag if you don't need this.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 07-17-2018 , 16:29   Re: Optimize Plugin
Reply With Quote #16

Okay, One question about is_user_alive.

I know is_user_alive checks is_user_connected.
But I don't know something.

Which I should use?

PHP Code:
// I know this
//if(is_user_connected(id) && is_user_alive(id))
if(is_user_alive(id))

//But this?
//Which?
if(!is_user_alive(id) && is_user_connected(id))
if(!
is_user_alive(id)) 
__________________
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-17-2018 at 16:30.
PurposeLessx is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-17-2018 , 17:02   Re: Optimize Plugin
Reply With Quote #17

Quote:
Originally Posted by PurposeLessx View Post
Okay, One question about is_user_alive.

I know is_user_alive checks is_user_connected.
But I don't know something.

Which I should use?

PHP Code:
// I know this
//if(is_user_connected(id) && is_user_alive(id))
if(is_user_alive(id))

//But this?
//Which?
if(!is_user_alive(id) && is_user_connected(id))
if(!
is_user_alive(id)) 
Player can't be alive if he's not connected, so the 2nd one is wrong.
__________________
edon1337 is offline
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 07-17-2018 , 17:31   Re: Optimize Plugin
Reply With Quote #18

So I must check if user connected while checking !is_user_alive
__________________
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
E1_531G
Senior Member
Join Date: Dec 2017
Old 07-17-2018 , 17:33   Re: Optimize Plugin
Reply With Quote #19

if(is_user_alive(id)) - if true, player is connected and alive.
if(is_user_connected(id) && !is_user_alive(id)) - if true, player is connected but not alive.
__________________
My English is A0
E1_531G is offline
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 07-17-2018 , 17:35   Re: Optimize Plugin
Reply With Quote #20

Okay, got it thanks
__________________
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
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 18:36.


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