AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [ZP]Message in chat when user buys an extra item! (https://forums.alliedmods.net/showthread.php?t=187825)

lagger 06-18-2012 13:04

[ZP]Message in chat when user buys an extra item!
 
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.

KillerMasa 06-18-2012 16:46

Re: [ZP]Message in chat when user buys an extra item!
 
Post in zombie plague section?

lagger 06-20-2012 07:11

Re: [ZP]Message in chat when user buys an extra item!
 
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!?



micapat 06-20-2012 07:20

Re: [ZP]Message in chat when user buys an extra item!
 
This stock is worse than all.

get_user_name(player_x) -> get_user_name( player_x, charsmax( player_x ))

<VeCo> 06-20-2012 07:53

Re: [ZP]Message in chat when user buys an extra item!
 
get_user_name( id, player_x, charsmax( player_x ))

lagger 06-21-2012 11:38

Re: [ZP]Message in chat when user buys an extra item!
 
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?

<VeCo> 06-21-2012 11:39

Re: [ZP]Message in chat when user buys an extra item!
 
Test it...

hornet 06-21-2012 11:47

Re: [ZP]Message in chat when user buys an extra item!
 
It will run fine so long as message() is called correctly.

lagger 06-21-2012 13:05

Re: [ZP]Message in chat when user buys an extra item!
 
Everything works,thank you guys very much! :)


All times are GMT -4. The time now is 06:18.

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