Raised This Month: $51 Target: $400
 12% 

Plugin Commands


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 08-08-2017 , 18:05   Plugin Commands
Reply With Quote #1

Hello guys,
I am curious to know something about. I use too many plugins on my server.
And the users are constantly lagging. I'd like to know that what is the best commands to use in the server. I mean, I'd like you to tell me which one of the codes I say, coercion the server more.
Thanks for helping.

Which one is the best to use?

1)
PHP Code:
stock client_printc(const id, const input[], any:...)
{
    static 
msg[191], players[32], inum;
    
vformat(msgcharsmax(msg), input3)

    
replace_all(msgcharsmax(msg), "!n""^x01")
    
replace_all(msgcharsmax(msg), "!g""^x04")
    
replace_all(msgcharsmax(msg), "!t""^x03")

    if(
idplayers[0] = id,inum=1; else get_players(playersinum"ch"); {
        for(new 
i=0i<inumi++)
        {
            if(
is_user_connected(players[i]))
            {
                
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i])
                
write_byte(players[i])
                
write_string(msg)
                
message_end()
            }
        }
    }

or
PHP Code:
stock client_printc(id, const msg[], any:...)
{
    static 
buffer[512], msg_SayText 0
    
    
if(!msg_SayText)
        
msg_SayText get_user_msgid("SayText")
    
    
vformat(buffercharsmax(buffer), msg3)
    
    
message_begin(MSG_ONE_UNRELIABLEmsg_SayText_id)
    
write_byte(id)
    
write_string(buffer)
    
message_end()

----------------------------------------------
PHP Code:
static players[32], inum
get_players
(playersinum"ae""TERRORIST"
or
PHP Code:
static players[32], inum
get_players
(playersinum"aeh""TERRORIST"
------------------------------------------------
PHP Code:
set_pev(idpev_health100.0)
//or
set_entvar(idvar_health100.0//reapi 
or
PHP Code:
set_user_health(id100

And I'd like to know other something about too.
Who's different about reapi or other modules?
If I use reapi, the server lags will decrease?
Really I need you help me.
Thanks for helping
PurposeLessx is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-09-2017 , 05:58   Re: Plugin Commands
Reply With Quote #2

Nothing that you listed here has an impact on anything.
__________________
HamletEagle is offline
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 08-10-2017 , 14:46   Re: Plugin Commands
Reply With Quote #3

@HamletEagle

Thanks but I don't understand something.
What is different about using reapi or fun & fakemeta etc.
So I mean,
What is different?

set_user_health(id, 1.0)
set_pev(id, pev_health, 1.0)
-
set_entvar(id, var_health, 1.0)
PurposeLessx is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-10-2017 , 17:03   Re: Plugin Commands
Reply With Quote #4

No difference. They all set the same entvars in game.
__________________

Last edited by HamletEagle; 08-10-2017 at 17:03.
HamletEagle is offline
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 08-11-2017 , 03:16   Re: Plugin Commands
Reply With Quote #5

Okay. I got it.
So which code I should use?

PHP Code:
new name[32]
static 
name[32]

get_user_name(idname31)
get_user_name(idnamecharsmax(name))
get_user_name(idnamesizeof(name) - 1
When I should use "new"? When I should use "static"
Thanks for helping
PurposeLessx is offline
Ayman Khaled
Senior Member
Join Date: Mar 2017
Location: Palestine
Old 08-11-2017 , 07:21   Re: Plugin Commands
Reply With Quote #6

Quote:
When I should use "new"? When I should use "static"
Thanks for helping
static is useful and faster than new
https://forums.alliedmods.net/showthread.php?t=40340
__________________

Last edited by Ayman Khaled; 09-29-2017 at 04:17.
Ayman Khaled is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-11-2017 , 08:02   Re: Plugin Commands
Reply With Quote #7

2nd one.
__________________
HamletEagle is offline
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 08-11-2017 , 09:58   Re: Plugin Commands
Reply With Quote #8

Can I use static for everything?
For example;

PHP Code:
static players[32], inum
static Uidi
get_players
(playersinum"ae""TERRORIST")
for(
i=0i<inumi++)
{
    
Uid players[i]
    static 
Float:userhealth
    get_entvar
(idvar_healthuserhealth)
    
set_entvar(idvar_healthuserhealth 10.0)

PurposeLessx is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-11-2017 , 11:55   Re: Plugin Commands
Reply With Quote #9

No, don't do that. Use static in forwards called each frame or for big arrays. Or when you really want that variable to keep it's value.
__________________
HamletEagle is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 08-11-2017 , 12:05   Re: Plugin Commands
Reply With Quote #10

Why you need to use static vars for everething?
__________________









Last edited by CrazY.; 08-11-2017 at 12:06.
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 23:32.


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