When I used the 1.sma, everything is OK.
But when I use the 2.sma, it shows the error like this :
Code:
05/06/2010 - 20:53:56: Plugin called message_begin with an invalid message id (0).
[AMXX] Displaying debug trace
[AMXX] Run time error 10: native error (native "message_begin")
[AMXX] [0]Create_ScreenShake (line 539)
[AMXX] [1] Missile_damage (line 359)
[AMXX] [2] vexd_pfntouch (line 332)
Code:
stock Create_ScreenShake(id, amount, duration, frequency)
{
message_begin(MSG_ONE_UNRELIABLE, g_msgScreenShake, {0,0,0}, id) //This is the line of 539
write_short(amount) // ammount
write_short(duration) // lasts this long
write_short(frequency) // frequency
message_end();
}
Code:
public vexd_pfntouch(pToucher, pTouched)
{
if( !is_valid_ent(pToucher) ) return
new sz[33]
entity_get_string(pToucher, EV_SZ_classname, sz, 32)
if( equal(sz, "savior_missile") )
{
new Float:Ori[3], Iori[3]
entity_get_vector(pToucher, EV_VEC_origin, Ori)
FVecIVec(Ori, Iori)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(3)
write_coord(Iori[0])
write_coord(Iori[1])
write_coord(Iori[2])
write_short(boom)
write_byte(100)
write_byte(15)
write_byte(0)
message_end();
Missile_damage(pToucher, 200.0, 500.0) //This is the line of 332
remove_entity(pToucher)
}
}
public Missile_damage(inf, Float:dmg, Float:rad)
{
new players[32], pnum, Float:rng, Float:cd, Float:ori[3], owner, cdi, killdmg, hurtdmg, takedmg, health, vec[3]
new sz[33]
entity_get_string(inf, EV_SZ_classname, sz, 32)
new team2, team1, ff = get_cvar_num("mp_friendlyfire")
entity_get_vector(inf, EV_VEC_origin, ori)
FVecIVec(ori, vec)
owner = entity_get_edict(inf, EV_ENT_owner)
team1 = get_user_team(owner)
get_players(players, pnum, "a")
for (new i=0; i < pnum; i++)
{
team2 = get_user_team(players[i])
if( team2 == team1 && !ff ) continue
rng = Float:entity_range(inf, players[i])
if( rng > rad ) continue
rng = rad - rng
cd = dmg / ( rad * rad ) * ( rng * rng )
cdi = floatround(cd)
Create_ScreenShake(players[i], (1<<14), (1<<13), (1<<14))// This is the line of 359
}
}
The difference between 1.sma and 2.sma is : I register_clcmd("+qigong", "cmdUseQigongDown") in the 2.sma, so there is a cmdUseQigongDown(id) and cmdUseQigongUp(id) function in the 2.sma, the rest code is almost the same .
Thanks for any help