AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   message_begin with an invalid message id (https://forums.alliedmods.net/showthread.php?t=154463)

makiza 04-08-2011 22:53

message_begin with an invalid message id
 
hello there.

When i did this:
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>


#define PLUGIN "Lame Napalm"
#define VERSION "1.0"
#define AUTHOR "makiza"

new g_burning[33], g_damageg_fire

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("Damage""event_damage""be""2!0""3=0")
}

public 
event_damage(id)
{
    new 
bodypartweapon
    
new enemy get_user_attacker(idweaponbodypart)
    if(
weapon == CSW_HEGRENADE && cs_get_user_team(id) == CS_TEAM_T && is_user_alive(id)) 
    {
        new 
Name[33]
        
get_user_name(id,Name,32)
        
g_burning[id] = 1
        ignite_player
(id)
        
ignite_effects(id)
        
client_print(idprint_chat"You are burning, lol!")
        
client_print(enemyprint_chat"You caught %s on fire!"Name)
        
set_task(10.0"water_timer"id)
    }
}

public 
water_timer(id)
{
    if(
is_user_alive(id))
    {
        
g_burning[id] = 0
    
}
}

public 
ignite_effects(skIndex)
{
    new 
kIndex skIndex
    
    
if(is_user_alive(kIndex) && g_burning[kIndex])
    {
        new 
korigin[3]
        
get_user_origin(kIndex,korigin)
        
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
        
write_byte(17)
        
write_coord(korigin[0])
        
write_coord(korigin[1])
        
write_coord(korigin[2])
        
write_short(g_fire)
        
write_byte(10)
        
write_byte(200)
        
message_end()
        
        
set_task(0.2"ignite_effects" ,skIndex)
    }
    else {
        if(
g_burning[kIndex])
        {
            
g_burning[kIndex] = 0
        
}
    }
    return 
PLUGIN_CONTINUE
}

public 
ignite_player(skIndex)
{
    new 
kIndex skIndex
    
    
if(is_user_alive(kIndex) && g_burning[kIndex])
    {
        new 
korigin[3]
        new 
players[32]
        new 
pOrigin[3]
        new 
kHeath get_user_health(kIndex)
        
get_user_origin(kIndex,korigin)
        
        
set_user_health(kIndex,kHeath 10)
        
message_begin(MSG_ONEg_damage, {0,0,0}, kIndex)
        
write_byte(30)
        
write_byte(30)
        
write_long(1<<21
        
write_coord(korigin[0]) 
        
write_coord(korigin[1]) 
        
write_coord(korigin[2])
        
message_end()
        
        
players[0] = 0                
        korigin
[0] = 
        pOrigin
[0] = 
    
}
    
set_task(2.0"ignite_player" skIndex


Comes out this:
Code:

L 04/08/2011 - 21:04:17: Info (map "bfield") (file "addons/amxmodx/logs/error_20110408.log")
L 04/08/2011 - 21:04:17: Plugin called message_begin with an invalid message id (0).
L 04/08/2011 - 21:04:17: [AMXX] Displaying debug trace (plugin "lame_napalm.amxx")
L 04/08/2011 - 21:04:17: [AMXX] Run time error 10: native error (native "message_begin")
L 04/08/2011 - 21:04:17: [AMXX]    [0] lame_napalm.sma::ignite_player (line 90)
L 04/08/2011 - 21:04:17: [AMXX]    [1] lame_napalm.sma::event_damage (line 31)

And i can't find a way to fix this.

Can you guys tell me how to fix this?

thanks in advance. :)

padilha007 04-08-2011 23:00

Re: message_begin with an invalid message id
 
You need set an msgid to g_damage:

PHP Code:

public plugin_init() {
    
// Code...
    
g_damage get_user_msgid("Damage");
    
// Code...


And:

Check if the user is connected to prevent any invalid msg:
PHP Code:

    if(is_user_connected(kIndex) && is_user_alive(kIndex) && g_burning[kIndex]) 

For some reason MSG_ONE_UNRELIABLE is better to send to an especific player. I do not remember x)
PHP Code:

    message_begin(MSG_ONE_UNRELIABLEg_damage, {0,0,0}, kIndex



All times are GMT -4. The time now is 20:12.

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