AlliedModders

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

Mr.Noobie 08-12-2009 03:38

client print.
 
Does anyone know why this won't work ?

PHP Code:

#define TIME_DELAY2 1.0
 
client_print0print_chat":W"TIME_DELAY2 

Does anyone know how to show the hudmessage first before the command "Server is restarting in 15 second."

PHP Code:

server_cmd"sv_restartround 15" )
 
set_hudmessage200200200, -1.00.2926.012.00.10.2, -)
show_hudmessage0"::: WHAHAHAAH:::" 


Exolent[jNr] 08-12-2009 03:46

Re: client print.
 
When the cvar sv_restartround changes, the message doesn't display instantly.
It has about a 1.0 delay before the message appears.

Mr.Noobie 08-12-2009 04:31

Re: client print.
 
Quote:

Originally Posted by Exolent[jNr] (Post 897128)
When the cvar sv_restartround changes, the message doesn't display instantly.
It has about a 1.0 delay before the message appears.

yeah but my hudmessage appear like half then it being overwrite with the command "Server is restarting in 15 second."

So how to i make the hudmessage appear first after that few second then the server restartround command. ?

Mr.Noobie 08-14-2009 06:29

Re: client print.
 
why does this don't work ?

PHP Code:

#define TIME_DELAY2 1.0
 
client_print0print_chat":W"TIME_DELAY2 


Bad_Bud 08-14-2009 08:40

Re: client print.
 
You're trying to delay the message?

You'd have to make a set_task that calls your print.

PHP Code:

set_task(TIME_DELAY2,"ResetMessage")

ResetMessage()
{
          
client_print(0,print_chat,":W")


This will display ":W" to everyone after TIME_DELAY2 seconds have passed.

Mr.Noobie 08-14-2009 09:22

Re: client print.
 
Quote:

Originally Posted by Bad_Bud (Post 899530)
You're trying to delay the message?

You'd have to make a set_task that calls your print.

PHP Code:

set_task(TIME_DELAY2,"ResetMessage")

ResetMessage()
{
          
client_print(0,print_chat,":W")


This will display ":W" to everyone after TIME_DELAY2 seconds have passed.

Thanks for answer.

But i need to do this for a lot of times. So is there anymore easy to do this ?.

PHP Code:

 client_print0print_chat":W"TIME_DELAY2 )
        
client_print0print_chat"::A"TIME_DELAY3 )
        
client_print0print_chat":::R"TIME_DELAY4 )
        
client_print0print_chat"::::M"TIME_DELAY5 )
        
client_print0print_chat":::::U"TIME_DELAY6 )
        
client_print0print_chat"::::::P"TIME_DELAY7 )
        
client_print0print_chat":::::::R"TIME_DELAY8 )
        
client_print0print_chat"::::::::O"TIME_DELAY9 )
        
client_print0print_chat":::::::::U"TIME_DELAY10 )
        
client_print0print_chat"::::::::::N"TIME_DELAY11 )
        
client_print0print_chat":::::::::::D"TIME_DELAY12 )
        
client_print0print_chat"::::::::::N"TIME_DELAY13 )
        
client_print0print_chat":::::::::U"TIME_DELAY14 )
        
client_print0print_chat"::::::::O"TIME_DELAY15 )
        
client_print0print_chat":::::::R"TIME_DELAY16 )
        
client_print0print_chat"::::::P"TIME_DELAY17 )
        
client_print0print_chat":::::U"TIME_DELAY18 )
        
client_print0print_chat"::::M"TIME_DELAY19 )
        
client_print0print_chat":::R"TIME_DELAY20 )
        
client_print0print_chat"::A"TIME_DELAY21 )
        
client_print0print_chat":W"TIME_DELAY22 )
        
client_print0print_chat"::: WARMING ROUND :::"TIME_DELAY23 


Bad_Bud 08-14-2009 12:58

Re: client print.
 
This will make it scroll through your messages every 0.25 seconds (or whatever you set TIME_DELAY to) until it reaches the end. Type "test" into the console to make it start. I hope you can pull the basic concept out of it.

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <engine>

#define TIME_DELAY 0.25

new Task
new Count

public plugin_init()
{
    
register_plugin("How","are","you?")
    
    
register_clcmd("test","test")
    
    
Task=create_entity("info_target")
    
    
register_think("info_target","TextDisplayer")
}

public 
test(id)
{
    
Count=0
    
    entity_set_float
(Task,EV_FL_nextthink,1.0)
    
    return 
PLUGIN_HANDLED
}

public 
TextDisplayer(entity)
{    
    if(
Task==entity)
    {
        if(
Count<22)
        {
            switch(
Count)
            {
                case 
0client_print(0,print_chat,":W");
                case 
1client_print(0,print_chat,"::A");
                case 
2client_print(0,print_chat,":::R");
                case 
3client_print(0,print_chat,"::::M");
                case 
4client_print(0,print_chat,":::::U");
                case 
5client_print(0,print_chat,"::::::P");
                case 
6client_print(0,print_chat,":::::::R");
                case 
7client_print(0,print_chat,"::::::::O");
                case 
8client_print(0,print_chat,":::::::::U");
                case 
9client_print(0,print_chat,"::::::::::N");
                case 
10client_print(0,print_chat,":::::::::::D");
                case 
11client_print(0,print_chat,"::::::::::N");
                case 
12client_print(0,print_chat,":::::::::U");
                case 
13client_print(0,print_chat,"::::::::O");
                case 
14client_print(0,print_chat,":::::::R");
                case 
15client_print(0,print_chat,"::::::P");
                case 
16client_print(0,print_chat,":::::U");
                case 
17client_print(0,print_chat,"::::M");
                case 
18client_print(0,print_chat,":::R");
                case 
19client_print(0,print_chat,"::A");
                case 
20client_print(0,print_chat,":W");
                case 
21client_print(0,print_chat,"::: WARMING ROUND :::");
            }
            
            
Count++
            
entity_set_float(Task,EV_FL_nextthink,get_gametime()+TIME_DELAY)
        }
    }


Here's an easier and probably better way.
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <engine>

#define TIME_DELAY 0.25

public plugin_init()
{
    
register_plugin("How","are","you?")
    
    
register_clcmd("test","test")
}

public 
test(id)
{    
    
set_task(0.0,"TextDisplayer",0)
    
    return 
PLUGIN_HANDLED
}

public 
TextDisplayer(Count)
{        
    if(
Count<22)
    {
        switch(
Count)
        {
            case 
0client_print(0,print_chat,":W");
            case 
1client_print(0,print_chat,"::A");
            case 
2client_print(0,print_chat,":::R");
            case 
3client_print(0,print_chat,"::::M");
            case 
4client_print(0,print_chat,":::::U");
            case 
5client_print(0,print_chat,"::::::P");
            case 
6client_print(0,print_chat,":::::::R");
            case 
7client_print(0,print_chat,"::::::::O");
            case 
8client_print(0,print_chat,":::::::::U");
            case 
9client_print(0,print_chat,"::::::::::N");
            case 
10client_print(0,print_chat,":::::::::::D");
            case 
11client_print(0,print_chat,"::::::::::N");
            case 
12client_print(0,print_chat,":::::::::U");
            case 
13client_print(0,print_chat,"::::::::O");
            case 
14client_print(0,print_chat,":::::::R");
            case 
15client_print(0,print_chat,"::::::P");
            case 
16client_print(0,print_chat,":::::U");
            case 
17client_print(0,print_chat,"::::M");
            case 
18client_print(0,print_chat,":::R");
            case 
19client_print(0,print_chat,"::A");
            case 
20client_print(0,print_chat,":W");
            case 
21client_print(0,print_chat,"::: WARMING ROUND :::");
        }
        
        
Count++
        
set_task(TIME_DELAY,"TextDisplayer",Count)
    }


Either one will get the job done for you if you call them from the correct place in your plugin instead of the "test" command that I made just for example.

You should probably also read about format and using the format parameters in client_print.


All times are GMT -4. The time now is 18:28.

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