Raised This Month: $32 Target: $400
 8% 

Different message at the same time


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 07-21-2008 , 11:21   Different message at the same time
Reply With Quote #1

Hello. I need to print a message to one person and to everyone else except that one person at the same time.

Example (A - 1 person, B - everyone else):
As being A you see: You are cool!
As being B you see: A is cool!

So:
PHP Code:
id A
// All players except A are B
something B
 
if (Ashow_hudmessage(A"You are cool")
else if (!
A/* or if (B)*/ show_hudmessage(B"A is cool!"
How can I do this?
__________________

Last edited by hleV; 07-21-2008 at 11:24.
hleV is offline
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 07-21-2008 , 11:31   Re: Different message at the same time
Reply With Quote #2

You need to loop through all the players and check if the user is A, if not just change the message.

eg.
PHP Code:
 for(new id 1id <= get_maxplayers(); id++)
  
show_hudmessage(id"%s cool!"id == "You are" "A is"
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.

Last edited by Cheap_Suit; 07-21-2008 at 13:01.
Cheap_Suit is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 07-21-2008 , 15:18   Re: Different message at the same time
Reply With Quote #3

Thanks. Actually I was trying what you said but it wasn't like the code you gave me. Thanks again.

Edit: When I add "KillerName" after the function it still shows "%s" instead of name when the id is not A.
PHP Code:
show_hudmessage(id"%s"id == KillerID "You are cool!" "%s is cool!"KillerName
__________________

Last edited by hleV; 07-21-2008 at 16:02.
hleV is offline
Cheap_Suit
Veteran Member
Join Date: May 2004
Old 07-21-2008 , 16:33   Re: Different message at the same time
Reply With Quote #4

PHP Code:
show_hudmessage(id"%s %s cool!"id == KillerID "You" KillerNameid == KillerID "are" "is"
or

PHP Code:
format(KillerNamecharsmax(KillerName), "%s is"KillerName)
show_hudmessage(id"%s cool!"id == KillerID "You are" KillerName
__________________
HDD fried, failed to backup files. Sorry folks, just don't have free time anymore. This is goodbye.
Cheap_Suit is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 07-21-2008 , 19:26   Re: Different message at the same time
Reply With Quote #5

Thanks again. Method 2 works fine.
But I'm interested in method 1. Can I make so A would see "You are cool!" and B would see "%s is awesome!"? I mean 2 totally different texts with the name included into the second one?

BTW I'm using something similar to this (except the print method):
PHP Code:
new g_Text1[] = "You are cool!"
new g_Text2[] = "%s is awesome!"
 
// So I want to use this:
public SomeFuction(KillerID)
        for (new 
id 1id <= get_maxplayers(); id++)
                
show_hudmessage(id"%s"id == KillerID g_Text1 g_Text2/*But need to include KillerName*/
__________________

Last edited by hleV; 07-21-2008 at 19:33.
hleV is offline
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 07-21-2008 , 20:11   Re: Different message at the same time
Reply With Quote #6

Quote:
Originally Posted by hleV View Post
Thanks again. Method 2 works fine.
But I'm interested in method 1. Can I make so A would see "You are cool!" and B would see "%s is awesome!"? I mean 2 totally different texts with the name included into the second one?

BTW I'm using something similar to this (except the print method):
PHP Code:
new g_Text1[] = "You are cool!"
new g_Text2[] = "%s is awesome!"
 
// So I want to use this:
public SomeFuction(KillerID)
        for (new 
id 1id <= get_maxplayers(); id++)
                
show_hudmessage(id"%s"id == KillerID g_Text1 g_Text2/*But need to include KillerName*/
Code:
public SomeFuction(KillerID)
{
    new name[32]

    for (new id = 1; id <= get_maxplayers(); id++)
    {
        if(!is_user_connected(id))
            continue

        if(id == KillerID)
            show_hudmessage(id, "You are cool")
        else
        {
            get_user_name(id,name,31)
            show_hudmessage(id, "%s is awesome!",name)
        }
    }
}
danielkza 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 19:22.


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