Raised This Month: $ Target: $400
 0% 

Print function to chat


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Estland
Member
Join Date: Nov 2012
Old 12-31-2013 , 01:40   Print function to chat
Reply With Quote #1

How to print function to chat with public client_putinserver(id)?
Estland is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-31-2013 , 01:51   Re: Print function to chat
Reply With Quote #2

That question doesn't make sense. You can print to chat with client_print() but if you use it in client_putinserver(), the person that just joined won't be able to see it.

You should explain, in detail, what you are trying to do with your plugin to get better advice.
__________________

Last edited by fysiks; 12-31-2013 at 01:53.
fysiks is offline
Estland
Member
Join Date: Nov 2012
Old 12-31-2013 , 01:56   Re: Print function to chat
Reply With Quote #3

I want to print information about a guy who just joined (if he/she has flags I'm searching).
Estland is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-31-2013 , 02:56   Re: Print function to chat
Reply With Quote #4

Flags are not given until after client_authorized() is executed. So, to guarantee that flags have been given where needed, you need to use that forward. Then, you need to do a delay with set_task() if you want that person to have a chance to see it.
__________________
fysiks is offline
Estland
Member
Join Date: Nov 2012
Old 12-31-2013 , 04:49   Re: Print function to chat
Reply With Quote #5

So something like that?

Code:
public client_putinserver(id)
{
    set_task(2.0, "Function")
}

public Function(id)
{   
    if(is_user_connected(id)) {
        new Name[33]
        get_user_name(id,Name,32);
       
        if(get_user_flags(id) & ADMIN_LEVEL_E) {
            ColorChat(0, NORMAL, "Master^4 %s^1 joined the server!", Name);
            return PLUGIN_HANDLED;
        }
Estland is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 12-31-2013 , 07:13   Re: Print function to chat
Reply With Quote #6

authorized can be called after putinserver, so use that function like fysiks said.

Or combine them. Use a variable to enable the message when authorized was called and when the putinserver is called, show the message. If they are out of sync you can create a task on putinserver to repeat until authorized has cleared.

Something like:
Code:
new is_authorized[33]; public client_authorized(id) {     is_authorized[id] = true; } public client_disconnect(id) {     is_authorized[id] = false; } public client_putinserver(id) {     set_task(2.0, "Function") } public Function(id) {     if(is_authorized[id] & is_user_connected(id)) {         new Name[33]         get_user_name(id,Name,32);                 if(get_user_flags(id) & ADMIN_LEVEL_E)             ColorChat(0, NORMAL, "Master^4 %s^1 joined the server!", Name);     }     else         set_task(1.0, "Function") }
__________________

Last edited by Black Rose; 12-31-2013 at 08:34.
Black Rose is offline
Estland
Member
Join Date: Nov 2012
Old 12-31-2013 , 08:04   Re: Print function to chat
Reply With Quote #7

Function should return a value. Still gives me that error.
Estland is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 12-31-2013 , 08:34   Re: Print function to chat
Reply With Quote #8

Quote:
Originally Posted by Estland View Post
Function should return a value. Still gives me that error.
Sorry, fixed.
__________________
Black Rose is offline
Estland
Member
Join Date: Nov 2012
Old 01-01-2014 , 12:29   Re: Print function to chat
Reply With Quote #9

Hmm, still isn't working. No errors, though.

Code:
public client_authorized(id)
{
    is_authorized[id] = true;
}

public client_disconnect(id)
{
    is_authorized[id] = false;
}

public client_putinserver(id)
{
    set_task(2.0, "Tervitus")
}

public Tervitus(id)
{
    if(is_authorized[id] & is_user_connected(id)) {
        new Name[33]
        get_user_name(id,Name,32);
        
        if(get_user_flags(id) & OMANIK) {
            ColorChat(0, NORMAL, "Omanik^4 %s^1 liitus serveriga!", Name);
            return PLUGIN_HANDLED;
        }
        if(get_user_flags(id) & KORRAHOIDJA) {
            ColorChat(0, NORMAL, "Korrahoidja^4 %s^1 liitus serveriga!", Name);
            return PLUGIN_HANDLED;
        }
        if(get_user_flags(id) & IMM_ACCESS) {
            ColorChat(0, NORMAL, "Immunity Admin^4 %s^1 liitus serveriga!", Name);
            return PLUGIN_HANDLED;
        }
        if(get_user_flags(id) & ADMIN_ACCESS) {
            ColorChat(0, NORMAL, "Admin^4 %s^1 liitus serveriga!", Name);
            return PLUGIN_HANDLED;
        }
        if(get_user_flags(id) & VIP_ACCESS) {
            ColorChat(0, NORMAL, "VIP^4 %s^1 liitus serveriga!", Name);
            return PLUGIN_HANDLED;
    }
        else
        set_task(1.0, "Tervitus")
    }
I've got things like ADMIN_ACCESS defined. new is_authorized[33]; is added, too.
Estland is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-01-2014 , 16:40   Re: Print function to chat
Reply With Quote #10

This is all pointless, just put the code in client_authorized(). It will do exactly the same thing.
__________________
fysiks is offline
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 10:04.


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