Raised This Month: $ Target: $400
 0% 

[ZP]Message in chat when user buys an extra item!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lagger
Member
Join Date: Feb 2011
Location: Latvia
Old 06-18-2012 , 13:04   [ZP]Message in chat when user buys an extra item!
Reply With Quote #1

Hello so i wanted,that when user buys an item in chat shows message,that he bought it.(colored)
So here is code i figured out,i think something is wrong.
P.S i will add this code to plugin,im not making a new plugin!

PHP Code:
public message(id)
{
    new 
player_x[32]
    
get_user_name(player_x)

    
chat_color(0,"!g[ZP] %s !yjust bought !gITEM!y!",player_x)
}

/* and end of the plugin is this */

stock chat_color(const id, const input[], any:...)
{
    new 
count 1players[32]

    static 
msg[191]

    
vformat(msg190input3)

    
replace_all(msg190"!g""^4")
    
replace_all(msg190"!y""^1")
    
replace_all(msg190"!t""^3")
    
replace_all(msg190"!t2""^0")

    if (
idplayers[0] = id; else get_players(playerscount"ch")
    {
        for (new 
0counti++)
        {
            if (
is_user_connected(players[i]))
            {
                
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i])
                
write_byte(players[i])
                
write_string(msg)
                
message_end()
            }
        }
    }

Please help me to make this code correct,thanks.

Last edited by lagger; 06-18-2012 at 13:08.
lagger is offline
Send a message via Skype™ to lagger
KillerMasa
Senior Member
Join Date: May 2012
Old 06-18-2012 , 16:46   Re: [ZP]Message in chat when user buys an extra item!
Reply With Quote #2

Post in zombie plague section?
KillerMasa is offline
lagger
Member
Join Date: Feb 2011
Location: Latvia
Old 06-20-2012 , 07:11   Re: [ZP]Message in chat when user buys an extra item!
Reply With Quote #3

The code is nothing from ZP!
I just use it on ZP server,omg
Seriously no one can check the code,if it is correct?
If it isn't just,correct it,please!?


lagger is offline
Send a message via Skype™ to lagger
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 06-20-2012 , 07:20   Re: [ZP]Message in chat when user buys an extra item!
Reply With Quote #4

This stock is worse than all.

get_user_name(player_x) -> get_user_name( player_x, charsmax( player_x ))
__________________
micapat is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 06-20-2012 , 07:53   Re: [ZP]Message in chat when user buys an extra item!
Reply With Quote #5

get_user_name( id, player_x, charsmax( player_x ))
__________________
<VeCo> is offline
lagger
Member
Join Date: Feb 2011
Location: Latvia
Old 06-21-2012 , 11:38   Re: [ZP]Message in chat when user buys an extra item!
Reply With Quote #6

PHP Code:
public message(id)
{
    new 
player_x[32]
    
get_user_nameidplayer_xcharsmaxplayer_x ))

    
chat_color(0,"!g[ZP] %s !yjust bought !gITEM!y!",player_x)
}

/* and end of the plugin is this */

stock chat_color(const id, const input[], any:...)
{
    new 
count 1players[32]

    static 
msg[191]

    
vformat(msg190input3)

    
replace_all(msg190"!g""^4")
    
replace_all(msg190"!y""^1")
    
replace_all(msg190"!t""^3")
    
replace_all(msg190"!t2""^0")

    if (
idplayers[0] = id; else get_players(playerscount"ch")
    {
        for (new 
0counti++)
        {
            if (
is_user_connected(players[i]))
            {
                
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i])
                
write_byte(players[i])
                
write_string(msg)
                
message_end()
            }
        }
    }

This is correct?
Now should code work right?
lagger is offline
Send a message via Skype™ to lagger
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 06-21-2012 , 11:39   Re: [ZP]Message in chat when user buys an extra item!
Reply With Quote #7

Test it...
__________________
<VeCo> is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 06-21-2012 , 11:47   Re: [ZP]Message in chat when user buys an extra item!
Reply With Quote #8

It will run fine so long as message() is called correctly.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
lagger
Member
Join Date: Feb 2011
Location: Latvia
Old 06-21-2012 , 13:05   Re: [ZP]Message in chat when user buys an extra item!
Reply With Quote #9

Everything works,thank you guys very much!
lagger is offline
Send a message via Skype™ to lagger
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 06:18.


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