Raised This Month: $ Target: $400
 0% 

About an error : "Plugin called message_begin with an invalid message id (0)".


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
epic .
Senior Member
Join Date: Oct 2009
Location: China
Old 05-06-2010 , 01:11   Re: Plugin called message_begin with an invalid message id (0).
Reply With Quote #3

Quote:
Originally Posted by Leon M. View Post
Hi, that means you must specify the client who get this messages. (Allowed Numbers 1 - 32)

You could add check is_user_connected(id). If you want to send a message to all clients use message_begin(MSG_BROADCAST, msgid).

Greetz
Leon
Thanks for you quick reply
I have specifed the client who get this messages.
For example:
Code:
new g_msgScreenFade
 
public plugin_init()
{
    register_logevent("RoundStart", 2, "1=Round_Start")
    g_msgScreenFade = get_user_msgid("ScreenFade")
}
public RoundStart()
{
    new iPlayers[32], iNum, id, iRandom[32], iRandomNum;
    new origin[3], srco[3];
    new playername[32];
 
    get_players(iPlayers, iNum);
    for ( new i = 0 ; i < iNum ; i++ )
    {
        id = iPlayers[i];
        if ( cs_get_user_team(id) == CS_TEAM_CT )
        {
            iRandom[ iRandomNum++ ] = id;
            g_mark = iRandom[ random( iRandomNum ) ];
        }
    }
    if( !is_user_connected(g_mark) )    
    {
        g_mark = 0
        return
    }
    get_user_origin(g_mark , origin) //the plugin know who is the g_mark here, it can get the origin of the g_mark
    origin[2] -= 26
    srco[0] = origin[0] + 150
    srco[1] = origin[1] + 150
    srco[2] = origin[2] + 800
    lightning_appear(srco, origin)//the plugin know who is the g_mark here, it can run the function of "lightning_appear" to the g_mark
 
    cs_set_user_model(g_mark, "vip"))//the plugin also know who is the g_mark here, it can change the model of the g_mark to "vip"
 
    flash_screen(g_mark) // But, when run the flash_screen which start with "message_begin", the plugin seems like lost the g_mark, it doesn`t run flash_screen to g_mark
    get_user_name(g_mark, playername, 31)
    client_print(0, print_chat, "some word"); //the code under the function "flash_screen", also doesn`t run ,it seem like, the code here still lost the g_mark
    client_print(0, print_chat, "some word", playername);
}
stock flash_screen(id)
{
    if( !is_user_connected(id) ) return
    message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, id)
    write_short(3000)                           // duration
    write_short(1000)                           // hold time
    write_short(0)                              // flags
    write_byte(0)                               // red
    write_byte(255)                             // green
    write_byte(0)                               // blue
    write_byte(100)                             // alpha
    message_end();
}
why ?
__________________
Quote:
Destinies in my AWP sight are all alike;
Destinies out of my AWP sight in its own way.
epic . is offline
Send a message via ICQ to epic .
 



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:53.


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