AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   console_print (https://forums.alliedmods.net/showthread.php?t=168104)

reinert 09-24-2011 07:24

console_print
 
Why does it works sometimes and sometimes it does not ?

It works when I'm baning player. in Say hook. But it doesn't work when client connects, then I get all info from SQL and set task with 2 seconds, nothing happens, the code in both situation are exactly same.

jim_yang 09-24-2011 07:29

Re: console_print
 
in client connect, you should use
client_cmd(id, "echo ^"somthing^"")

reinert 09-24-2011 07:34

Re: console_print
 
Well it doesn't work either.
>>PART OF CODE
PHP Code:

    if(equali(szCmd"!ban"))
    {
        
strbreak(szArgszTargetcharsmax(szTarget), szArgcharsmax(szArg))
        
strbreak(szArgszTimecharsmax(szTime), szReasoncharsmax(szReason))
        
        if(!
szTarget[0] || !szTime[0] || !szReason[0])
        {
            return 
PLUGIN_HANDLED_MAIN;
        }
        
        new 
szAdminName[33];
        
get_user_name(idszAdminName32)
        
        new 
player cmd_target(idszTargetCMDTARGET_OBEY_IMMUNITY);
        
        if(!
player)
            return 
PLUGIN_HANDLED;
            
        new 
bantime;
                
        if(
bantime 604800)
        {
            return 
PLUGIN_HANDLED_MAIN;
        }
        
        new 
szTargetName[33];
        
get_user_name(playerszTargetName32)
        
        new 
szTargetIp[33];
        
get_user_ip(playerszTargetIp321)
        
        
console_print(player"****B*A*N*N*E*D****"// This does work
        
server_cmd("kick #%d ^"You are bannedcheck your console^""get_user_userid(player) )
        
        new 
szTemp[512]
        
format(szTemp,charsmax(szTemp),"UPDATE `players`\
        SET `ban_time` = '%d',\
        `ban_reason` = '%s',\
        `ban_admin` = '%s'\
        WHERE `players`.`player_ip` = '%s';"
GetCurrentTime() + bantimeszReasonszAdminNameszTargetIp)
        
SQL_ThreadQuery(g_SqlTuple,"IgnoreHandle",szTemp)
        
        return 
PLUGIN_HANDLED_MAIN;
    }
    
    public 
client_putinserver(id)
    {
        
Load_MySql(id);
        
set_task(5.0"CheckBan"id)
    }
    
    public 
CheckBan(id)
    {
        if(
ban_time[id] > GetCurrentTime())
        {
            
console_print(player"****B*A*N*N*E*D****"// And only this does not work.
            
server_cmd("kick #%d ^"You are bannedcheck your console^""get_user_userid(player) )
        }
    } 

Everything works perfect except console printing.

jim_yang 09-24-2011 07:40

Re: console_print
 
or, try this
public client_connect(id)
{
engfunc(EngFunc_ClientPrintf, id, 0, "bla#############")
}

reinert 09-24-2011 07:41

Re: console_print
 
This should print message to console or chat ?

fysiks 09-24-2011 16:01

Re: console_print
 
Client is not in the server to receive commands on client_connect(). This is the way that I understand it. Try client_putinserver().

reinert 09-24-2011 17:38

Re: console_print
 
I used this:
PHP Code:

public client_putinserver(id)
    {
        
Load_MySql(id);
        
set_task(5.0"CheckBan"id)
    } 

...
Does not work.


All times are GMT -4. The time now is 19:38.

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