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=125916)

eNz0 05-03-2010 14:14

Client_print
 
hi, every time i use:

PHP Code:

client_print(idprint_chat"....."

It writes a LOOOT of messages in cs (non stop). What am i doing wrong?

How should it look like:

PHP Code:

public client_PostThinkid )
{
    if(....[
id] == 1)
    {    
    
client_print(idprint_chat"....")    
    }
    return 
PLUGIN_HANDLED



tuty 05-03-2010 14:26

Re: Client_print
 
post/pre think is called hundred times per second/minute.. so bad way to print.

Sylwester 05-03-2010 14:27

Re: Client_print
 
Quote:

Originally Posted by Jelle (Post 1169329)
Just a guess, but try to remove the return.

That's a wrong guess...
PostThink is called many times every seconds, so it's obvious that it will write a lot of messages.

How many times and when do you want to write your message?

eNz0 05-03-2010 14:39

Re: Client_print
 
Now i see why it writes a LooT of messages, how can i change this commands:
Server assigns player class (i think i should change PreThink too):

PHP Code:

public fw_Player_PreThinkid 
{
    if(
is_user_connectedid ) && is_user_aliveid ) && ( get_user_teamid ) == ))
    {
    
g_Player_Class[id] = 1
    
}
    
    return 
PLUGIN_CONTINUE


When class is assigned it writes message:
PHP Code:

{
    if(
g_Player_Class[id] == 1)
    {    
    
client_print(idprint_chat"[AMXX] Your class is:...")    
    }
    return 
PLUGIN_HANDLED


And i have one other question: How can server assign player class randomly when he connects? (g_Player_Class[id] = 1 / 2 / 3 /4 /5)

grimvh2 05-03-2010 14:48

Re: Client_print
 
PHP Code:

g_Player_class[id] = random_num(1,5


eNz0 05-03-2010 14:50

Re: Client_print
 
Thanks :)
Any ideas of changing PreThink?

tuty 05-03-2010 14:54

Re: Client_print
 
on player spawn?

RegisterHam( Ham_Spawn, "player", "bacon_SandwichSpawned", 1 );

?

eNz0 05-03-2010 15:02

Re: Client_print
 
Thanks, fixed. And sorry if i looked stupid, i am new in scripting :)

FlyingHorse 05-05-2010 07:23

Re: Client_print
 
it would look much cooler something like this.
Code:

{
    if(
g_Player_Class[id] == 1)
    {   
   
ColorChat(id, RED, "[AMXX]^x04 Your class is:...")   
    }
    return
PLUGIN_HANDLED
}     



drekes 05-05-2010 07:34

Re: Client_print
 
Quote:

Originally Posted by FlyingHorse (Post 1171231)
it would look much cooler something like this.
Code:

{
    if(
g_Player_Class[id] == 1)
    {   
   
ColorChat(id, RED, "[AMXX]^x04 Your class is:...")   
    }
    return
PLUGIN_HANDLED
}     



That is your opinion, also colorchat limits the plugin to cs only, maybe he is planning to use it in another mod, or several mods.


All times are GMT -4. The time now is 03:37.

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