Raised This Month: $ Target: $400
 0% 

Server crash, rewrited boomer.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
graczu
Senior Member
Join Date: Mar 2006
Old 11-14-2009 , 08:00   Server crash, rewrited boomer.
Reply With Quote #1

Hello,

i was change code in plugin zm_boomer to infect on explode:

http://pastebin.com/m5c86ae84

Code:
#include <amxmodx> 
#include <csx> 
#include <zombieplague>
#include <fakemeta>
#include <engine>
#include <fun>
#include <amxmisc>

#define PLUGINNAME        "[ZP] Class Boomer"
#define VERSION           "1.2.2xyz"
#define AUTHOR            "tii, graczu"

new g_zclass_boomer,cvar_max_damage,cvar_damage_radius

new bool:lamuerteexplosiva[33] = false

new const zclass_name[] = { "Boomer" }
new const zclass_info[] = { "HP+ SP- KB++ JP+ | EXPLODE" }
new const zclass_model[] = { "zboomer" }
new const zclass_clawmodel[] = { "v_knife_zombie.mdl" }
const zclass_health = 2020
const zclass_speed = 220
const Float:zclass_gravity = 0.9
const Float:zclass_knockback = 1.2
new zombieInfects[32] = 0;
new infectToAmmoPack = 2;
new infectExtraAmmo = 2;
new g_exploSpr, spr_zerogxplode, spr_smoke_steam1;
// zombie_plague/grenade_infect.wav
public plugin_init(){  
	register_plugin(PLUGINNAME, VERSION, AUTHOR)
	register_event("DeathMsg", "boomer_death", "a")
	cvar_max_damage = register_cvar("zp_bomer_maxdmg","150")
	cvar_damage_radius = register_cvar("zp_bomer_raius","200")
	register_concmd("amx_blast", "cmdTest", ADMIN_KICK, "test command")
}

public plugin_precache() 
{
	g_zclass_boomer = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)    
	precache_sound("weapons/mortarhit.wav")
	precache_model("models/w_egon.mdl")
	precache_model("models/player/zboomer/zboomerT.mdl")
	g_exploSpr = engfunc(EngFunc_PrecacheModel, "sprites/shockwave.spr")
	engfunc(EngFunc_PrecacheSound, "zombie_plague/grenade_infect.wav")
	precache_sound("weapons/mortarhit.wav")
	spr_zerogxplode = precache_model("sprites/zerogxplode.spr")
	spr_smoke_steam1 = precache_model("sprites/steam1.spr")
} 

public cmdTest(id, level, cid)
{
	if (!cmd_access(id, level, cid, 2))
		return PLUGIN_HANDLED

	new arg[32]
	read_argv(1, arg, 31)
	new player = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF)
	
	if (!player)
		return PLUGIN_HANDLED

	emit_sound(player, CHAN_WEAPON, "zombie_plague/grenade_infect.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)

	static Float:originF[3]
	pev(player, pev_origin, originF)
	native_create_blast(originF)

	return PLUGIN_HANDLED
}

public zp_user_infected_post(player, infector)
{
	if (zp_get_user_zombie_class(player) == g_zclass_boomer) {
		lamuerteexplosiva[player] = true
	}
} 

public zp_user_humanized_post(player)
{
	lamuerteexplosiva[player] = false
}

public boomer_death() { 
	new victim = read_data(2)
	if(lamuerteexplosiva[victim] == true){
		if (zp_get_user_zombie_class(victim) == g_zclass_boomer && zp_get_user_zombie(victim) && !zp_get_user_nemesis(victim)){

			static Float:originF[3];
			pev(victim, pev_origin, originF);

			emit_sound(victim, CHAN_WEAPON, "zombie_plague/grenade_infect.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
			emit_sound(victim, CHAN_WEAPON, "weapons/mortarhit.wav", 1.0, 0.5, 0, PITCH_NORM);
			emit_sound(victim, CHAN_VOICE, "weapons/mortarhit.wav", 1.0, 0.5, 0, PITCH_NORM);

			native_create_blast(originF);

			new Max_Damage = get_pcvar_num(cvar_max_damage);
			new Damage_Radius = get_pcvar_num(cvar_damage_radius) ;

			new Distance, Damage;
			zombieInfects[victim] = 0;
			static i;
			i = -1;

			while ((i = engfunc(EngFunc_FindEntityInSphere, i, originF, float(Damage_Radius))) != 0)
			{
				if(is_user_connected(i) && zp_user_alive(i) && !zp_get_user_zombie(i) && i != victim) {
					message_begin(MSG_ONE, get_user_msgid("ScreenShake"), {0,0,0}, i)  // Shake Screen
					write_short(1<<14)
					write_short(1<<14)
					write_short(1<<14)
					message_end()
					Damage = Max_Damage - floatround(floatmul(float(Max_Damage), floatdiv(float(Distance), float(Damage_Radius))))
					do_victim(i, victim, Damage)
				}
			}

			if(zombieInfects[victim] >= infectToAmmoPack){
				zp_set_user_ammo_packs(victim, zp_get_user_ammo_packs(victim) + infectExtraAmmo)
			}
		}
	}
}

public do_victim (victim, attacker, Damage) {
	static victim_name[32]
	get_user_name(victim, victim_name, sizeof victim_name - 1)
	if(Damage >= get_user_health(victim)) {
			if(zp_get_user_mask(victim)){
				zp_set_user_mask(victim, 0);
			} else {
				zp_infect_user(victim);
				zombieInfects[attacker]++;
				native_zp_colored_print(victim, "^x04[ZM]^x01 Zostales zarazony przez boomera!");
				static bufor[512]
				formatex(bufor, sizeof bufor -1, "^x04[ZM]^x01 Zaraziles %s!", victim_name)
				native_zp_colored_print(attacker, bufor);
			}
	} else {
		set_user_health(victim, get_user_health(victim) - Damage)
		static bufor[512]
		formatex(bufor, sizeof bufor -1, "^x04[ZM]^x01 Zadales obrazenia %i dla %s!", Damage, victim_name)
		native_zp_colored_print(attacker, bufor);
	}
	
}

public client_disconnect(id) 
{
    lamuerteexplosiva[id] = false
}  

public client_putinserver(id) 
{
    lamuerteexplosiva[id] = false
} 

public native_zp_colored_print(target, const message[])
{	
	// Send to everyone
	if (!target)
	{
		static player
		static g_maxplayers
		g_maxplayers = get_maxplayers()
		for (player = 1; player <= g_maxplayers; player++)
		{
			// Not connected
			if (!zp_user_connected(player))
				continue;
			
			// Send it
			message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, player)
			write_byte(player)
			write_string(message)
			message_end()
			
		}
	}
	else if(zp_user_connected(target))
	{
		
		// Send it
		message_begin(MSG_ONE, get_user_msgid("SayText"), _, target)
		write_byte(target)
		write_string(message)
		message_end()
	}
}

// Infection Bomb: Green Blast
public native_create_blast(const Float:originF[3])
{
	static origin2[3]
	origin2[0] = floatround(originF[0])
	origin2[1] = floatround(originF[1])
	origin2[2] = floatround(originF[2]) 

	for (new e = 1; e < 3; e++) {
		// Random Explosion 8 Times
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
		write_byte(TE_SPRITE);
		write_coord(origin2[0] + random_num(-60,60));
		write_coord(origin2[1] + random_num(-60,60));
		write_coord(origin2[2] +128);
		write_short(spr_zerogxplode);
		write_byte(random_num(30,65));
		write_byte(255);
		message_end();

		// Random Smoke 3 Times
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
		write_byte(TE_SMOKE);
		write_coord(origin2[0]);
		write_coord(origin2[1]);
		write_coord(origin2[2] + 256);
		write_short(spr_smoke_steam1);
		write_byte(random_num(80,150));
		write_byte(random_num(5,10));
		message_end();	
	}


	// Smallest ring
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_BEAMCYLINDER) // TE id
	engfunc(EngFunc_WriteCoord, originF[0]) // x
	engfunc(EngFunc_WriteCoord, originF[1]) // y
	engfunc(EngFunc_WriteCoord, originF[2]) // z
	engfunc(EngFunc_WriteCoord, originF[0]) // x axis
	engfunc(EngFunc_WriteCoord, originF[1]) // y axis
	engfunc(EngFunc_WriteCoord, originF[2]+385.0) // z axis
	write_short(g_exploSpr) // sprite
	write_byte(0) // startframe
	write_byte(0) // framerate
	write_byte(4) // life
	write_byte(60) // width
	write_byte(0) // noise
	write_byte(0) // red
	write_byte(200) // green
	write_byte(0) // blue
	write_byte(200) // brightness
	write_byte(0) // speed
	message_end()
	
	// Medium ring
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_BEAMCYLINDER) // TE id
	engfunc(EngFunc_WriteCoord, originF[0]) // x
	engfunc(EngFunc_WriteCoord, originF[1]) // y
	engfunc(EngFunc_WriteCoord, originF[2]) // z
	engfunc(EngFunc_WriteCoord, originF[0]) // x axis
	engfunc(EngFunc_WriteCoord, originF[1]) // y axis
	engfunc(EngFunc_WriteCoord, originF[2]+470.0) // z axis
	write_short(g_exploSpr) // sprite
	write_byte(0) // startframe
	write_byte(0) // framerate
	write_byte(4) // life
	write_byte(60) // width
	write_byte(0) // noise
	write_byte(0) // red
	write_byte(200) // green
	write_byte(0) // blue
	write_byte(200) // brightness
	write_byte(0) // speed
	message_end()
	
	// Largest ring
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_BEAMCYLINDER) // TE id
	engfunc(EngFunc_WriteCoord, originF[0]) // x
	engfunc(EngFunc_WriteCoord, originF[1]) // y
	engfunc(EngFunc_WriteCoord, originF[2]) // z
	engfunc(EngFunc_WriteCoord, originF[0]) // x axis
	engfunc(EngFunc_WriteCoord, originF[1]) // y axis
	engfunc(EngFunc_WriteCoord, originF[2]+555.0) // z axis
	write_short(g_exploSpr) // sprite
	write_byte(0) // startframe
	write_byte(0) // framerate
	write_byte(4) // life
	write_byte(60) // width
	write_byte(0) // noise
	write_byte(0) // red
	write_byte(200) // green
	write_byte(0) // blue
	write_byte(200) // brightness
	write_byte(0) // speed
	message_end()
}
and sometimes when boomer blow i have this error in amxx logs and server crash:

Code:
L 11/16/2009 - 17:24:20: [FAKEMETA] Invalid entity
L 11/16/2009 - 17:24:20: [AMXX] Displaying debug trace (plugin "zombie_plague40.amxx")
L 11/16/2009 - 17:24:20: [AMXX] Run time error 10: native error (native "engfunc")
L 11/16/2009 - 17:24:20: [AMXX]    [0] zombie_plague40.sma::fm_strip_user_weapons (line 10263)
L 11/16/2009 - 17:24:20: [AMXX]    [1] zombie_plague40.sma::zombieme (line 5434)
L 11/16/2009 - 17:24:20: [AMXX]    [2] zombie_plague40.sma::native_infect_user (line 8912)
L 11/16/2009 - 17:24:20: Unhandled dynamic native error
L 11/16/2009 - 17:24:20: [AMXX] Displaying debug trace (plugin "zp_zclass_boomer.amxx")
L 11/16/2009 - 17:24:20: [AMXX] Run time error 10: native error (native "engfunc")
L 11/16/2009 - 17:24:20: [AMXX]    [0] zp_zclass_boomer.sma::do_victim (line 134)
L 11/16/2009 - 17:24:20: [AMXX]    [1] zp_zclass_boomer.sma::boomer_death (line 115)
Code:
public native_user_connected(id){
	return g_isconnected[id];
}

public native_user_alive(id){
	return is_user_valid_alive(id);
}
Code:
native zp_user_connected(id)
native zp_user_alive(id)
__________________

Last edited by graczu; 11-16-2009 at 11:55.
graczu is offline
Shoul
BANNED
Join Date: Aug 2009
Location: VietNam
Old 11-14-2009 , 08:39   Re: Server crash, rewrited boomer.
Reply With Quote #2

Holy crab , your zboomer's skin have modelT.mdl ? This will crash ur server ...
Shoul is offline
graczu
Senior Member
Join Date: Mar 2006
Old 11-14-2009 , 08:43   Re: Server crash, rewrited boomer.
Reply With Quote #3

Quote:
Originally Posted by Shoul View Post
Holy crab , your zboomer's skin have modelT.mdl ? This will crash ur server ...
I think this isnt the reason of crash, this model is about moth, and server wasent crash before i do changes in plugin.

Error says that we have problem here:

Code:
L 11/14/2009 - 13:50:40: [AMXX] Displaying debug trace (plugin "zombie_plague40.amxx")
L 11/14/2009 - 13:50:40: [AMXX] Run time error 10: native error (native "engfunc")
L 11/14/2009 - 13:50:40: [AMXX]    [0] zombie_plague40.sma::fm_strip_user_weapons (line 10231)
fm_strip_user_weapons function looks this:

Code:
// Strip user weapons (from fakemeta_util)
stock fm_strip_user_weapons(id)
{
	static ent
	ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "player_weaponstrip"))
	if (!pev_valid(ent)) return;
	
	dllfunc(DLLFunc_Spawn, ent)
	dllfunc(DLLFunc_Use, ent, id)
	engfunc(EngFunc_RemoveEntity, ent)
}
and error is on this: engfunc(EngFunc_RemoveEntity, ent), but why, i just turning players into zombie.... and they id's as ent is good, i checking that are they connected, alive, bla bla bla ;-(
__________________

Last edited by graczu; 11-14-2009 at 15:07.
graczu is offline
Shoul
BANNED
Join Date: Aug 2009
Location: VietNam
Old 11-14-2009 , 21:01   Re: Server crash, rewrited boomer.
Reply With Quote #4

Hey , today my server is crashes by a boomer .... It will crashes when the boomers exploded with lasermines .... that's all ..
Shoul is offline
graczu
Senior Member
Join Date: Mar 2006
Old 11-15-2009 , 07:20   Re: Server crash, rewrited boomer.
Reply With Quote #5

Quote:
Originally Posted by Shoul View Post
Hey , today my server is crashes by a boomer .... It will crashes when the boomers exploded with lasermines .... that's all ..
Hmhmhm,,, i will check this today, if it's true i will add code to lasermine plugin that laser can only do domanage to 1 HP.
__________________
graczu is offline
Shoul
BANNED
Join Date: Aug 2009
Location: VietNam
Old 11-15-2009 , 08:07   Re: Server crash, rewrited boomer.
Reply With Quote #6

Today , that problem make my server scrashed 4 times , and when i deleted boomer's plugin , it's not crashes any more....
Shoul is offline
graczu
Senior Member
Join Date: Mar 2006
Old 11-16-2009 , 11:29   Re: Server crash, rewrited boomer.
Reply With Quote #7

I changed model of boomer to source_zombie, and crashing dont stop...

anyone from develop team have any idea why it's crashing?.
__________________

Last edited by graczu; 11-16-2009 at 11:55.
graczu is offline
Reply



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 01:19.


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