Оправяне на грешка memory access

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Аватар
EMOTO2.COM
Извън линия
Потребител
Потребител
Мнения: 344
Регистриран на: 11 Яну 2018, 17:02
Се отблагодари: 26 пъти
Получена благодарност: 31 пъти
Обратна връзка:

Оправяне на грешка memory access

Мнение от EMOTO2.COM » 11 Апр 2020, 22:05

Сървъра изкарва следната грешка в лога след debug:

Код за потвърждение: Избери целия код

Run time error 5: memory access
[0] zp_extra_pipe_bomb.sma::fw_SetModel (line 200)
Кода:

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <engine>
#include <fun>
#include <cstrike>
#include <zombie_plague_special>

const m_pPlayer = 41;
new const NADE_TYPE_PIPE = 4327;
new const NADE_DURATION_PIPE = pev_flSwimTime;
new const g_trailspr[] ="sprites/laserbeam.spr";
new const g_firespr[] = "sprites/zerogxplode.spr";
new const g_sound[] = "emoto2/pipe_bomb.wav";
new const g_vmodel[] = "models/emoto2/v_pipe.mdl";
new const g_pmodel[] = "models/emoto2/p_pipe.mdl";
new const g_wmodel[] = "models/emoto2/w_pipe.mdl";
new const g_vflare[] = "models/emoto2/v_grenade_flare.mdl";
new const g_extra_pipe[] = { "Pipe bomb" };
new const g_extra_shield[] = { "Anti pipe bomb" };
new cvar_duration, cvar_radius, cvar_enabled, cvar_sound, cvar_cost, cvar_mode, cvar_hud, cvar_damage, cvar_speed, cvar_shake, cvar_Scost, cvar_Senabled, cvar_Shud;
new g_msgsync, g_trail, g_ring, g_fire, g_score, g_death, g_shake, g_pipe, bool: g_has_pipe[33], bool: g_has_shield[33], g_mshield;

public plugin_init() {
	register_plugin("Extra item pipe bomb", "0.5", "4eRT");
	register_forward(FM_SetModel,"fw_SetModel", 1);
	register_dictionary("zp_extra_pipe_bomb.txt");
	RegisterHam(Ham_Think, "grenade", "fw_ThinkGren");
	RegisterHam(Ham_Spawn, "player", "fw_Spawn");
	RegisterHam(Ham_Item_Deploy, "weapon_smokegrenade", "fw_smDeploy", 1);
	
	cvar_duration = register_cvar("zp_pipe_duration", "5");
	cvar_radius = register_cvar ( "zp_pipe_radius", "120");
	cvar_enabled = register_cvar("zp_pipe_enabled", "1");
	cvar_cost = register_cvar("zp_pipe_cost", "12");
	cvar_mode = register_cvar("zp_pipe_mode", "1");
	cvar_sound = register_cvar("zp_pipe_sound", "1");
	cvar_hud = register_cvar("zp_pipe_hud", "1");
	cvar_damage = register_cvar("zp_pipe_damage", "2000");
	cvar_speed = register_cvar("zp_pipe_speed", "90.0");
	cvar_shake = register_cvar("zp_pipe_shake", "1");
	cvar_Scost = register_cvar("zp_mshield_cost", "5");
	cvar_Senabled = register_cvar("zp_mshield_enabled", "1");
	cvar_Shud = register_cvar("zp_mshield_hud", "1");
	
	if(get_pcvar_num(cvar_enabled))
		g_pipe = zp_register_extra_item(g_extra_pipe, get_pcvar_num(cvar_cost), ZP_TEAM_HUMAN);
	
	if(get_pcvar_num(cvar_Senabled))
		g_mshield = zp_register_extra_item(g_extra_shield, get_pcvar_num(cvar_Scost), ZP_TEAM_ZOMBIE);
	
	g_msgsync = CreateHudSyncObj();
	g_score = get_user_msgid("ScoreInfo");
	g_death = get_user_msgid("DeathMsg");
	g_shake = get_user_msgid("ScreenShake");
}

public plugin_precache() {
	precache_model(g_vmodel);
	precache_model(g_pmodel);
	precache_model(g_wmodel);
	precache_model(g_vflare);
	precache_sound(g_sound);
	g_fire = precache_model(g_firespr);
	g_trail = precache_model(g_trailspr);
}

public replace_models(id)
{
	if(get_user_weapon(id) == CSW_SMOKEGRENADE)
	{
		set_pev(id, pev_viewmodel2, g_vmodel);
		set_pev(id, pev_weaponmodel2, g_pmodel);
	}
}

public replace_models2(id)
	if(get_user_weapon(id) == CSW_SMOKEGRENADE)
		set_pev(id, pev_viewmodel2, g_vflare);

public fw_smDeploy(const iEntity)
{
	if(pev_valid(iEntity) != 2)
		return HAM_IGNORED;
    
	new id = get_pdata_cbase(iEntity, m_pPlayer, 4);
    
	if(g_has_pipe[id] && !zp_get_user_zombie(id) && is_user_alive(id))
	{
		set_pev(id, pev_viewmodel2, g_vmodel);
		set_pev(id, pev_weaponmodel2, g_pmodel);
	}
    
	return HAM_IGNORED;
}

public zp_extra_item_selected(id, item)
{
	if(item == g_pipe)
	{
		if(!get_pcvar_num(cvar_enabled))
		{
			client_print(id, print_chat, "[EMOTO2.COM] %L", id, "DISABLED");
			return ZP_PLUGIN_HANDLED;
		}
		
		if(g_has_pipe[id])
		{
			if(get_pcvar_num(cvar_hud) == 1)
			{
				set_hudmessage(255, 0, 0, -1.0, 0.55, 0, 0.0, 2.0, 2.0, 1.0, -1);
				ShowSyncHudMsg(id, g_msgsync, "%L", id, "ALREADY_HUMAN");
			}
			else
				client_print(id, print_chat, "[EMOTO2.COM] %L", id, "ALREADY_HUMAN");
	
			return ZP_PLUGIN_HANDLED;
		}
	
		g_has_pipe[id] = true;
		new was = cs_get_user_bpammo(id, CSW_SMOKEGRENADE);

		if(was >= 1)
			cs_set_user_bpammo(id, CSW_SMOKEGRENADE, was + 1);
		else
			give_item(id, "weapon_smokegrenade");
		
		replace_models(id);
		
		if(get_pcvar_num(cvar_hud) == 1)
		{
			new msg[32], hud = random_num(0, 1);
	
			if(hud == 0)
				formatex(msg, 31, "%L", id, "DANGEROUS");
			else
				formatex(msg, 31, "%L", id, "GO_EXPLOSIVE");
	
			set_hudmessage(255, 0, 0, -1.0, 0.55, 0, 0.0, 3.0, 2.0, 1.0, -1);
			ShowSyncHudMsg(id, g_msgsync, "%s", msg);
		}
	}
	
	if(item == g_mshield)
	{
		if(!get_pcvar_num(cvar_Senabled))
		{
			client_print(id, print_chat, "[EMOTO2.COM] %L", id, "MS_DISABLED");
			return ZP_PLUGIN_HANDLED;
		}
		
		if(g_has_shield[id])
		{
			if(get_pcvar_num(cvar_Shud))
			{
				set_hudmessage(255, 0, 0, -1.0, 0.55, 0, 0.0, 2.0, 2.0, 1.0, -1);
				ShowSyncHudMsg(id, g_msgsync, "%L", id, "ALREADY_ZOMBIE");
			}
			else
				client_print(id, print_chat, "[EMOTO2.COM] %L", id, "ALREADY_ZOMBIE");
		
			return ZP_PLUGIN_HANDLED;
		}
	
		g_has_shield[id] = true;
	
		if(get_pcvar_num(cvar_Shud))
		{
			set_hudmessage(255, 0, 0, -1.0, 0.55, 0, 0.0, 3.0, 2.0, 1.0, -1);
			ShowSyncHudMsg(id, g_msgsync, "%L", id, "PROTECTED");
		}
		else
			client_print(id, print_chat, "[EMOTO2.COM] %L", id, "PROTECTED");
	}
	
	return PLUGIN_CONTINUE;
}

public zp_user_infected_post(id)
{
	g_has_pipe[id] = false;
	g_has_shield[id] = false;
}
		
public fw_Spawn(id)
{
	g_has_pipe[id] = false;
	g_has_shield[id] = false;
}

public fw_SetModel(entity, const model[])
{
	static Float:dmgtime, owner;
	pev(entity, pev_dmgtime, dmgtime);
	owner = pev(entity, pev_owner);
	
	if(!pev_valid(entity) || dmgtime == 0.0)
		return FMRES_IGNORED;
	
	if (model[9] == 's' && model[10] == 'm' && g_has_pipe[owner])
	{
		g_has_pipe[owner] = false;
		entity_set_model(entity, g_wmodel);
		replace_models2(owner);
		
		set_rendering(entity, kRenderFxGlowShell, 128, 0, 0, kRenderNormal, 16);
		
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
		write_byte(TE_BEAMFOLLOW)
		write_short(entity)
		write_short(g_trail)
		write_byte(10)
		write_byte(10)
		write_byte(128)
		write_byte(0)
		write_byte(0)
		write_byte(255)
		message_end()
		
		set_pev(entity, pev_flTimeStepSound, NADE_TYPE_PIPE);
		
		return FMRES_SUPERCEDE;
	}
	
	return FMRES_IGNORED;
}

public fw_ThinkGren(entity)
{
	if (!pev_valid(entity))
		return HAM_IGNORED;
	
	static Float:dmgtime, Float: current_time, attacker;
	pev(entity, pev_dmgtime, dmgtime);
	current_time = get_gametime();
	attacker = pev(entity, pev_owner);
	
	if(dmgtime > current_time)
		return HAM_IGNORED;
	
	if(pev(entity, pev_flTimeStepSound) == NADE_TYPE_PIPE)
	{
		static duration;
		duration = pev(entity, NADE_DURATION_PIPE);
		
		if (duration > 0)
		{
			new Float:originF[3]
			pev(entity, pev_origin, originF);
			
			if (duration == 1)
			{
				remove_task(entity);
				effect(originF);
				
				if (get_pcvar_num(cvar_mode) == 1)
					kill(originF, attacker);
				
				engfunc(EngFunc_RemoveEntity, entity);
				return HAM_SUPERCEDE;
			}
			
			set_task(0.1, "hook", entity, _, _, "b");
			
			if(get_pcvar_num(cvar_mode) == 2)
				set_task(1.0, "hurt", entity, _, _, "b");
				
			if(get_pcvar_num(cvar_sound))
			{
				if(duration == 2)
					set_task(0.1, "beep", entity, _, _, "b");
				else
					emit_sound(entity, CHAN_WEAPON, g_sound, 1.0, ATTN_NORM, 0, PITCH_HIGH);
			}
			
			set_pev(entity, NADE_DURATION_PIPE, --duration);
			set_pev(entity, pev_dmgtime, current_time + 3.0);
		} else if ((pev(entity, pev_flags) & FL_ONGROUND) && get_speed(entity) < 10)
		{
			set_pev(entity, NADE_DURATION_PIPE, 1 + get_pcvar_num(cvar_duration)/3);
			set_pev(entity, pev_dmgtime, current_time + 0.1);
		} else
			set_pev(entity, pev_dmgtime, current_time + 0.5);
	}
	
	return HAM_IGNORED;
}

public beep(entity)
{
	if (!pev_valid(entity))
	{
		remove_task(entity);
		return;
	}
	
	emit_sound(entity, CHAN_WEAPON, g_sound, 1.0, ATTN_NORM, 0, PITCH_HIGH);
}

public hook(entity)
{
	if (!pev_valid(entity))
	{
		remove_task(entity);
		return;
	}
	
	static Float:originF[3], Float:radius, victim = -1;
	radius = get_pcvar_float(cvar_radius);
	pev(entity, pev_origin, originF);
	
	while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, radius)) != 0)
	{
		if (!is_user_alive(victim) || !zp_get_user_zombie(victim) || g_has_shield[victim])
			continue;

		new Float:fl_Velocity[3];
		new vicOrigin[3], originN[3];

		get_user_origin(victim, vicOrigin);
		originN[0] = floatround(originF[0]);
		originN[1] = floatround(originF[1]);
		originN[2] = floatround(originF[2]);
		
		new distance = get_distance(originN, vicOrigin);

		if (distance > 1)
		{
			new Float:fl_Time = distance / get_pcvar_float(cvar_speed);

			fl_Velocity[0] = (originN[0] - vicOrigin[0]) / fl_Time;
			fl_Velocity[1] = (originN[1] - vicOrigin[1]) / fl_Time;
			fl_Velocity[2] = (originN[2] - vicOrigin[2]) / fl_Time;
		} else
		{
			fl_Velocity[0] = 0.0
			fl_Velocity[1] = 0.0
			fl_Velocity[2] = 0.0
		}

		entity_set_vector(victim, EV_VEC_velocity, fl_Velocity);
		
		if(get_pcvar_num(cvar_shake))
		{
			message_begin(MSG_ONE_UNRELIABLE, g_shake, _, victim)
			write_short(1<<14)
			write_short(1<<14)
			write_short(1<<14)
			message_end()
		}
	}
}

public hurt(entity)
{
	if (!pev_valid(entity))
	{
		remove_task(entity);
		return;
	}
	
	static Float:originF[3], Float:radius, victim = -1;
	radius = get_pcvar_float(cvar_radius)/2.0;
	pev(entity, pev_origin, originF);
	
	while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, radius)) != 0)
	{
		if (!is_user_alive(victim) || !zp_get_user_zombie(victim) || g_has_shield[victim])
			continue;
		
		new Float:dam = get_pcvar_float(cvar_damage);
		
		if(get_user_health(victim) - get_pcvar_float(cvar_damage) > 0)
			fakedamage(victim, "Pipe Bomb", dam, 256);
	}
}

public kill(const Float:originF[3], attacker)
{
	static Float:radius, victim = -1;
	radius = get_pcvar_float(cvar_radius) / 2.0;
	
	while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, radius)) != 0)
	{
		if (!is_user_alive(victim) || !zp_get_user_zombie(victim) || g_has_shield[victim])
			continue;
		
		new Float:dam = get_pcvar_float(cvar_damage);
		set_msg_block(g_death, BLOCK_SET);
		
		fakedamage(victim, "Pipe Bomb", dam, 256);
		zp_set_user_ammo_packs(attacker, zp_get_user_ammo_packs(attacker) + 2);
		
		set_msg_block(g_death, BLOCK_NOT);
		
		if(get_user_health(victim) <= 0 && get_user_flags(attacker) & ADMIN_LEVEL_H)
		{
			SendDeathMsg(attacker, victim);
			
			if(victim != attacker && !zp_get_user_zombie(attacker))
				UpdateFrags(attacker, 1, 1);
			else
				UpdateFrags(attacker, -1, 1);
		}
	}
}

public light(const Float:originF[3], duration)
{
	engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, originF, 0);
	write_byte(TE_DLIGHT);
	engfunc(EngFunc_WriteCoord, originF[0]);
	engfunc(EngFunc_WriteCoord, originF[1]);
	engfunc(EngFunc_WriteCoord, originF[2]);
	write_byte(5);
	write_byte(128);
	write_byte(0);
	write_byte(0);
	write_byte(51);
	write_byte((duration < 2) ? 3 : 0);
	message_end();
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+385.0)
	write_short(g_ring)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(60)
	write_byte(0)
	write_byte(128)
	write_byte(0)
	write_byte(0)
	write_byte(200)
	write_byte(0)
	message_end()
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+470.0)
	write_short(g_ring)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(60)
	write_byte(0)
	write_byte(128)
	write_byte(0)
	write_byte(0)
	write_byte(200)
	write_byte(0)
	message_end()
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+555.0)
	write_short(g_ring)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(60)
	write_byte(0)
	write_byte(128)
	write_byte(0)
	write_byte(0)
	write_byte(200)
	write_byte(0)
	message_end()
}

public effect(const Float:originF[3])
{
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_EXPLOSION)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	write_short(g_fire)
	write_byte(25)
	write_byte(10)
	write_byte(0)
	message_end()
}

UpdateFrags(attacker, frags, scoreboard)
{
	set_pev(attacker, pev_frags, float(pev(attacker, pev_frags) + frags))
	zp_set_user_ammo_packs(attacker, zp_get_user_ammo_packs(attacker) + 1);
	
	if (scoreboard)
	{
		message_begin(MSG_BROADCAST, g_score)
		write_byte(attacker)
		write_short(pev(attacker, pev_frags))
		write_short(get_user_deaths(attacker))
		write_short(0)
		write_short(get_user_team(attacker))
		message_end()
	}
}

SendDeathMsg(attacker, victim)
{
	message_begin(MSG_BROADCAST, g_death)
	write_byte(attacker)
	write_byte(victim)
	write_byte(0)
	write_string("Pipe Bomb")
	message_end()
}
Присъедини се към най-доброто място за игра!
https://emoto2.com/

Аватар
WaLkZ
Извън линия
Администратор
Администратор
Мнения: 799
Регистриран на: 05 Окт 2016, 21:13
Местоположение: Варна
Се отблагодари: 75 пъти
Получена благодарност: 227 пъти
Обратна връзка:

Оправяне на грешка memory access

Мнение от WaLkZ » 12 Апр 2020, 01:53

Я виж така

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <engine>
#include <fun>
#include <cstrike>
#include <zombie_plague_special>

const m_pPlayer = 41;
new const NADE_TYPE_PIPE = 4327;
new const NADE_DURATION_PIPE = pev_flSwimTime;
new const g_trailspr[] ="sprites/laserbeam.spr";
new const g_firespr[] = "sprites/zerogxplode.spr";
new const g_sound[] = "emoto2/pipe_bomb.wav";
new const g_vmodel[] = "models/emoto2/v_pipe.mdl";
new const g_pmodel[] = "models/emoto2/p_pipe.mdl";
new const g_wmodel[] = "models/emoto2/w_pipe.mdl";
new const g_vflare[] = "models/emoto2/v_grenade_flare.mdl";
new const g_extra_pipe[] = { "Pipe bomb" };
new const g_extra_shield[] = { "Anti pipe bomb" };
new cvar_duration, cvar_radius, cvar_enabled, cvar_sound, cvar_cost, cvar_mode, cvar_hud, cvar_damage, cvar_speed, cvar_shake, cvar_Scost, cvar_Senabled, cvar_Shud;
new g_msgsync, g_trail, g_ring, g_fire, g_score, g_death, g_shake, g_pipe, bool: g_has_pipe[33], bool: g_has_shield[33], g_mshield;

public plugin_init() {
	register_plugin("Extra item pipe bomb", "0.5", "4eRT");
	register_forward(FM_SetModel,"fw_SetModel", 1);
	register_dictionary("zp_extra_pipe_bomb.txt");
	RegisterHam(Ham_Think, "grenade", "fw_ThinkGren");
	RegisterHam(Ham_Spawn, "player", "fw_Spawn");
	RegisterHam(Ham_Item_Deploy, "weapon_smokegrenade", "fw_smDeploy", 1);
	
	cvar_duration = register_cvar("zp_pipe_duration", "5");
	cvar_radius = register_cvar ( "zp_pipe_radius", "120");
	cvar_enabled = register_cvar("zp_pipe_enabled", "1");
	cvar_cost = register_cvar("zp_pipe_cost", "12");
	cvar_mode = register_cvar("zp_pipe_mode", "1");
	cvar_sound = register_cvar("zp_pipe_sound", "1");
	cvar_hud = register_cvar("zp_pipe_hud", "1");
	cvar_damage = register_cvar("zp_pipe_damage", "2000");
	cvar_speed = register_cvar("zp_pipe_speed", "90.0");
	cvar_shake = register_cvar("zp_pipe_shake", "1");
	cvar_Scost = register_cvar("zp_mshield_cost", "5");
	cvar_Senabled = register_cvar("zp_mshield_enabled", "1");
	cvar_Shud = register_cvar("zp_mshield_hud", "1");
	
	if(get_pcvar_num(cvar_enabled))
		g_pipe = zp_register_extra_item(g_extra_pipe, get_pcvar_num(cvar_cost), ZP_TEAM_HUMAN);
	
	if(get_pcvar_num(cvar_Senabled))
		g_mshield = zp_register_extra_item(g_extra_shield, get_pcvar_num(cvar_Scost), ZP_TEAM_ZOMBIE);
	
	g_msgsync = CreateHudSyncObj();
	g_score = get_user_msgid("ScoreInfo");
	g_death = get_user_msgid("DeathMsg");
	g_shake = get_user_msgid("ScreenShake");
}

public plugin_precache() {
	precache_model(g_vmodel);
	precache_model(g_pmodel);
	precache_model(g_wmodel);
	precache_model(g_vflare);
	precache_sound(g_sound);
	g_fire = precache_model(g_firespr);
	g_trail = precache_model(g_trailspr);
}

public replace_models(id)
{
	if(get_user_weapon(id) == CSW_SMOKEGRENADE)
	{
		set_pev(id, pev_viewmodel2, g_vmodel);
		set_pev(id, pev_weaponmodel2, g_pmodel);
	}
}

public replace_models2(id)
	if(get_user_weapon(id) == CSW_SMOKEGRENADE)
		set_pev(id, pev_viewmodel2, g_vflare);

public fw_smDeploy(const iEntity)
{
	if(pev_valid(iEntity) != 2)
		return HAM_IGNORED;
    
	new id = get_pdata_cbase(iEntity, m_pPlayer, 4);
    
	if(g_has_pipe[id] && !zp_get_user_zombie(id) && is_user_alive(id))
	{
		set_pev(id, pev_viewmodel2, g_vmodel);
		set_pev(id, pev_weaponmodel2, g_pmodel);
	}
    
	return HAM_IGNORED;
}

public zp_extra_item_selected(id, item)
{
	if(item == g_pipe)
	{
		if(!get_pcvar_num(cvar_enabled))
		{
			client_print(id, print_chat, "[EMOTO2.COM] %L", id, "DISABLED");
			return ZP_PLUGIN_HANDLED;
		}
		
		if(g_has_pipe[id])
		{
			if(get_pcvar_num(cvar_hud) == 1)
			{
				set_hudmessage(255, 0, 0, -1.0, 0.55, 0, 0.0, 2.0, 2.0, 1.0, -1);
				ShowSyncHudMsg(id, g_msgsync, "%L", id, "ALREADY_HUMAN");
			}
			else
				client_print(id, print_chat, "[EMOTO2.COM] %L", id, "ALREADY_HUMAN");
	
			return ZP_PLUGIN_HANDLED;
		}
	
		g_has_pipe[id] = true;
		new was = cs_get_user_bpammo(id, CSW_SMOKEGRENADE);

		if(was >= 1)
			cs_set_user_bpammo(id, CSW_SMOKEGRENADE, was + 1);
		else
			give_item(id, "weapon_smokegrenade");
		
		replace_models(id);
		
		if(get_pcvar_num(cvar_hud) == 1)
		{
			new msg[32], hud = random_num(0, 1);
	
			if(hud == 0)
				formatex(msg, 31, "%L", id, "DANGEROUS");
			else
				formatex(msg, 31, "%L", id, "GO_EXPLOSIVE");
	
			set_hudmessage(255, 0, 0, -1.0, 0.55, 0, 0.0, 3.0, 2.0, 1.0, -1);
			ShowSyncHudMsg(id, g_msgsync, "%s", msg);
		}
	}
	
	if(item == g_mshield)
	{
		if(!get_pcvar_num(cvar_Senabled))
		{
			client_print(id, print_chat, "[EMOTO2.COM] %L", id, "MS_DISABLED");
			return ZP_PLUGIN_HANDLED;
		}
		
		if(g_has_shield[id])
		{
			if(get_pcvar_num(cvar_Shud))
			{
				set_hudmessage(255, 0, 0, -1.0, 0.55, 0, 0.0, 2.0, 2.0, 1.0, -1);
				ShowSyncHudMsg(id, g_msgsync, "%L", id, "ALREADY_ZOMBIE");
			}
			else
				client_print(id, print_chat, "[EMOTO2.COM] %L", id, "ALREADY_ZOMBIE");
		
			return ZP_PLUGIN_HANDLED;
		}
	
		g_has_shield[id] = true;
	
		if(get_pcvar_num(cvar_Shud))
		{
			set_hudmessage(255, 0, 0, -1.0, 0.55, 0, 0.0, 3.0, 2.0, 1.0, -1);
			ShowSyncHudMsg(id, g_msgsync, "%L", id, "PROTECTED");
		}
		else
			client_print(id, print_chat, "[EMOTO2.COM] %L", id, "PROTECTED");
	}
	
	return PLUGIN_CONTINUE;
}

public zp_user_infected_post(id)
{
	g_has_pipe[id] = false;
	g_has_shield[id] = false;
}
		
public fw_Spawn(id)
{
	g_has_pipe[id] = false;
	g_has_shield[id] = false;
}

public fw_SetModel(entity, const model[])
{
	if (strlen(model) < 8)
		return FMRES_IGNORED;

	static Float:dmgtime, owner;
	pev(entity, pev_dmgtime, dmgtime);
	owner = pev(entity, pev_owner);
	
	if(!pev_valid(entity) || dmgtime == 0.0)
		return FMRES_IGNORED;
	
	if (model[9] == 's' && model[10] == 'm' && g_has_pipe[owner])
	{
		g_has_pipe[owner] = false;
		entity_set_model(entity, g_wmodel);
		replace_models2(owner);
		
		set_rendering(entity, kRenderFxGlowShell, 128, 0, 0, kRenderNormal, 16);
		
		message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
		write_byte(TE_BEAMFOLLOW)
		write_short(entity)
		write_short(g_trail)
		write_byte(10)
		write_byte(10)
		write_byte(128)
		write_byte(0)
		write_byte(0)
		write_byte(255)
		message_end()
		
		set_pev(entity, pev_flTimeStepSound, NADE_TYPE_PIPE);
		
		return FMRES_SUPERCEDE;
	}
	
	return FMRES_IGNORED;
}

public fw_ThinkGren(entity)
{
	if (!pev_valid(entity))
		return HAM_IGNORED;
	
	static Float:dmgtime, Float: current_time, attacker;
	pev(entity, pev_dmgtime, dmgtime);
	current_time = get_gametime();
	attacker = pev(entity, pev_owner);
	
	if(dmgtime > current_time)
		return HAM_IGNORED;
	
	if(pev(entity, pev_flTimeStepSound) == NADE_TYPE_PIPE)
	{
		static duration;
		duration = pev(entity, NADE_DURATION_PIPE);
		
		if (duration > 0)
		{
			new Float:originF[3]
			pev(entity, pev_origin, originF);
			
			if (duration == 1)
			{
				remove_task(entity);
				effect(originF);
				
				if (get_pcvar_num(cvar_mode) == 1)
					kill(originF, attacker);
				
				engfunc(EngFunc_RemoveEntity, entity);
				return HAM_SUPERCEDE;
			}
			
			set_task(0.1, "hook", entity, _, _, "b");
			
			if(get_pcvar_num(cvar_mode) == 2)
				set_task(1.0, "hurt", entity, _, _, "b");
				
			if(get_pcvar_num(cvar_sound))
			{
				if(duration == 2)
					set_task(0.1, "beep", entity, _, _, "b");
				else
					emit_sound(entity, CHAN_WEAPON, g_sound, 1.0, ATTN_NORM, 0, PITCH_HIGH);
			}
			
			set_pev(entity, NADE_DURATION_PIPE, --duration);
			set_pev(entity, pev_dmgtime, current_time + 3.0);
		} else if ((pev(entity, pev_flags) & FL_ONGROUND) && get_speed(entity) < 10)
		{
			set_pev(entity, NADE_DURATION_PIPE, 1 + get_pcvar_num(cvar_duration)/3);
			set_pev(entity, pev_dmgtime, current_time + 0.1);
		} else
			set_pev(entity, pev_dmgtime, current_time + 0.5);
	}
	
	return HAM_IGNORED;
}

public beep(entity)
{
	if (!pev_valid(entity))
	{
		remove_task(entity);
		return;
	}
	
	emit_sound(entity, CHAN_WEAPON, g_sound, 1.0, ATTN_NORM, 0, PITCH_HIGH);
}

public hook(entity)
{
	if (!pev_valid(entity))
	{
		remove_task(entity);
		return;
	}
	
	static Float:originF[3], Float:radius, victim = -1;
	radius = get_pcvar_float(cvar_radius);
	pev(entity, pev_origin, originF);
	
	while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, radius)) != 0)
	{
		if (!is_user_alive(victim) || !zp_get_user_zombie(victim) || g_has_shield[victim])
			continue;

		new Float:fl_Velocity[3];
		new vicOrigin[3], originN[3];

		get_user_origin(victim, vicOrigin);
		originN[0] = floatround(originF[0]);
		originN[1] = floatround(originF[1]);
		originN[2] = floatround(originF[2]);
		
		new distance = get_distance(originN, vicOrigin);

		if (distance > 1)
		{
			new Float:fl_Time = distance / get_pcvar_float(cvar_speed);

			fl_Velocity[0] = (originN[0] - vicOrigin[0]) / fl_Time;
			fl_Velocity[1] = (originN[1] - vicOrigin[1]) / fl_Time;
			fl_Velocity[2] = (originN[2] - vicOrigin[2]) / fl_Time;
		} else
		{
			fl_Velocity[0] = 0.0
			fl_Velocity[1] = 0.0
			fl_Velocity[2] = 0.0
		}

		entity_set_vector(victim, EV_VEC_velocity, fl_Velocity);
		
		if(get_pcvar_num(cvar_shake))
		{
			message_begin(MSG_ONE_UNRELIABLE, g_shake, _, victim)
			write_short(1<<14)
			write_short(1<<14)
			write_short(1<<14)
			message_end()
		}
	}
}

public hurt(entity)
{
	if (!pev_valid(entity))
	{
		remove_task(entity);
		return;
	}
	
	static Float:originF[3], Float:radius, victim = -1;
	radius = get_pcvar_float(cvar_radius)/2.0;
	pev(entity, pev_origin, originF);
	
	while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, radius)) != 0)
	{
		if (!is_user_alive(victim) || !zp_get_user_zombie(victim) || g_has_shield[victim])
			continue;
		
		new Float:dam = get_pcvar_float(cvar_damage);
		
		if(get_user_health(victim) - get_pcvar_float(cvar_damage) > 0)
			fakedamage(victim, "Pipe Bomb", dam, 256);
	}
}

public kill(const Float:originF[3], attacker)
{
	static Float:radius, victim = -1;
	radius = get_pcvar_float(cvar_radius) / 2.0;
	
	while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, radius)) != 0)
	{
		if (!is_user_alive(victim) || !zp_get_user_zombie(victim) || g_has_shield[victim])
			continue;
		
		new Float:dam = get_pcvar_float(cvar_damage);
		set_msg_block(g_death, BLOCK_SET);
		
		fakedamage(victim, "Pipe Bomb", dam, 256);
		zp_set_user_ammo_packs(attacker, zp_get_user_ammo_packs(attacker) + 2);
		
		set_msg_block(g_death, BLOCK_NOT);
		
		if(get_user_health(victim) <= 0 && get_user_flags(attacker) & ADMIN_LEVEL_H)
		{
			SendDeathMsg(attacker, victim);
			
			if(victim != attacker && !zp_get_user_zombie(attacker))
				UpdateFrags(attacker, 1, 1);
			else
				UpdateFrags(attacker, -1, 1);
		}
	}
}

public light(const Float:originF[3], duration)
{
	engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, originF, 0);
	write_byte(TE_DLIGHT);
	engfunc(EngFunc_WriteCoord, originF[0]);
	engfunc(EngFunc_WriteCoord, originF[1]);
	engfunc(EngFunc_WriteCoord, originF[2]);
	write_byte(5);
	write_byte(128);
	write_byte(0);
	write_byte(0);
	write_byte(51);
	write_byte((duration < 2) ? 3 : 0);
	message_end();
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+385.0)
	write_short(g_ring)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(60)
	write_byte(0)
	write_byte(128)
	write_byte(0)
	write_byte(0)
	write_byte(200)
	write_byte(0)
	message_end()
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+470.0)
	write_short(g_ring)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(60)
	write_byte(0)
	write_byte(128)
	write_byte(0)
	write_byte(0)
	write_byte(200)
	write_byte(0)
	message_end()
	
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_BEAMCYLINDER)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2]+555.0)
	write_short(g_ring)
	write_byte(0)
	write_byte(0)
	write_byte(4)
	write_byte(60)
	write_byte(0)
	write_byte(128)
	write_byte(0)
	write_byte(0)
	write_byte(200)
	write_byte(0)
	message_end()
}

public effect(const Float:originF[3])
{
	engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
	write_byte(TE_EXPLOSION)
	engfunc(EngFunc_WriteCoord, originF[0])
	engfunc(EngFunc_WriteCoord, originF[1])
	engfunc(EngFunc_WriteCoord, originF[2])
	write_short(g_fire)
	write_byte(25)
	write_byte(10)
	write_byte(0)
	message_end()
}

UpdateFrags(attacker, frags, scoreboard)
{
	set_pev(attacker, pev_frags, float(pev(attacker, pev_frags) + frags))
	zp_set_user_ammo_packs(attacker, zp_get_user_ammo_packs(attacker) + 1);
	
	if (scoreboard)
	{
		message_begin(MSG_BROADCAST, g_score)
		write_byte(attacker)
		write_short(pev(attacker, pev_frags))
		write_short(get_user_deaths(attacker))
		write_short(0)
		write_short(get_user_team(attacker))
		message_end()
	}
}

SendDeathMsg(attacker, victim)
{
	message_begin(MSG_BROADCAST, g_death)
	write_byte(attacker)
	write_byte(victim)
	write_byte(0)
	write_string("Pipe Bomb")
	message_end()
}

Аватар
EMOTO2.COM
Извън линия
Потребител
Потребител
Мнения: 344
Регистриран на: 11 Яну 2018, 17:02
Се отблагодари: 26 пъти
Получена благодарност: 31 пъти
Обратна връзка:

Оправяне на грешка memory access

Мнение от EMOTO2.COM » 18 Апр 2020, 06:54

С този код вече няколко дни подред няма никаква грешка! :o
Присъедини се към най-доброто място за игра!
https://emoto2.com/

Заключено
  • Подобни теми
    Отговори
    Преглеждания
     Последно мнение

Обратно към “Заявки за плъгини”

Кой е на линия

Потребители разглеждащи този форум: 0 регистрирани и 14 госта