Witam !
mam problem:
dodałem bronie do paintballgun.sma
kompiluje się ładnie, wybór broni działa.
Serwer crashuje przy próbie strzału.
W logach jest "Index out of bounds"
linijka 443
tutaj kod całego fragmentu:
public fw_cmdstart( id, uc_handle, random_seed )
{
if ( !is_user_alive( id ) )
return FMRES_IGNORED
static buttons; buttons = get_uc( uc_handle, UC_Buttons )
new my_pbgun = user_has_pbgun(id);
//if jammed, clear the chamber
if ( buttons & IN_USE && my_pbgun == g_Jammed[id] && my_pbgun && get_pcvar_num(jamon))
clear_chamber(id);
//if he is shooting with a PBGUN
if ( buttons & IN_ATTACK && my_pbgun)
{
//check if weapon is jammed
if(g_Jammed[id] == my_pbgun && !is_user_bot(id) && get_pcvar_num(jamon))
{
weapon_jam(id, uc_handle);
return FMRES_IGNORED;
}
set_uc (uc_handle, UC_Buttons, buttons & ~IN_ATTACK);
new ammo, null = get_user_weapon(id, ammo, null);
if (ammo)
{
new Float:gametime = get_gametime(), Float:g_speed;
switch (my_pbgun)
{
case PB_MARKER: g_speed = get_pcvar_float(fire_rate_high);
case PB_GLOCK: g_speed = get_pcvar_float(fire_rate_high);
case PB_USP: g_speed = get_pcvar_float(fire_rate_high);
case PB_SNIPER: g_speed = get_pcvar_float(fire_rate_low);
case PB_LAUNCHER: g_speed = get_pcvar_float(fire_rate_low);
case PB_SHOTGUN: g_speed = get_pcvar_float(fire_rate_medium);
case PB_SUPERMARKER: g_speed = get_pcvar_float(fire_rate_high)/2.0;
case PB_TMP: g_speed = get_pcvar_float(fire_rate_high);
case PB_KROWA: g_speed = get_pcvar_float(fire_rate_medium);
default: g_speed = get_pcvar_float(fire_rate_high);
}
new cangofull = (my_pbgun == PB_MARKER || my_pbgun == PB_LAUNCHER || my_pbgun == PB_SHOTGUN || my_pbgun == PB_SUPERMARKER);
//check that the button was not pressed before or that the weapon can go full-auto
new auto = !(pev(id, pev_oldbuttons) & IN_ATTACK) || cangofull;
//check the fire-rate and freezetime
if (gametime-lastshot[id] > g_speed && (is_user_bot(id) || nextattack[id] < 0.0) && !freezetime && auto)
{
new fired;
if (my_pbgun == PB_SHOTGUN)
{ //shoot 5 pellets
for (new a = 0; a < 5; a++)
fired = paint_fire(id, a) || fired;
}
else //shoot 1 pellet
fired = paint_fire(id, 0);
if (fired)
{
lastshot[id] = gametime;
set_user_clip(id, ammo - 1);
//show the animation
set_pev(id, pev_punchangle, Float:{-0.5, 0.0, 0.0});
message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, _, id);
write_byte(g_shot_anim[my_pbgun]);
write_byte(0);
message_end();
//shooting sound
if (get_pcvar_num(sound))
if (my_pbgun != PB_SNIPER)
if (my_pbgun != PB_LAUNCHER)
emit_sound(id, CHAN_AUTO, "misc/pbg.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
else
emit_sound(id, CHAN_AUTO, "misc/pb_launcher.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
else
emit_sound(id, CHAN_AUTO, "weapons/scout_fire-1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
try_to_jam(id,my_pbgun)
}
}
}
return FMRES_IGNORED;
}
return FMRES_IGNORED
}
error:
L 04/10/2014 - 16:43:54: Start of error session.
L 04/10/2014 - 16:43:54: Info (map "pb_arenabrazil") (file "addons/amxmodx/logs/error_20140410.log")
L 04/10/2014 - 16:43:54: [AMXX] Displaying debug trace (plugin "paintballgun.amxx")
L 04/10/2014 - 16:43:54: [AMXX] Run time error 4: index out of bounds
L 04/10/2014 - 16:43:54: [AMXX] [0] paintballgun.sma::fw_cmdstart (line 443)
Liczę na pomoc
Użytkownik Simply edytował ten post 11.04.2014 13:51


Dodatki SourceMod












