AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   server crash (https://forums.alliedmods.net/showthread.php?t=273552)

alexclaudiu2003 10-21-2015 04:49

server crash
 
I think this this plugin crash my server
logs:
Run time error 4: index out of bounds
bio_zombie_finger.sma::FastRunHeartBeat (line 192)
Displaying debug trace (plugin "bio_zombie_finger.amxx")


PHP Code:

#include <amxmodx>
#include <biohazard>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#define PLUGIN  "[Bio] Zombie: Finger"
#define AUTHOR  "Aragon*"
#define VERSION "1.0"
#define ZOMBIE_NAME "Finger (Run)"     //Zombie Name
#define ZOMBIE_DESC "press G Run" //Zobmie Description
#define ZOMBIE_MODEL "models/player/bio30_finger/bio30_finger.mdl"     //Zombie Model
#define ZOMBIE_CLAWS "models/player/bio30_finger/claws_finger.mdl" //Claws Model
#define ZOMBIE_HEALTH  555.0 //Health value
#define ZOMBIE_SPEED  300.0 //Speed value
#define ZOMBIE_GRAVITY  1.0 //Gravity multiplier
#define ZOMBIE_ATTACK  1.5 //Zombie damage multiplier
#define ZOMBIE_REGENDLY  0.25 //Regeneration delay value
#define ZOMBIE_KNOCKBACK 0.0 //Knockback multiplier
#define TASKID_FASTRUN_HEARTBEAT 12314
#define TASKID_START_POWER  2131
new FastRun_Sound[][] = {
 
"Biohazard30/bio30_finger/pukricide.wav"
}
new const 
Tag[  ] = "[Biohazard]";
new Class, 
FastRun[33], FastRun_Countdown[33]
new 
cvar_fastrun_durationcvar_fastrun_countdowncvar_fastrun_speed;
public 
plugin_init() {         
 
register_plugin(PLUGIN,AUTHOR,VERSION)
 
is_biomod_active() ? plugin_init2() : pause("ad")
}
public 
plugin_init2() {
 Class = 
register_class(ZOMBIE_NAMEZOMBIE_DESC )
 
 
set_class_pmodel(Class, ZOMBIE_MODEL)
 
set_class_wmodel(Class, ZOMBIE_CLAWS)
 
 
set_class_data(Class, DATA_HEALTHZOMBIE_HEALTH);
 
set_class_data(Class, DATA_SPEEDZOMBIE_SPEED);
 
set_class_data(Class, DATA_GRAVITYZOMBIE_GRAVITY);
 
set_class_data(Class, DATA_ATTACKZOMBIE_ATTACK);
 
set_class_data(Class, DATA_REGENDLYZOMBIE_REGENDLY);
 
set_class_data(Class, DATA_KNOCKBACKZOMBIE_KNOCKBACK);
 
 
register_clcmd"drop""CMD_FastRun");
 
 
register_event("DeathMsg""EVENT_Death""a")
 
 
register_forward(FM_PlayerPreThink,"FWD_PlayerPreThink")
 
 
RegisterHam(Ham_Spawn"player""HAM_Spawn_Post"1);
 
 
cvar_fastrun_duration register_cvar("bio_fastrun_duration""13.0")
 
cvar_fastrun_countdown register_cvar("bio_fastrun_countdown""7.0")
 
cvar_fastrun_speed register_cvar("bio_fastrun_speed""500.0")  
}
public 
plugin_precache() {
 
precache_model(ZOMBIE_CLAWS)
 
precache_model(ZOMBIE_MODEL)
 
 for(new 
0sizeof FastRun_Soundi++ )
  
precache_sound(FastRun_Sound[i]);
}
public 
EVENT_Death() {
 
FastRun[read_data(2)] = 0
 FastRun_Countdown
[read_data(2)] = 0
 remove_task
(read_data(2) + TASKID_FASTRUN_HEARTBEAT)
}
public 
event_infect(victimattacker) {
 if(
get_user_class(victim) == Class) {
  
FastRun[victim] = 0
  FastRun_Countdown
[victim] = 0
  remove_task
(victim TASKID_FASTRUN_HEARTBEAT)
  
ColorChat(victim"^x04%s^x01 Pentru a folosi^x03 ultra viteza^x01 apasa tasta^x03 G^x01."Tag)
 }
}
public 
FWD_PlayerPreThink(id) {
 if(
is_user_alive(id) && FastRun[id]) {
  if(
fm_get_user_maxspeed(id) < get_pcvar_float(cvar_fastrun_speed) && fm_get_user_maxspeed(id) > 1.0)
   
fm_set_user_maxspeed(idget_pcvar_float(cvar_fastrun_speed))
 }
 if(
get_user_weapon(id) != CSW_KNIFE && task_exists(id TASKID_START_POWER))
  
remove_task(id TASKID_START_POWER)
}
public 
HAM_Spawn_Post(id) { 
 
FastRun[id] = 0
 FastRun_Countdown
[id] = 0
 remove_task
(id TASKID_FASTRUN_HEARTBEAT)
}
public 
CMD_FastRun(id) {
 new 
Float:NextAttack get_pdata_float(id835);
 if(
is_user_alive(id) && get_user_class(id) == Class && is_user_zombie(id) && get_user_weapon(id) == CSW_KNIFE && NextAttack <= 0.0) {
  if(!
FastRun[id] && !FastRun_Countdown[id]) {
   
set_pdata_float(id831.65);
   
set_weapon_anim(id9)
   
set_task(1.50"StartRun"id TASKID_START_POWER);
  }
  return 
PLUGIN_HANDLED
 
}
 return 
PLUGIN_CONTINUE
}
public 
StartRun(id) {
 
id -= TASKID_START_POWER
 
 engclient_cmd
(id"weapon_knife");
 
set_pdata_float(id831.565);
 
set_weapon_anim(id10)
 
EffectFastrun(id95)
 
emit_sound(idCHAN_VOICEFastRun_Sound[0], 1.0ATTN_NORM0PITCH_NORM)
 
set_task(2.0"FastRunHeartBeat"id TASKID_FASTRUN_HEARTBEAT__"b")
 
FastRun[id] = get_pcvar_num(cvar_fastrun_duration);
 
 if(
FastRun[id]) {
  new 
Message[256];
  
formatex(Message,sizeof(Message)-1,"Fast Run^n(%d second%s remaining).",FastRun[id], FastRun[id] > "s" "");
  
  
HudMessage(idMessage_______0.9);
  
set_task(1.0"TASK_CountDown"id);
 }
}
public 
TASK_CountDown(id) {
 if (!
is_user_alive(id) || !is_user_zombie(id) || get_user_class(id) != Class) {
  
FastRun[id] = 0
 
}
 else if(
is_user_alive(id) && FastRun[id] > 1) {
  
FastRun[id] --;
  new 
Message[256];
  
formatex(Message,sizeof(Message)-1,"Fast Run^n(%d second%s remaining).",FastRun[id], FastRun[id] > "s" "");
  
  
HudMessage(idMessage_______0.9);
  
set_task(1.0"TASK_CountDown"id);
 }
 else if(
FastRun[id] <= 1) {
  
FastRun[id] = 0
  remove_task
(id TASKID_FASTRUN_HEARTBEAT)
  
fm_set_user_maxspeed(idZOMBIE_SPEED)
  
EffectFastrun(id)
  
  
FastRun_Countdown[id] = get_pcvar_num(cvar_fastrun_countdown)
  
  if(
FastRun_Countdown[id]) {
   new 
Message[256];
   
formatex(Message,sizeof(Message)-1,"Fast Run not ready.^n(%d second%s remaining).",FastRun_Countdown[id], FastRun_Countdown[id] > "s" "");
   
   
HudMessage(idMessage_______0.9);
   
set_task(1.0"TASK_CountDown2"id);
  }
 }
}
public 
TASK_CountDown2(id) {
 if (!
is_user_alive(id) || !is_user_zombie(id) || get_user_class(id) != Class)
  
FastRun_Countdown[id] = 0
 
else if(is_user_alive(id) && FastRun_Countdown[id] > 1) {
  
FastRun_Countdown[id] --;
  new 
Message[256];
  
formatex(Message,sizeof(Message)-1,"Fast Run not ready.^n(%d second%s remaining).",FastRun_Countdown[id], FastRun_Countdown[id] > "s" "");
  
  
HudMessage(idMessage_______0.9);
  
set_task(1.0"TASK_CountDown2"id);
 }
 else if(
FastRun_Countdown[id] <= 1) {
  new 
Message[256];
  
formatex(Message,sizeof(Message)-1,"Fast Run is ready.");
  
  
HudMessage(idMessage_______0.9);
  
FastRun_Countdown[id] = 0;
 }
}
public 
FastRunHeartBeat(id) {
 
id -= TASKID_FASTRUN_HEARTBEAT
 
 
if (FastRun[id]) {
  
emit_sound(idCHAN_VOICEFastRun_Sound[random_num(1sizeof FastRun_Sound 1)], 1.0ATTN_NORM0PITCH_NORM)
  
  if(
is_user_connected(id)) {
   new 
Color[3]
   
Color[0] = 200
   Color
[1] = 0
   Color
[2] = 0
   
   UTIL_ScreenFade
(idColor0.50.5125)
   
  }
 }
}
EffectFastrun(idnum 90) {
 if(
is_user_connected(id)) {
  
message_begin(MSG_ONEget_user_msgid("SetFOV"), {0,0,0}, id)
  
write_byte(num)
  
message_end()
 }
}
stock FixedUnsigned16(Float:flValueiScale) {
 new 
iOutput;
 
 
iOutput floatround(flValue iScale);
 if ( 
iOutput )
  
iOutput 0;
 
 if ( 
iOutput 0xFFFF )
  
iOutput 0xFFFF;
 return 
iOutput;
}
stock UTIL_ScreenFade(id=0,iColor[3]={0,0,0},Float:flFxTime=-1.0,Float:flHoldTime=0.0,iAlpha=0,iFlags=0x0000,bool:bReliable=false,bool:bExternal=false) {
 if( 
id && !is_user_connected(id))
  return;
 
 new 
iFadeTime;
 if( 
flFxTime == -1.0 ) {
  
iFadeTime 4;
 }
 else {
  
iFadeTime FixedUnsigned16flFxTime 1<<12 );
 }
 
 static 
gmsgScreenFade;
 if( !
gmsgScreenFade ) {
  
gmsgScreenFade get_user_msgid("ScreenFade");
 }
 
 new 
MSG_DEST;
 if( 
bReliable ) {
  
MSG_DEST id MSG_ONE MSG_ALL;
 }
 else {
  
MSG_DEST id MSG_ONE_UNRELIABLE MSG_BROADCAST;
 }
 
 if( 
bExternal ) {
  
emessage_beginMSG_DESTgmsgScreenFade_id );
  
ewrite_shortiFadeTime );
  
ewrite_shortFixedUnsigned16flHoldTime 1<<12 ) );
  
ewrite_shortiFlags );
  
ewrite_byteiColor[0] );
  
ewrite_byteiColor[1] );
  
ewrite_byteiColor[2] );
  
ewrite_byteiAlpha );
  
emessage_end();
 }
 else {
  
message_beginMSG_DESTgmsgScreenFade_id );
  
write_shortiFadeTime );
  
write_shortFixedUnsigned16flHoldTime 1<<12 ) );
  
write_shortiFlags );
  
write_byteiColor[0] );
  
write_byteiColor[1] );
  
write_byteiColor[2] );
  
write_byteiAlpha );
  
message_end();
 }
}
stock UTIL_FadeToBlack(id,Float:fxtime=3.0,bool:bReliable=false,bool:bExternal=false) {
 
UTIL_ScreenFade(id_fxtimefxtime2550x0001|0x0004,bReliable,bExternal);
}
stock set_weapon_anim(idanim) {
 
set_pev(idpev_weaponanimanim);
 if(
is_user_connected(id)) {
  
message_begin(MSG_ONESVC_WEAPONANIM_id);
  
write_byte(anim);
  
write_byte(pev(idpev_body));
  
message_end();
 }
}
#define clamp_byte(%1)       ( clamp( %1, 0, 255 ) )
#define pack_color(%1,%2,%3) ( %3 + ( %2 << 8 ) + ( %1 << 16 ) )
stock HudMessage(const id, const message[], red 0green 160blue 0Float:= -1.0Float:0.65effects 2Float:fxtime 0.01Float:holdtime 3.0Float:fadeintime 0.01Float:fadeouttime 0.01) {
 new 
count 1players[32];
 
 if(
idplayers[0] = id;
 else 
get_players(playerscount"ch"); {
  for(new 
0counti++) {
   if(
is_user_connected(players[i])) { 
    new 
color pack_color(clamp_byte(red), clamp_byte(green), clamp_byte(blue))
    
    
message_begin(MSG_ONE_UNRELIABLESVC_DIRECTOR_players[i]);
    
write_byte(strlen(message) + 31);
    
write_byte(DRC_CMD_MESSAGE);
    
write_byte(effects);
    
write_long(color);
    
write_long(_:x);
    
write_long(_:y);
    
write_long(_:fadeintime);
    
write_long(_:fadeouttime);
    
write_long(_:holdtime);
    
write_long(_:fxtime);
    
write_string(message);
    
message_end();
   }
  }
 }
}
stock ColorChat(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");
 
 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();
   }
  }
 } 
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/ 


Depresie 10-21-2015 06:00

Re: server crash
 
first, remove your server dns from signature, it's not okay to advertise game servers around here, and yes, that errors causes server crashes sometimes

just add this somewhere below plugin_precache

PHP Code:

public client_disconect(id)
{
         
remove_task(id TASKID_FASTRUN_HEARTBEAT)



alexclaudiu2003 10-21-2015 07:05

Re: server crash
 
error still persist
Displaying debug trace (plugin "bio_zombie_finger.amxx")
L 10/21/2015 - 13:18:36: [AMXX] Run time error 4: index out of bounds
L 10/21/2015 - 13:18:36: [AMXX] [0] bio_zombie_finger.sma::FastRunHeartBeat (line 197)
L 10/21/2015 - 13:18:38: [AMXX] Displaying debug trace (plugin "bio_zombie_finger.amxx")
L 10/21/2015 - 13:18:38: [AMXX] Run time error 4: index out of bounds

PHP Code:

#include <amxmodx>
#include <biohazard>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#define PLUGIN  "[Bio] Zombie: Finger"
#define AUTHOR  "Aragon*"
#define VERSION "1.0"
#define ZOMBIE_NAME "Finger (Run)"     //Zombie Name
#define ZOMBIE_DESC "press G Run" //Zobmie Description
#define ZOMBIE_MODEL "models/player/bio30_finger/bio30_finger.mdl"     //Zombie Model
#define ZOMBIE_CLAWS "models/player/bio30_finger/claws_finger.mdl" //Claws Model
#define ZOMBIE_HEALTH  555.0 //Health value
#define ZOMBIE_SPEED  300.0 //Speed value
#define ZOMBIE_GRAVITY  1.0 //Gravity multiplier
#define ZOMBIE_ATTACK  1.5 //Zombie damage multiplier
#define ZOMBIE_REGENDLY  0.25 //Regeneration delay value
#define ZOMBIE_KNOCKBACK 0.0 //Knockback multiplier
#define TASKID_FASTRUN_HEARTBEAT 12314
#define TASKID_START_POWER  2131
new FastRun_Sound[][] = {
 
"Biohazard30/bio30_finger/pukricide.wav"
}
new const 
Tag[  ] = "[Biohazard]";
new Class, 
FastRun[33], FastRun_Countdown[33]
new 
cvar_fastrun_durationcvar_fastrun_countdowncvar_fastrun_speed;
public 
plugin_init() {         
 
register_plugin(PLUGIN,AUTHOR,VERSION)
 
is_biomod_active() ? plugin_init2() : pause("ad")
}
public 
plugin_init2() {
 Class = 
register_class(ZOMBIE_NAMEZOMBIE_DESC )
 
 
set_class_pmodel(Class, ZOMBIE_MODEL)
 
set_class_wmodel(Class, ZOMBIE_CLAWS)
 
 
set_class_data(Class, DATA_HEALTHZOMBIE_HEALTH);
 
set_class_data(Class, DATA_SPEEDZOMBIE_SPEED);
 
set_class_data(Class, DATA_GRAVITYZOMBIE_GRAVITY);
 
set_class_data(Class, DATA_ATTACKZOMBIE_ATTACK);
 
set_class_data(Class, DATA_REGENDLYZOMBIE_REGENDLY);
 
set_class_data(Class, DATA_KNOCKBACKZOMBIE_KNOCKBACK);
 
 
register_clcmd"drop""CMD_FastRun");
 
 
register_event("DeathMsg""EVENT_Death""a")
 
 
register_forward(FM_PlayerPreThink,"FWD_PlayerPreThink")
 
 
RegisterHam(Ham_Spawn"player""HAM_Spawn_Post"1);
 
 
cvar_fastrun_duration register_cvar("bio_fastrun_duration""13.0")
 
cvar_fastrun_countdown register_cvar("bio_fastrun_countdown""7.0")
 
cvar_fastrun_speed register_cvar("bio_fastrun_speed""500.0")  
}
public 
plugin_precache() {
 
precache_model(ZOMBIE_CLAWS)
 
precache_model(ZOMBIE_MODEL)
 
 for(new 
0sizeof FastRun_Soundi++ )
  
precache_sound(FastRun_Sound[i]);
}
public 
client_disconect(id)
{
         
remove_task(id TASKID_FASTRUN_HEARTBEAT)
}
public 
EVENT_Death() {
 
FastRun[read_data(2)] = 0
 FastRun_Countdown
[read_data(2)] = 0
 remove_task
(read_data(2) + TASKID_FASTRUN_HEARTBEAT)
}
public 
event_infect(victimattacker) {
 if(
get_user_class(victim) == Class) {
  
FastRun[victim] = 0
  FastRun_Countdown
[victim] = 0
  remove_task
(victim TASKID_FASTRUN_HEARTBEAT)
  
ColorChat(victim"^x04%s^x01 Pentru a folosi^x03 ultra viteza^x01 apasa tasta^x03 G^x01."Tag)
 }
}
public 
FWD_PlayerPreThink(id) {
 if(
is_user_alive(id) && FastRun[id]) {
  if(
fm_get_user_maxspeed(id) < get_pcvar_float(cvar_fastrun_speed) && fm_get_user_maxspeed(id) > 1.0)
   
fm_set_user_maxspeed(idget_pcvar_float(cvar_fastrun_speed))
 }
 if(
get_user_weapon(id) != CSW_KNIFE && task_exists(id TASKID_START_POWER))
  
remove_task(id TASKID_START_POWER)
}
public 
HAM_Spawn_Post(id) { 
 
FastRun[id] = 0
 FastRun_Countdown
[id] = 0
 remove_task
(id TASKID_FASTRUN_HEARTBEAT)
}
public 
CMD_FastRun(id) {
 new 
Float:NextAttack get_pdata_float(id835);
 if(
is_user_alive(id) && get_user_class(id) == Class && is_user_zombie(id) && get_user_weapon(id) == CSW_KNIFE && NextAttack <= 0.0) {
  if(!
FastRun[id] && !FastRun_Countdown[id]) {
   
set_pdata_float(id831.65);
   
set_weapon_anim(id9)
   
set_task(1.50"StartRun"id TASKID_START_POWER);
  }
  return 
PLUGIN_HANDLED
 
}
 return 
PLUGIN_CONTINUE
}
public 
StartRun(id) {
 
id -= TASKID_START_POWER
 
 engclient_cmd
(id"weapon_knife");
 
set_pdata_float(id831.565);
 
set_weapon_anim(id10)
 
EffectFastrun(id95)
 
emit_sound(idCHAN_VOICEFastRun_Sound[0], 1.0ATTN_NORM0PITCH_NORM)
 
set_task(2.0"FastRunHeartBeat"id TASKID_FASTRUN_HEARTBEAT__"b")
 
FastRun[id] = get_pcvar_num(cvar_fastrun_duration);
 
 if(
FastRun[id]) {
  new 
Message[256];
  
formatex(Message,sizeof(Message)-1,"Fast Run^n(%d second%s remaining).",FastRun[id], FastRun[id] > "s" "");
  
  
HudMessage(idMessage_______0.9);
  
set_task(1.0"TASK_CountDown"id);
 }
}
public 
TASK_CountDown(id) {
 if (!
is_user_alive(id) || !is_user_zombie(id) || get_user_class(id) != Class) {
  
FastRun[id] = 0
 
}
 else if(
is_user_alive(id) && FastRun[id] > 1) {
  
FastRun[id] --;
  new 
Message[256];
  
formatex(Message,sizeof(Message)-1,"Fast Run^n(%d second%s remaining).",FastRun[id], FastRun[id] > "s" "");
  
  
HudMessage(idMessage_______0.9);
  
set_task(1.0"TASK_CountDown"id);
 }
 else if(
FastRun[id] <= 1) {
  
FastRun[id] = 0
  remove_task
(id TASKID_FASTRUN_HEARTBEAT)
  
fm_set_user_maxspeed(idZOMBIE_SPEED)
  
EffectFastrun(id)
  
  
FastRun_Countdown[id] = get_pcvar_num(cvar_fastrun_countdown)
  
  if(
FastRun_Countdown[id]) {
   new 
Message[256];
   
formatex(Message,sizeof(Message)-1,"Fast Run not ready.^n(%d second%s remaining).",FastRun_Countdown[id], FastRun_Countdown[id] > "s" "");
   
   
HudMessage(idMessage_______0.9);
   
set_task(1.0"TASK_CountDown2"id);
  }
 }
}
public 
TASK_CountDown2(id) {
 if (!
is_user_alive(id) || !is_user_zombie(id) || get_user_class(id) != Class)
  
FastRun_Countdown[id] = 0
 
else if(is_user_alive(id) && FastRun_Countdown[id] > 1) {
  
FastRun_Countdown[id] --;
  new 
Message[256];
  
formatex(Message,sizeof(Message)-1,"Fast Run not ready.^n(%d second%s remaining).",FastRun_Countdown[id], FastRun_Countdown[id] > "s" "");
  
  
HudMessage(idMessage_______0.9);
  
set_task(1.0"TASK_CountDown2"id);
 }
 else if(
FastRun_Countdown[id] <= 1) {
  new 
Message[256];
  
formatex(Message,sizeof(Message)-1,"Fast Run is ready.");
  
  
HudMessage(idMessage_______0.9);
  
FastRun_Countdown[id] = 0;
 }
}
public 
FastRunHeartBeat(id) {
 
id -= TASKID_FASTRUN_HEARTBEAT
 
 
if (FastRun[id]) {
  
emit_sound(idCHAN_VOICEFastRun_Sound[random_num(1sizeof FastRun_Sound 1)], 1.0ATTN_NORM0PITCH_NORM)
  
  if(
is_user_connected(id)) {
   new 
Color[3]
   
Color[0] = 200
   Color
[1] = 0
   Color
[2] = 0
   
   UTIL_ScreenFade
(idColor0.50.5125)
   
  }
 }
}
EffectFastrun(idnum 90) {
 if(
is_user_connected(id)) {
  
message_begin(MSG_ONEget_user_msgid("SetFOV"), {0,0,0}, id)
  
write_byte(num)
  
message_end()
 }
}
stock FixedUnsigned16(Float:flValueiScale) {
 new 
iOutput;
 
 
iOutput floatround(flValue iScale);
 if ( 
iOutput )
  
iOutput 0;
 
 if ( 
iOutput 0xFFFF )
  
iOutput 0xFFFF;
 return 
iOutput;
}
stock UTIL_ScreenFade(id=0,iColor[3]={0,0,0},Float:flFxTime=-1.0,Float:flHoldTime=0.0,iAlpha=0,iFlags=0x0000,bool:bReliable=false,bool:bExternal=false) {
 if( 
id && !is_user_connected(id))
  return;
 
 new 
iFadeTime;
 if( 
flFxTime == -1.0 ) {
  
iFadeTime 4;
 }
 else {
  
iFadeTime FixedUnsigned16flFxTime 1<<12 );
 }
 
 static 
gmsgScreenFade;
 if( !
gmsgScreenFade ) {
  
gmsgScreenFade get_user_msgid("ScreenFade");
 }
 
 new 
MSG_DEST;
 if( 
bReliable ) {
  
MSG_DEST id MSG_ONE MSG_ALL;
 }
 else {
  
MSG_DEST id MSG_ONE_UNRELIABLE MSG_BROADCAST;
 }
 
 if( 
bExternal ) {
  
emessage_beginMSG_DESTgmsgScreenFade_id );
  
ewrite_shortiFadeTime );
  
ewrite_shortFixedUnsigned16flHoldTime 1<<12 ) );
  
ewrite_shortiFlags );
  
ewrite_byteiColor[0] );
  
ewrite_byteiColor[1] );
  
ewrite_byteiColor[2] );
  
ewrite_byteiAlpha );
  
emessage_end();
 }
 else {
  
message_beginMSG_DESTgmsgScreenFade_id );
  
write_shortiFadeTime );
  
write_shortFixedUnsigned16flHoldTime 1<<12 ) );
  
write_shortiFlags );
  
write_byteiColor[0] );
  
write_byteiColor[1] );
  
write_byteiColor[2] );
  
write_byteiAlpha );
  
message_end();
 }
}
stock UTIL_FadeToBlack(id,Float:fxtime=3.0,bool:bReliable=false,bool:bExternal=false) {
 
UTIL_ScreenFade(id_fxtimefxtime2550x0001|0x0004,bReliable,bExternal);
}
stock set_weapon_anim(idanim) {
 
set_pev(idpev_weaponanimanim);
 if(
is_user_connected(id)) {
  
message_begin(MSG_ONESVC_WEAPONANIM_id);
  
write_byte(anim);
  
write_byte(pev(idpev_body));
  
message_end();
 }
}
#define clamp_byte(%1)       ( clamp( %1, 0, 255 ) )
#define pack_color(%1,%2,%3) ( %3 + ( %2 << 8 ) + ( %1 << 16 ) )
stock HudMessage(const id, const message[], red 0green 160blue 0Float:= -1.0Float:0.65effects 2Float:fxtime 0.01Float:holdtime 3.0Float:fadeintime 0.01Float:fadeouttime 0.01) {
 new 
count 1players[32];
 
 if(
idplayers[0] = id;
 else 
get_players(playerscount"ch"); {
  for(new 
0counti++) {
   if(
is_user_connected(players[i])) { 
    new 
color pack_color(clamp_byte(red), clamp_byte(green), clamp_byte(blue))
    
    
message_begin(MSG_ONE_UNRELIABLESVC_DIRECTOR_players[i]);
    
write_byte(strlen(message) + 31);
    
write_byte(DRC_CMD_MESSAGE);
    
write_byte(effects);
    
write_long(color);
    
write_long(_:x);
    
write_long(_:y);
    
write_long(_:fadeintime);
    
write_long(_:fadeouttime);
    
write_long(_:holdtime);
    
write_long(_:fxtime);
    
write_string(message);
    
message_end();
   }
  }
 }
}
stock ColorChat(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");
 
 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();
   }
  }
 } 
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/ 


Depresie 10-21-2015 07:34

Re: server crash
 
Try

btw let the first code i posted there aswell, in case the player leaves the task must be removed in order to avoid errors and crashes

PHP Code:

#include <amxmodx>
#include <biohazard>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#define PLUGIN  "[Bio] Zombie: Finger"
#define AUTHOR  "Aragon*"
#define VERSION "1.0"
#define ZOMBIE_NAME "Finger (Run)"     //Zombie Name
#define ZOMBIE_DESC "press G Run" //Zobmie Description
#define ZOMBIE_MODEL "models/player/bio30_finger/bio30_finger.mdl"     //Zombie Model
#define ZOMBIE_CLAWS "models/player/bio30_finger/claws_finger.mdl" //Claws Model
#define ZOMBIE_HEALTH  555.0 //Health value
#define ZOMBIE_SPEED  300.0 //Speed value
#define ZOMBIE_GRAVITY  1.0 //Gravity multiplier
#define ZOMBIE_ATTACK  1.5 //Zombie damage multiplier
#define ZOMBIE_REGENDLY  0.25 //Regeneration delay value
#define ZOMBIE_KNOCKBACK 0.0 //Knockback multiplier
#define TASKID_FASTRUN_HEARTBEAT 12314
#define TASKID_START_POWER  2131
new FastRun_Sound[][] = {
 
"Biohazard30/bio30_finger/pukricide.wav"
}
new const 
Tag[  ] = "[Biohazard]";
new Class, 
FastRun[33], FastRun_Countdown[33]
new 
cvar_fastrun_durationcvar_fastrun_countdowncvar_fastrun_speed;
public 
plugin_init() {         
 
register_plugin(PLUGIN,AUTHOR,VERSION)
 
is_biomod_active() ? plugin_init2() : pause("ad")
}
public 
plugin_init2() {
 Class = 
register_class(ZOMBIE_NAMEZOMBIE_DESC )
 
 
set_class_pmodel(Class, ZOMBIE_MODEL)
 
set_class_wmodel(Class, ZOMBIE_CLAWS)
 
 
set_class_data(Class, DATA_HEALTHZOMBIE_HEALTH);
 
set_class_data(Class, DATA_SPEEDZOMBIE_SPEED);
 
set_class_data(Class, DATA_GRAVITYZOMBIE_GRAVITY);
 
set_class_data(Class, DATA_ATTACKZOMBIE_ATTACK);
 
set_class_data(Class, DATA_REGENDLYZOMBIE_REGENDLY);
 
set_class_data(Class, DATA_KNOCKBACKZOMBIE_KNOCKBACK);
 
 
register_clcmd"drop""CMD_FastRun");
 
 
register_event("DeathMsg""EVENT_Death""a")
 
 
register_forward(FM_PlayerPreThink,"FWD_PlayerPreThink")
 
 
RegisterHam(Ham_Spawn"player""HAM_Spawn_Post"1);
 
 
cvar_fastrun_duration register_cvar("bio_fastrun_duration""13.0")
 
cvar_fastrun_countdown register_cvar("bio_fastrun_countdown""7.0")
 
cvar_fastrun_speed register_cvar("bio_fastrun_speed""500.0")  
}
public 
plugin_precache() {
 
precache_model(ZOMBIE_CLAWS)
 
precache_model(ZOMBIE_MODEL)
 
 for(new 
0sizeof FastRun_Soundi++ )
  
precache_sound(FastRun_Sound[i]);
}
public 
client_disconect(id)
{
         
remove_task(id TASKID_FASTRUN_HEARTBEAT)
}
public 
EVENT_Death() {
 
FastRun[read_data(2)] = 0
 FastRun_Countdown
[read_data(2)] = 0
 remove_task
(read_data(2) + TASKID_FASTRUN_HEARTBEAT)
}
public 
event_infect(victimattacker) {
 if(
get_user_class(victim) == Class) {
  
FastRun[victim] = 0
  FastRun_Countdown
[victim] = 0
  remove_task
(victim TASKID_FASTRUN_HEARTBEAT)
  
ColorChat(victim"^x04%s^x01 Pentru a folosi^x03 ultra viteza^x01 apasa tasta^x03 G^x01."Tag)
 }
}
public 
FWD_PlayerPreThink(id) {
 if(
is_user_alive(id) && FastRun[id]) {
  if(
fm_get_user_maxspeed(id) < get_pcvar_float(cvar_fastrun_speed) && fm_get_user_maxspeed(id) > 1.0)
   
fm_set_user_maxspeed(idget_pcvar_float(cvar_fastrun_speed))
 }
 if(
get_user_weapon(id) != CSW_KNIFE && task_exists(id TASKID_START_POWER))
  
remove_task(id TASKID_START_POWER)
}
public 
HAM_Spawn_Post(id) { 
 
FastRun[id] = 0
 FastRun_Countdown
[id] = 0
 remove_task
(id TASKID_FASTRUN_HEARTBEAT)
}
public 
CMD_FastRun(id) {
 new 
Float:NextAttack get_pdata_float(id835);
 if(
is_user_alive(id) && get_user_class(id) == Class && is_user_zombie(id) && get_user_weapon(id) == CSW_KNIFE && NextAttack <= 0.0) {
  if(!
FastRun[id] && !FastRun_Countdown[id]) {
   
set_pdata_float(id831.65);
   
set_weapon_anim(id9)
   
set_task(1.50"StartRun"id TASKID_START_POWER);
  }
  return 
PLUGIN_HANDLED
 
}
 return 
PLUGIN_CONTINUE
}
public 
StartRun(id) {
 
id -= TASKID_START_POWER
 
 engclient_cmd
(id"weapon_knife");
 
set_pdata_float(id831.565);
 
set_weapon_anim(id10)
 
EffectFastrun(id95)
 
emit_sound(idCHAN_VOICEFastRun_Sound[0], 1.0ATTN_NORM0PITCH_NORM)
 
set_task(2.0"FastRunHeartBeat"id TASKID_FASTRUN_HEARTBEAT__"b")
 
FastRun[id] = get_pcvar_num(cvar_fastrun_duration);
 
 if(
FastRun[id]) {
  new 
Message[256];
  
formatex(Message,sizeof(Message)-1,"Fast Run^n(%d second%s remaining).",FastRun[id], FastRun[id] > "s" "");
  
  
HudMessage(idMessage_______0.9);
  
set_task(1.0"TASK_CountDown"id);
 }
}
public 
TASK_CountDown(id) {
 if (!
is_user_alive(id) || !is_user_zombie(id) || get_user_class(id) != Class) {
  
FastRun[id] = 0
 
}
 else if(
is_user_alive(id) && FastRun[id] > 1) {
  
FastRun[id] --;
  new 
Message[256];
  
formatex(Message,sizeof(Message)-1,"Fast Run^n(%d second%s remaining).",FastRun[id], FastRun[id] > "s" "");
  
  
HudMessage(idMessage_______0.9);
  
set_task(1.0"TASK_CountDown"id);
 }
 else if(
FastRun[id] <= 1) {
  
FastRun[id] = 0
  remove_task
(id TASKID_FASTRUN_HEARTBEAT)
  
fm_set_user_maxspeed(idZOMBIE_SPEED)
  
EffectFastrun(id)
  
  
FastRun_Countdown[id] = get_pcvar_num(cvar_fastrun_countdown)
  
  if(
FastRun_Countdown[id]) {
   new 
Message[256];
   
formatex(Message,sizeof(Message)-1,"Fast Run not ready.^n(%d second%s remaining).",FastRun_Countdown[id], FastRun_Countdown[id] > "s" "");
   
   
HudMessage(idMessage_______0.9);
   
set_task(1.0"TASK_CountDown2"id);
  }
 }
}
public 
TASK_CountDown2(id) {
 if (!
is_user_alive(id) || !is_user_zombie(id) || get_user_class(id) != Class)
  
FastRun_Countdown[id] = 0
 
else if(is_user_alive(id) && FastRun_Countdown[id] > 1) {
  
FastRun_Countdown[id] --;
  new 
Message[256];
  
formatex(Message,sizeof(Message)-1,"Fast Run not ready.^n(%d second%s remaining).",FastRun_Countdown[id], FastRun_Countdown[id] > "s" "");
  
  
HudMessage(idMessage_______0.9);
  
set_task(1.0"TASK_CountDown2"id);
 }
 else if(
FastRun_Countdown[id] <= 1) {
  new 
Message[256];
  
formatex(Message,sizeof(Message)-1,"Fast Run is ready.");
  
  
HudMessage(idMessage_______0.9);
  
FastRun_Countdown[id] = 0;
 }
}
public 
FastRunHeartBeat(id) {
 
id -= TASKID_FASTRUN_HEARTBEAT
 
 
if (is_user_connected(id) && FastRun[id]) {
  
emit_sound(idCHAN_VOICEFastRun_Sound[random_num(1sizeof FastRun_Sound 1)], 1.0ATTN_NORM0PITCH_NORM)
  
  if(
is_user_connected(id)) {
   new 
Color[3]
   
Color[0] = 200
   Color
[1] = 0
   Color
[2] = 0
   
   UTIL_ScreenFade
(idColor0.50.5125)
   
  }
 }
}
EffectFastrun(idnum 90) {
 if(
is_user_connected(id)) {
  
message_begin(MSG_ONEget_user_msgid("SetFOV"), {0,0,0}, id)
  
write_byte(num)
  
message_end()
 }
}
stock FixedUnsigned16(Float:flValueiScale) {
 new 
iOutput;
 
 
iOutput floatround(flValue iScale);
 if ( 
iOutput )
  
iOutput 0;
 
 if ( 
iOutput 0xFFFF )
  
iOutput 0xFFFF;
 return 
iOutput;
}
stock UTIL_ScreenFade(id=0,iColor[3]={0,0,0},Float:flFxTime=-1.0,Float:flHoldTime=0.0,iAlpha=0,iFlags=0x0000,bool:bReliable=false,bool:bExternal=false) {
 if( 
id && !is_user_connected(id))
  return;
 
 new 
iFadeTime;
 if( 
flFxTime == -1.0 ) {
  
iFadeTime 4;
 }
 else {
  
iFadeTime FixedUnsigned16flFxTime 1<<12 );
 }
 
 static 
gmsgScreenFade;
 if( !
gmsgScreenFade ) {
  
gmsgScreenFade get_user_msgid("ScreenFade");
 }
 
 new 
MSG_DEST;
 if( 
bReliable ) {
  
MSG_DEST id MSG_ONE MSG_ALL;
 }
 else {
  
MSG_DEST id MSG_ONE_UNRELIABLE MSG_BROADCAST;
 }
 
 if( 
bExternal ) {
  
emessage_beginMSG_DESTgmsgScreenFade_id );
  
ewrite_shortiFadeTime );
  
ewrite_shortFixedUnsigned16flHoldTime 1<<12 ) );
  
ewrite_shortiFlags );
  
ewrite_byteiColor[0] );
  
ewrite_byteiColor[1] );
  
ewrite_byteiColor[2] );
  
ewrite_byteiAlpha );
  
emessage_end();
 }
 else {
  
message_beginMSG_DESTgmsgScreenFade_id );
  
write_shortiFadeTime );
  
write_shortFixedUnsigned16flHoldTime 1<<12 ) );
  
write_shortiFlags );
  
write_byteiColor[0] );
  
write_byteiColor[1] );
  
write_byteiColor[2] );
  
write_byteiAlpha );
  
message_end();
 }
}
stock UTIL_FadeToBlack(id,Float:fxtime=3.0,bool:bReliable=false,bool:bExternal=false) {
 
UTIL_ScreenFade(id_fxtimefxtime2550x0001|0x0004,bReliable,bExternal);
}
stock set_weapon_anim(idanim) {
 
set_pev(idpev_weaponanimanim);
 if(
is_user_connected(id)) {
  
message_begin(MSG_ONESVC_WEAPONANIM_id);
  
write_byte(anim);
  
write_byte(pev(idpev_body));
  
message_end();
 }
}
#define clamp_byte(%1)       ( clamp( %1, 0, 255 ) )
#define pack_color(%1,%2,%3) ( %3 + ( %2 << 8 ) + ( %1 << 16 ) )
stock HudMessage(const id, const message[], red 0green 160blue 0Float:= -1.0Float:0.65effects 2Float:fxtime 0.01Float:holdtime 3.0Float:fadeintime 0.01Float:fadeouttime 0.01) {
 new 
count 1players[32];
 
 if(
idplayers[0] = id;
 else 
get_players(playerscount"ch"); {
  for(new 
0counti++) {
   if(
is_user_connected(players[i])) { 
    new 
color pack_color(clamp_byte(red), clamp_byte(green), clamp_byte(blue))
    
    
message_begin(MSG_ONE_UNRELIABLESVC_DIRECTOR_players[i]);
    
write_byte(strlen(message) + 31);
    
write_byte(DRC_CMD_MESSAGE);
    
write_byte(effects);
    
write_long(color);
    
write_long(_:x);
    
write_long(_:y);
    
write_long(_:fadeintime);
    
write_long(_:fadeouttime);
    
write_long(_:holdtime);
    
write_long(_:fxtime);
    
write_string(message);
    
message_end();
   }
  }
 }
}
stock ColorChat(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");
 
 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();
   }
  }
 } 
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/ 


alexclaudiu2003 10-21-2015 07:53

Re: server crash
 
Thx man, but now get to another line :)

Displaying debug trace (plugin "bio_zombie_finger1.amxx")
Run time error 4: index out of bounds
[0] bio_zombie_finger1.sma::FastRunHeartBeat (line 176)

Depresie 10-21-2015 09:44

Re: server crash
 
If you could indend your code for better visibility, i could read it better... anyway try this
PHP Code:

#include <amxmodx>
#include <biohazard>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#define PLUGIN  "[Bio] Zombie: Finger"
#define AUTHOR  "Aragon*"
#define VERSION "1.0"
#define ZOMBIE_NAME "Finger (Run)"     //Zombie Name
#define ZOMBIE_DESC "press G Run" //Zobmie Description
#define ZOMBIE_MODEL "models/player/bio30_finger/bio30_finger.mdl"     //Zombie Model
#define ZOMBIE_CLAWS "models/player/bio30_finger/claws_finger.mdl" //Claws Model
#define ZOMBIE_HEALTH  555.0 //Health value
#define ZOMBIE_SPEED  300.0 //Speed value
#define ZOMBIE_GRAVITY  1.0 //Gravity multiplier
#define ZOMBIE_ATTACK  1.5 //Zombie damage multiplier
#define ZOMBIE_REGENDLY  0.25 //Regeneration delay value
#define ZOMBIE_KNOCKBACK 0.0 //Knockback multiplier
#define TASKID_FASTRUN_HEARTBEAT 12314
#define TASKID_START_POWER  2131
new FastRun_Sound[][] = {
 
"Biohazard30/bio30_finger/pukricide.wav"
}
new const 
Tag[  ] = "[Biohazard]";
new Class, 
FastRun[33], FastRun_Countdown[33]
new 
cvar_fastrun_durationcvar_fastrun_countdowncvar_fastrun_speed;
public 
plugin_init() {         
 
register_plugin(PLUGIN,AUTHOR,VERSION)
 
is_biomod_active() ? plugin_init2() : pause("ad")
}
public 
plugin_init2() {
 Class = 
register_class(ZOMBIE_NAMEZOMBIE_DESC )
 
 
set_class_pmodel(Class, ZOMBIE_MODEL)
 
set_class_wmodel(Class, ZOMBIE_CLAWS)
 
 
set_class_data(Class, DATA_HEALTHZOMBIE_HEALTH);
 
set_class_data(Class, DATA_SPEEDZOMBIE_SPEED);
 
set_class_data(Class, DATA_GRAVITYZOMBIE_GRAVITY);
 
set_class_data(Class, DATA_ATTACKZOMBIE_ATTACK);
 
set_class_data(Class, DATA_REGENDLYZOMBIE_REGENDLY);
 
set_class_data(Class, DATA_KNOCKBACKZOMBIE_KNOCKBACK);
 
 
register_clcmd"drop""CMD_FastRun");
 
 
register_event("DeathMsg""EVENT_Death""a")
 
 
register_forward(FM_PlayerPreThink,"FWD_PlayerPreThink")
 
 
RegisterHam(Ham_Spawn"player""HAM_Spawn_Post"1);
 
 
cvar_fastrun_duration register_cvar("bio_fastrun_duration""13.0")
 
cvar_fastrun_countdown register_cvar("bio_fastrun_countdown""7.0")
 
cvar_fastrun_speed register_cvar("bio_fastrun_speed""500.0")  
}
public 
plugin_precache() {
 
precache_model(ZOMBIE_CLAWS)
 
precache_model(ZOMBIE_MODEL)
 
 for(new 
0sizeof FastRun_Soundi++ )
  
precache_sound(FastRun_Sound[i]);
}
public 
client_disconect(id)
{
         
remove_task(id TASKID_FASTRUN_HEARTBEAT)
    
remove_task(id)
}
public 
EVENT_Death() {
 
FastRun[read_data(2)] = 0
 FastRun_Countdown
[read_data(2)] = 0
 remove_task
(read_data(2) + TASKID_FASTRUN_HEARTBEAT)
}
public 
event_infect(victimattacker) {
 if(
get_user_class(victim) == Class) {
  
FastRun[victim] = 0
  FastRun_Countdown
[victim] = 0
  remove_task
(victim TASKID_FASTRUN_HEARTBEAT)
  
ColorChat(victim"^x04%s^x01 Pentru a folosi^x03 ultra viteza^x01 apasa tasta^x03 G^x01."Tag)
 }
}
public 
FWD_PlayerPreThink(id) {
 if(
is_user_alive(id) && FastRun[id]) {
  if(
fm_get_user_maxspeed(id) < get_pcvar_float(cvar_fastrun_speed) && fm_get_user_maxspeed(id) > 1.0)
   
fm_set_user_maxspeed(idget_pcvar_float(cvar_fastrun_speed))
 }
 if(
get_user_weapon(id) != CSW_KNIFE && task_exists(id TASKID_START_POWER))
  
remove_task(id TASKID_START_POWER)
}
public 
HAM_Spawn_Post(id) { 
 
FastRun[id] = 0
 FastRun_Countdown
[id] = 0
 remove_task
(id TASKID_FASTRUN_HEARTBEAT)
}
public 
CMD_FastRun(id) {
 new 
Float:NextAttack get_pdata_float(id835);
 if(
is_user_alive(id) && get_user_class(id) == Class && is_user_zombie(id) && get_user_weapon(id) == CSW_KNIFE && NextAttack <= 0.0) {
  if(!
FastRun[id] && !FastRun_Countdown[id]) {
   
set_pdata_float(id831.65);
   
set_weapon_anim(id9)
   
set_task(1.50"StartRun"id TASKID_START_POWER);
  }
  return 
PLUGIN_HANDLED
 
}
 return 
PLUGIN_CONTINUE
}
public 
StartRun(id) {
 
id -= TASKID_START_POWER
 
 
if(!is_user_connected(id))
 {
     return;
 }
 
engclient_cmd(id"weapon_knife");
 
set_pdata_float(id831.565);
 
set_weapon_anim(id10)
 
EffectFastrun(id95)
 
emit_sound(idCHAN_VOICEFastRun_Sound[0], 1.0ATTN_NORM0PITCH_NORM)
 
set_task(2.0"FastRunHeartBeat"id TASKID_FASTRUN_HEARTBEAT__"b")
 
FastRun[id] = get_pcvar_num(cvar_fastrun_duration);
 
 if(
FastRun[id]) {
  new 
Message[256];
  
formatex(Message,sizeof(Message)-1,"Fast Run^n(%d second%s remaining).",FastRun[id], FastRun[id] > "s" "");
  
  
HudMessage(idMessage_______0.9);
  
set_task(1.0"TASK_CountDown"id);
 }
}
public 
TASK_CountDown(id) {
 if (!
is_user_alive(id) || !is_user_zombie(id) || get_user_class(id) != Class) {
  
FastRun[id] = 0
 
}
 else if(
is_user_alive(id) && FastRun[id] > 1) {
  
FastRun[id] --;
  new 
Message[256];
  
formatex(Message,sizeof(Message)-1,"Fast Run^n(%d second%s remaining).",FastRun[id], FastRun[id] > "s" "");
  
  
HudMessage(idMessage_______0.9);
  
set_task(1.0"TASK_CountDown"id);
 }
 else if(
FastRun[id] <= 1) {
  
FastRun[id] = 0
  remove_task
(id TASKID_FASTRUN_HEARTBEAT)
  
fm_set_user_maxspeed(idZOMBIE_SPEED)
  
EffectFastrun(id)
  
  
FastRun_Countdown[id] = get_pcvar_num(cvar_fastrun_countdown)
  
  if(
FastRun_Countdown[id]) {
   new 
Message[256];
   
formatex(Message,sizeof(Message)-1,"Fast Run not ready.^n(%d second%s remaining).",FastRun_Countdown[id], FastRun_Countdown[id] > "s" "");
   
   
HudMessage(idMessage_______0.9);
   
set_task(1.0"TASK_CountDown2"id);
  }
 }
}
public 
TASK_CountDown2(id) {
 if (!
is_user_alive(id) || !is_user_zombie(id) || get_user_class(id) != Class)
  
FastRun_Countdown[id] = 0
 
else if(is_user_alive(id) && FastRun_Countdown[id] > 1) {
  
FastRun_Countdown[id] --;
  new 
Message[256];
  
formatex(Message,sizeof(Message)-1,"Fast Run not ready.^n(%d second%s remaining).",FastRun_Countdown[id], FastRun_Countdown[id] > "s" "");
  
  
HudMessage(idMessage_______0.9);
  
set_task(1.0"TASK_CountDown2"id);
 }
 else if(
FastRun_Countdown[id] <= 1) {
  new 
Message[256];
  
formatex(Message,sizeof(Message)-1,"Fast Run is ready.");
  
  
HudMessage(idMessage_______0.9);
  
FastRun_Countdown[id] = 0;
 }
}
public 
FastRunHeartBeat(id) {
 
id -= TASKID_FASTRUN_HEARTBEAT
 
 
if (is_user_connected(id) && FastRun[id]) 
 {
   
emit_sound(idCHAN_VOICEFastRun_Sound[random_num(1sizeof FastRun_Sound 1)], 1.0ATTN_NORM0PITCH_NORM)
  
   new 
Color[3]
   
Color[0] = 200
   Color
[1] = 0
   Color
[2] = 0
   
   UTIL_ScreenFade
(idColor0.50.5125)
   
 }
}
EffectFastrun(idnum 90) {
 if(
is_user_connected(id)) {
  
message_begin(MSG_ONEget_user_msgid("SetFOV"), {0,0,0}, id)
  
write_byte(num)
  
message_end()
 }
}
stock FixedUnsigned16(Float:flValueiScale) {
 new 
iOutput;
 
 
iOutput floatround(flValue iScale);
 if ( 
iOutput )
  
iOutput 0;
 
 if ( 
iOutput 0xFFFF )
  
iOutput 0xFFFF;
 return 
iOutput;
}
stock UTIL_ScreenFade(id=0,iColor[3]={0,0,0},Float:flFxTime=-1.0,Float:flHoldTime=0.0,iAlpha=0,iFlags=0x0000,bool:bReliable=false,bool:bExternal=false) {
 if( 
id && !is_user_connected(id))
  return;
 
 new 
iFadeTime;
 if( 
flFxTime == -1.0 ) {
  
iFadeTime 4;
 }
 else {
  
iFadeTime FixedUnsigned16flFxTime 1<<12 );
 }
 
 static 
gmsgScreenFade;
 if( !
gmsgScreenFade ) {
  
gmsgScreenFade get_user_msgid("ScreenFade");
 }
 
 new 
MSG_DEST;
 if( 
bReliable ) {
  
MSG_DEST id MSG_ONE MSG_ALL;
 }
 else {
  
MSG_DEST id MSG_ONE_UNRELIABLE MSG_BROADCAST;
 }
 
 if( 
bExternal ) {
  
emessage_beginMSG_DESTgmsgScreenFade_id );
  
ewrite_shortiFadeTime );
  
ewrite_shortFixedUnsigned16flHoldTime 1<<12 ) );
  
ewrite_shortiFlags );
  
ewrite_byteiColor[0] );
  
ewrite_byteiColor[1] );
  
ewrite_byteiColor[2] );
  
ewrite_byteiAlpha );
  
emessage_end();
 }
 else {
  
message_beginMSG_DESTgmsgScreenFade_id );
  
write_shortiFadeTime );
  
write_shortFixedUnsigned16flHoldTime 1<<12 ) );
  
write_shortiFlags );
  
write_byteiColor[0] );
  
write_byteiColor[1] );
  
write_byteiColor[2] );
  
write_byteiAlpha );
  
message_end();
 }
}
stock UTIL_FadeToBlack(id,Float:fxtime=3.0,bool:bReliable=false,bool:bExternal=false) {
 
UTIL_ScreenFade(id_fxtimefxtime2550x0001|0x0004,bReliable,bExternal);
}
stock set_weapon_anim(idanim) {
 
set_pev(idpev_weaponanimanim);
 if(
is_user_connected(id)) {
  
message_begin(MSG_ONESVC_WEAPONANIM_id);
  
write_byte(anim);
  
write_byte(pev(idpev_body));
  
message_end();
 }
}
#define clamp_byte(%1)       ( clamp( %1, 0, 255 ) )
#define pack_color(%1,%2,%3) ( %3 + ( %2 << 8 ) + ( %1 << 16 ) )
stock HudMessage(const id, const message[], red 0green 160blue 0Float:= -1.0Float:0.65effects 2Float:fxtime 0.01Float:holdtime 3.0Float:fadeintime 0.01Float:fadeouttime 0.01) {
 new 
count 1players[32];
 
 if(
idplayers[0] = id;
 else 
get_players(playerscount"ch"); {
  for(new 
0counti++) {
   if(
is_user_connected(players[i])) { 
    new 
color pack_color(clamp_byte(red), clamp_byte(green), clamp_byte(blue))
    
    
message_begin(MSG_ONE_UNRELIABLESVC_DIRECTOR_players[i]);
    
write_byte(strlen(message) + 31);
    
write_byte(DRC_CMD_MESSAGE);
    
write_byte(effects);
    
write_long(color);
    
write_long(_:x);
    
write_long(_:y);
    
write_long(_:fadeintime);
    
write_long(_:fadeouttime);
    
write_long(_:holdtime);
    
write_long(_:fxtime);
    
write_string(message);
    
message_end();
   }
  }
 }
}
stock ColorChat(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");
 
 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();
   }
  }
 } 
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/ 


alexclaudiu2003 10-21-2015 09:58

Re: server crash
 
:)) now moved on line 182
Displaying debug trace (plugin "bio_zombie_finger2.amxx")
L 10/21/2015 - 16:50:42: [AMXX] Run time error 4: index out of bounds
L 10/21/2015 - 16:50:42: [AMXX] [0] bio_zombie_finger2.sma::FastRunHeartBeat (line 182)

Chihuahuax 10-21-2015 10:21

Re: server crash
 
PHP Code:

#include <amxmodx>
#include <biohazard>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#define PLUGIN  "[Bio] Zombie: Finger"
#define AUTHOR  "Aragon*"
#define VERSION "1.0"
#define ZOMBIE_NAME "Finger (Run)"     //Zombie Name
#define ZOMBIE_DESC "press G Run" //Zobmie Description
#define ZOMBIE_MODEL "models/player/bio30_finger/bio30_finger.mdl"     //Zombie Model
#define ZOMBIE_CLAWS "models/player/bio30_finger/claws_finger.mdl" //Claws Model
#define ZOMBIE_HEALTH  555.0 //Health value
#define ZOMBIE_SPEED  300.0 //Speed value
#define ZOMBIE_GRAVITY  1.0 //Gravity multiplier
#define ZOMBIE_ATTACK  1.5 //Zombie damage multiplier
#define ZOMBIE_REGENDLY  0.25 //Regeneration delay value
#define ZOMBIE_KNOCKBACK 0.0 //Knockback multiplier
#define TASKID_FASTRUN_HEARTBEAT 12314
#define TASKID_START_POWER  2131
new const FastRun_Sound[][] = { "Biohazard30/bio30_finger/pukricide.wav" }
new const 
Tag[  ] = "[Biohazard]";
new Class, 
FastRun[33], FastRun_Countdown[33]
new 
cvar_fastrun_durationcvar_fastrun_countdowncvar_fastrun_speed;
public 
plugin_init() {         
 
register_plugin(PLUGIN,AUTHOR,VERSION)
 
is_biomod_active() ? plugin_init2() : pause("ad")
}
public 
plugin_init2() {
 Class = 
register_class(ZOMBIE_NAMEZOMBIE_DESC )
 
 
set_class_pmodel(Class, ZOMBIE_MODEL)
 
set_class_wmodel(Class, ZOMBIE_CLAWS)
 
 
set_class_data(Class, DATA_HEALTHZOMBIE_HEALTH);
 
set_class_data(Class, DATA_SPEEDZOMBIE_SPEED);
 
set_class_data(Class, DATA_GRAVITYZOMBIE_GRAVITY);
 
set_class_data(Class, DATA_ATTACKZOMBIE_ATTACK);
 
set_class_data(Class, DATA_REGENDLYZOMBIE_REGENDLY);
 
set_class_data(Class, DATA_KNOCKBACKZOMBIE_KNOCKBACK);
 
 
register_clcmd"drop""CMD_FastRun");
 
 
register_event("DeathMsg""EVENT_Death""a")
 
 
register_forward(FM_PlayerPreThink,"FWD_PlayerPreThink")
 
 
RegisterHam(Ham_Spawn"player""HAM_Spawn_Post"1);
 
 
cvar_fastrun_duration register_cvar("bio_fastrun_duration""13.0")
 
cvar_fastrun_countdown register_cvar("bio_fastrun_countdown""7.0")
 
cvar_fastrun_speed register_cvar("bio_fastrun_speed""500.0")  
}
public 
plugin_precache() {
 
precache_model(ZOMBIE_CLAWS)
 
precache_model(ZOMBIE_MODEL)
 
 for(new 
0sizeof FastRun_Soundi++)
  
precache_sound(FastRun_Sound[i]);
}
public 
client_disconect(id)
{
         
remove_task(id TASKID_FASTRUN_HEARTBEAT)
}
public 
EVENT_Death() {
 
FastRun[read_data(2)] = 0
 FastRun_Countdown
[read_data(2)] = 0
 remove_task
(read_data(2) + TASKID_FASTRUN_HEARTBEAT)
}
public 
event_infect(victimattacker) {
 if(
get_user_class(victim) == Class) {
  
FastRun[victim] = 0
  FastRun_Countdown
[victim] = 0
  remove_task
(victim TASKID_FASTRUN_HEARTBEAT)
  
ColorChat(victim"^x04%s^x01 Pentru a folosi^x03 ultra viteza^x01 apasa tasta^x03 G^x01."Tag)
 }
}
public 
FWD_PlayerPreThink(id) {
 if(
is_user_alive(id) && FastRun[id]) {
  if(
fm_get_user_maxspeed(id) < get_pcvar_float(cvar_fastrun_speed) && fm_get_user_maxspeed(id) > 1.0)
   
fm_set_user_maxspeed(idget_pcvar_float(cvar_fastrun_speed))
 }
 if(
get_user_weapon(id) != CSW_KNIFE && task_exists(id TASKID_START_POWER))
  
remove_task(id TASKID_START_POWER)
}
public 
HAM_Spawn_Post(id) { 
 
FastRun[id] = 0
 FastRun_Countdown
[id] = 0
 remove_task
(id TASKID_FASTRUN_HEARTBEAT)
}
public 
CMD_FastRun(id) {
 new 
Float:NextAttack get_pdata_float(id835);
 if(
is_user_alive(id) && get_user_class(id) == Class && is_user_zombie(id) && get_user_weapon(id) == CSW_KNIFE && NextAttack <= 0.0) {
  if(!
FastRun[id] && !FastRun_Countdown[id]) {
   
set_pdata_float(id831.65);
   
set_weapon_anim(id9)
   
set_task(1.50"StartRun"id TASKID_START_POWER);
  }
  return 
PLUGIN_HANDLED
 
}
 return 
PLUGIN_CONTINUE
}
public 
StartRun(id) {
 
id -= TASKID_START_POWER
 
 engclient_cmd
(id"weapon_knife");
 
set_pdata_float(id831.565);
 
set_weapon_anim(id10)
 
EffectFastrun(id95)
 
emit_sound(idCHAN_VOICEFastRun_Sound[0], 1.0ATTN_NORM0PITCH_NORM)
 
set_task(2.0"FastRunHeartBeat"id TASKID_FASTRUN_HEARTBEAT__"b")
 
FastRun[id] = get_pcvar_num(cvar_fastrun_duration);
 
 if(
FastRun[id]) {
  new 
Message[256];
  
formatex(Message,sizeof(Message)-1,"Fast Run^n(%d second%s remaining).",FastRun[id], FastRun[id] > "s" "");
  
  
HudMessage(idMessage_______0.9);
  
set_task(1.0"TASK_CountDown"id);
 }
}
public 
TASK_CountDown(id) {
 if (!
is_user_alive(id) || !is_user_zombie(id) || get_user_class(id) != Class) {
  
FastRun[id] = 0
 
}
 else if(
is_user_alive(id) && FastRun[id] > 1) {
  
FastRun[id] --;
  new 
Message[256];
  
formatex(Message,sizeof(Message)-1,"Fast Run^n(%d second%s remaining).",FastRun[id], FastRun[id] > "s" "");
  
  
HudMessage(idMessage_______0.9);
  
set_task(1.0"TASK_CountDown"id);
 }
 else if(
FastRun[id] <= 1) {
  
FastRun[id] = 0
  remove_task
(id TASKID_FASTRUN_HEARTBEAT)
  
fm_set_user_maxspeed(idZOMBIE_SPEED)
  
EffectFastrun(id)
  
  
FastRun_Countdown[id] = get_pcvar_num(cvar_fastrun_countdown)
  
  if(
FastRun_Countdown[id]) {
   new 
Message[256];
   
formatex(Message,sizeof(Message)-1,"Fast Run not ready.^n(%d second%s remaining).",FastRun_Countdown[id], FastRun_Countdown[id] > "s" "");
   
   
HudMessage(idMessage_______0.9);
   
set_task(1.0"TASK_CountDown2"id);
  }
 }
}
public 
TASK_CountDown2(id) {
 if (!
is_user_alive(id) || !is_user_zombie(id) || get_user_class(id) != Class)
  
FastRun_Countdown[id] = 0
 
else if(is_user_alive(id) && FastRun_Countdown[id] > 1) {
  
FastRun_Countdown[id] --;
  new 
Message[256];
  
formatex(Message,sizeof(Message)-1,"Fast Run not ready.^n(%d second%s remaining).",FastRun_Countdown[id], FastRun_Countdown[id] > "s" "");
  
  
HudMessage(idMessage_______0.9);
  
set_task(1.0"TASK_CountDown2"id);
 }
 else if(
FastRun_Countdown[id] <= 1) {
  new 
Message[256];
  
formatex(Message,sizeof(Message)-1,"Fast Run is ready.");
  
  
HudMessage(idMessage_______0.9);
  
FastRun_Countdown[id] = 0;
 }
}
public 
FastRunHeartBeat(id) {
 
id -= TASKID_FASTRUN_HEARTBEAT
 
 
if (is_user_connected(id) && FastRun[id]) {
  
emit_sound(idCHAN_VOICEFastRun_Sound[0], 1.0ATTN_NORM0PITCH_NORM)
  
  if(
is_user_connected(id)) {
   new 
Color[3]
   
Color[0] = 200
   Color
[1] = 0
   Color
[2] = 0
   
   UTIL_ScreenFade
(idColor0.50.5125)
   
  }
 }
}
EffectFastrun(idnum 90) {
 if(
is_user_connected(id)) {
  
message_begin(MSG_ONEget_user_msgid("SetFOV"), {0,0,0}, id)
  
write_byte(num)
  
message_end()
 }
}
stock FixedUnsigned16(Float:flValueiScale) {
 new 
iOutput;
 
 
iOutput floatround(flValue iScale);
 if ( 
iOutput )
  
iOutput 0;
 
 if ( 
iOutput 0xFFFF )
  
iOutput 0xFFFF;
 return 
iOutput;
}
stock UTIL_ScreenFade(id=0,iColor[3]={0,0,0},Float:flFxTime=-1.0,Float:flHoldTime=0.0,iAlpha=0,iFlags=0x0000,bool:bReliable=false,bool:bExternal=false) {
 if( 
id && !is_user_connected(id))
  return;
 
 new 
iFadeTime;
 if( 
flFxTime == -1.0 ) {
  
iFadeTime 4;
 }
 else {
  
iFadeTime FixedUnsigned16flFxTime 1<<12 );
 }
 
 static 
gmsgScreenFade;
 if( !
gmsgScreenFade ) {
  
gmsgScreenFade get_user_msgid("ScreenFade");
 }
 
 new 
MSG_DEST;
 if( 
bReliable ) {
  
MSG_DEST id MSG_ONE MSG_ALL;
 }
 else {
  
MSG_DEST id MSG_ONE_UNRELIABLE MSG_BROADCAST;
 }
 
 if( 
bExternal ) {
  
emessage_beginMSG_DESTgmsgScreenFade_id );
  
ewrite_shortiFadeTime );
  
ewrite_shortFixedUnsigned16flHoldTime 1<<12 ) );
  
ewrite_shortiFlags );
  
ewrite_byteiColor[0] );
  
ewrite_byteiColor[1] );
  
ewrite_byteiColor[2] );
  
ewrite_byteiAlpha );
  
emessage_end();
 }
 else {
  
message_beginMSG_DESTgmsgScreenFade_id );
  
write_shortiFadeTime );
  
write_shortFixedUnsigned16flHoldTime 1<<12 ) );
  
write_shortiFlags );
  
write_byteiColor[0] );
  
write_byteiColor[1] );
  
write_byteiColor[2] );
  
write_byteiAlpha );
  
message_end();
 }
}
stock UTIL_FadeToBlack(id,Float:fxtime=3.0,bool:bReliable=false,bool:bExternal=false) {
 
UTIL_ScreenFade(id_fxtimefxtime2550x0001|0x0004,bReliable,bExternal);
}
stock set_weapon_anim(idanim) {
 
set_pev(idpev_weaponanimanim);
 if(
is_user_connected(id)) {
  
message_begin(MSG_ONESVC_WEAPONANIM_id);
  
write_byte(anim);
  
write_byte(pev(idpev_body));
  
message_end();
 }
}
#define clamp_byte(%1)       ( clamp( %1, 0, 255 ) )
#define pack_color(%1,%2,%3) ( %3 + ( %2 << 8 ) + ( %1 << 16 ) )
stock HudMessage(const id, const message[], red 0green 160blue 0Float:= -1.0Float:0.65effects 2Float:fxtime 0.01Float:holdtime 3.0Float:fadeintime 0.01Float:fadeouttime 0.01) {
 new 
count 1players[32];
 
 if(
idplayers[0] = id;
 else 
get_players(playerscount"ch"); {
  for(new 
0counti++) {
   if(
is_user_connected(players[i])) { 
    new 
color pack_color(clamp_byte(red), clamp_byte(green), clamp_byte(blue))
    
    
message_begin(MSG_ONE_UNRELIABLESVC_DIRECTOR_players[i]);
    
write_byte(strlen(message) + 31);
    
write_byte(DRC_CMD_MESSAGE);
    
write_byte(effects);
    
write_long(color);
    
write_long(_:x);
    
write_long(_:y);
    
write_long(_:fadeintime);
    
write_long(_:fadeouttime);
    
write_long(_:holdtime);
    
write_long(_:fxtime);
    
write_string(message);
    
message_end();
   }
  }
 }
}
stock ColorChat(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");
 
 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();
   }
  }
 } 
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/ 


alexclaudiu2003 10-21-2015 14:16

Re: server crash
 
No errors in log, but the screen turn red every 2 seconds and fast run music start over :(

alexclaudiu2003 10-23-2015 02:24

Re: server crash
 
anyone ?


All times are GMT -4. The time now is 22:03.

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