Raised This Month: $ Target: $400
 0% 

client_cmd vs console_cmd


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
vamppa
Senior Member
Join Date: Apr 2010
Location: The Netherlands
Old 05-26-2014 , 07:40   client_cmd vs console_cmd
Reply With Quote #1

When the situation fits to use console_cmd am I right in saying it is a little more efficient to use apposed to client_cmd?

PHP Code:
static cell AMX_NATIVE_CALL console_cmd(AMX *amxcell *params/* 2 param */
{
    
int index params[1];
    
g_langMngr.SetDefLang(index);
    
int len;
    
charcmd format_amxstring(amxparams2len);
    
    
cmd[len++] = '\n';
    
cmd[len] = 0;

    if (
index || index gpGlobals->maxClients)
    {
        
SERVER_COMMAND(cmd);
    } else {
        
CPlayerpPlayer GET_PLAYER_POINTER_I(index);
        
        if (!
pPlayer->bot && pPlayer->initialized)
            
CLIENT_COMMAND(pPlayer->pEdict"%s"cmd);
    }

    return 
len;

PHP Code:
static cell AMX_NATIVE_CALL client_cmd(AMX *amxcell *params/* 2 param */
{
    
int len;
    
charcmd format_amxstring(amxparams2len);
    
cmd[len++] = '\n';
    
cmd[len] = 0;

    if (
params[1] == 0)
    {
        for (
int i 1<= gpGlobals->maxClients; ++i)
        {
            
CPlayerpPlayer GET_PLAYER_POINTER_I(i);
            if (!
pPlayer->bot && pPlayer->initialized /*&& pPlayer->ingame*/)
                
CLIENT_COMMAND(pPlayer->pEdict"%s"cmd);
        }
    } else {
        
int index params[1];
        
        if (
index || index gpGlobals->maxClients)
        {
            
LogError(amxAMX_ERR_NATIVE"Invalid player id %d"index);
            return 
0;
        }
        
        
CPlayerpPlayer GET_PLAYER_POINTER_I(index);
        
        if (!
pPlayer->bot && pPlayer->initialized /*&& pPlayer->ingame*/)
            
CLIENT_COMMAND(pPlayer->pEdict"%s"cmd);
    }
    
    return 
len;

vamppa is offline
 



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:40.


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