Raised This Month: $ Target: $400
 0% 

Client_print


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eNz0
Member
Join Date: Feb 2010
Location: Lithuania
Old 05-03-2010 , 14:14   Client_print
Reply With Quote #1

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

eNz0 is offline
Old 05-03-2010, 14:17
Jelle
This message has been deleted by Jelle. Reason: fail
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 05-03-2010 , 14:26   Re: Client_print
Reply With Quote #3

post/pre think is called hundred times per second/minute.. so bad way to print.
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 05-03-2010 , 14:27   Re: Client_print
Reply With Quote #4

Quote:
Originally Posted by Jelle View Post
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?
__________________
Impossible is Nothing
Sylwester is offline
eNz0
Member
Join Date: Feb 2010
Location: Lithuania
Old 05-03-2010 , 14:39   Re: Client_print
Reply With Quote #5

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)

Last edited by eNz0; 05-03-2010 at 14:47.
eNz0 is offline
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 05-03-2010 , 14:48   Re: Client_print
Reply With Quote #6

PHP Code:
g_Player_class[id] = random_num(1,5
__________________
I am out of order!
grimvh2 is offline
eNz0
Member
Join Date: Feb 2010
Location: Lithuania
Old 05-03-2010 , 14:50   Re: Client_print
Reply With Quote #7

Thanks
Any ideas of changing PreThink?
eNz0 is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 05-03-2010 , 14:54   Re: Client_print
Reply With Quote #8

on player spawn?

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

?
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
eNz0
Member
Join Date: Feb 2010
Location: Lithuania
Old 05-03-2010 , 15:02   Re: Client_print
Reply With Quote #9

Thanks, fixed. And sorry if i looked stupid, i am new in scripting

Last edited by eNz0; 05-03-2010 at 15:07.
eNz0 is offline
FlyingHorse
Senior Member
Join Date: Apr 2010
Location: Under your bed.
Old 05-05-2010 , 07:23   Re: Client_print
Reply With Quote #10

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
}       

FlyingHorse is offline
Send a message via Skype™ to FlyingHorse
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 03:38.


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