Skocz do zawartości

  • Zaloguj korzystając z Facebooka Zaloguj korzystając z Twittera Zaloguj przez Steam Zaloguj poprzez Google      Logowanie »   
  • Rejestracja

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.

  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie

[Paintball] Jak dodać AWP i P90


  • Nie możesz napisać tematu
  • Zaloguj się, aby dodać odpowiedź
Brak odpowiedzi do tego tematu

#1 Mruuu

    Życzliwy

  • Użytkownik

Reputacja: 7
Nowy

  • Postów:27
  • Imię:Kacper
  • Lokalizacja:Możesz szukać :)
Offline

Napisano 05.08.2016 13:27

Witam.

Jak dodać P90 i AWP do PBMOD'a?

Chciałbym, aby modele również były zmienione:

awp: http://gamebanana.com/skins/147371

p90: http://gamebanana.com/skins/135282

 

A tutaj:

paintballmod.sma:

#include <amxmodx>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>

#define VERSION "3.4.6"

enum _:cvary { ON, GUN, USP, GLOCK, NADE, CMODEL, MONEY, STRIP, DEATH, GNADE }

new cvar[cvary], g_MaxPlayers, g_team_select[33], g_plyr_skin[33], bool:g_has_kill[33];

public plugin_init()
{
	register_plugin("Paintball Mod", VERSION, "WhooKid & szelbi");
	
	g_MaxPlayers = get_maxplayers();

	cvar[ON] = register_cvar("amx_pbmod", "1");
	cvar[GUN] = register_cvar("amx_pbgun", "1");
	cvar[USP] = register_cvar("amx_pbusp", "1");
	cvar[GLOCK] = register_cvar("amx_pbglock", "1");
	cvar[NADE] = register_cvar("amx_pbnade", "1");

	if(get_pcvar_num(cvar[ON]))
	{
		register_logevent("new_round", 2, "0=World triggered", "1=Round_Start");
		register_logevent("round_end", 2, "1=Round_End");
		
		register_event("Money", "ev_money", "be");
		
		RegisterHam(Ham_Killed, "player", "ham_killed", 1);
		RegisterHam(Ham_Spawn, "player", "ham_spawn", 1);
		
		register_clcmd("say /respawn", "say_respawn");

		cvar[CMODEL] = register_cvar("amx_pbmodel", "0");
		cvar[MONEY] = register_cvar("amx_pbmoney", "1");
		cvar[STRIP] = register_cvar("amx_pbstrip", "1");
		cvar[DEATH] = register_cvar("amx_pbdm", "0");
		cvar[GNADE] = register_cvar("amx_getnade", "2");
		
		register_forward(FM_GetGameDescription, "fw_gamedesc");
		register_forward(FM_SetModel, "fw_setmodel", 0);
		
		if(get_pcvar_num(cvar[CMODEL]))
		{
			register_forward(FM_PlayerPostThink, "fw_playerpostthink");
			register_forward(FM_ClientUserInfoChanged, "fw_clientuserinfochanged");
		}
	}
}

public plugin_precache()
{
	
}

public fw_gamedesc()
{
	if(get_pcvar_num(cvar[ON]))
	{
		new desc[20];
		formatex(desc, 19, "PB MOD v%s", VERSION);
		forward_return(FMV_STRING, desc);
		return FMRES_SUPERCEDE;
	}
	return FMRES_IGNORED;
}

public new_round()
{
	if(get_pcvar_num(cvar[ON]) && get_pcvar_num(cvar[STRIP]))
	{
		new ent;
		
		while((ent = engfunc(EngFunc_FindEntityByString, ent, "classname", "armoury_entity")) != 0)
		engfunc(EngFunc_RemoveEntity, ent);
	}
}

public round_end()
{
	if(get_pcvar_num(cvar[STRIP]))
	{
		for(new i=1;i<=g_MaxPlayers;i++)
		{
			if(!is_user_alive(i))
			return;
			
			fm_strip_user_weapons(i);
			set_pdata_int(i, 116, 0);
			fm_give_item(i, "weapon_knife");
		}
	}
}

public ham_spawn(id)
{
	if(get_pcvar_num(cvar[ON]))
	{
		if(get_pcvar_num(cvar[CMODEL]))
		{
			engfunc(EngFunc_SetClientKeyValue, id, engfunc(EngFunc_GetInfoKeyBuffer, id), "model", "paintballer");
			new skin = g_plyr_skin[id];			
			if(get_user_team(id) == 1)
			{
				if(skin < 0 || skin > 3)
				g_plyr_skin[id] = 0;
			}
			else
			{
				if(skin < 4 || skin > 7)
				g_plyr_skin[id] = 4;
			}
			set_pev(id, pev_skin, g_plyr_skin[id]);
		}
		
		if(get_pcvar_num(cvar[MONEY]))
		{			
			message_begin(MSG_BROADCAST, get_user_msgid("HideWeapon"), _, id);
			write_byte(1<<5);
			message_end();
		}
		set_task(1.5, "player_weapons", id);
	}
}

public client_command(id)
{
	if(get_pcvar_num(cvar[CMODEL]))
	{		
		new command[10], speech[2];
		read_argv(0, command, 9);
		read_argv(1, speech, 1);
		
		if((containi(command, "join") != -1) && equali(command, "jointeam"))
		g_team_select[id] = str_to_num(speech);
		else if(equali(command, "joinclass"))
		g_plyr_skin[id] = (g_team_select[id] == 1) ? str_to_num(speech) - 1: str_to_num(speech) + 3;
	}
}

public player_weapons(id)
{
	if(is_user_connected(id))
	{		
		if(get_user_team(id) == 1 && get_pcvar_num(cvar[GLOCK]))
		{
			fm_give_item(id, "weapon_glock18");
			set_pdata_int(id, 386, 120);
		}
		
		if(get_user_team(id) == 2 && get_pcvar_num(cvar[USP]))
		{
			fm_give_item(id, "weapon_usp");
			set_pdata_int(id, 382, 100);
		}
		
		if(get_pcvar_num(cvar[GUN]))
		{
			fm_give_item(id, "weapon_mp5navy");
			set_pdata_int(id, 386, 120);
		}
		
		if(get_pcvar_num(cvar[NADE]) && (get_pcvar_num(cvar[GNADE]) == 1 || g_has_kill[id]))
		{
			fm_give_item(id, "weapon_hegrenade");
			g_has_kill[id] = false;
		}
	}
	remove_task(id);
}

public ham_killed(id, attacker)
{
	if(attacker != id)
	g_has_kill[attacker] = true;
	
	if(get_pcvar_num(cvar[DEATH]))
	{
		set_task(3.0, "player_spawner", id);
		set_task(3.2, "player_spawner", id);
	}
}

public ev_money(id)
{
	if(get_pcvar_num(cvar[MONEY]) && (get_pdata_int(id, 115, 5) > 0))
	set_pdata_int(id, 115, 0, 5);
}

public say_respawn(id)
{
	if(get_pcvar_num(cvar[DEATH]) && !is_user_alive(id) && (get_user_team(id) == 1 || get_user_team(id) == 2))
	set_task(1.5, "player_spawner", id + 200);
}

public player_spawner(id)
{
	new player = id - 200;
	if(is_user_connected(player) && (get_user_team(player) == 1 || get_user_team(player) == 2))
	ExecuteHamB(Ham_CS_RoundRespawn, player);
}

public fw_setmodel(ent, model[])
{
	if(get_pcvar_num(cvar[DEATH]) && pev_valid(ent))
	{
		new id = pev(ent, pev_owner);
		if ((!is_user_alive(id) || task_exists(id + 200)) && equali(model, "models/w_", 9) && !equali(model, "models/w_weaponbox.mdl"))
		{
			new classname[16];
			pev(ent, pev_classname, classname, 15);
			if(equal(classname, "weaponbox") && !equal(model, "models/w_backpack.mdl"))
			for (new i = get_maxplayers() + 1; i < engfunc(EngFunc_NumberOfEntities) + 5; i++)
			if(pev_valid(i))
			if(ent == pev(i, pev_owner))
			{
				dllfunc(DLLFunc_Think, ent);
				return FMRES_IGNORED;
			}
		}
	}
	return FMRES_IGNORED;
}

public fw_playerpostthink(id)
{
	if(get_pcvar_num(cvar[CMODEL]) && is_user_alive(id))
	{
		static model[32], buffer;
		buffer = engfunc(EngFunc_GetInfoKeyBuffer, id);
		engfunc(EngFunc_InfoKeyValue, buffer, "model", model, 31);

		if (!equal(model, "paintballer"))
		engfunc(EngFunc_SetClientKeyValue, id, buffer, "model", "paintballer");

		return FMRES_HANDLED;
	}
	return FMRES_IGNORED;
}

public fw_clientuserinfochanged(id, infobuffer)
{
	return (get_pcvar_num(cvar[CMODEL]) && pev(id, pev_deadflag) == DEAD_NO) ? FMRES_SUPERCEDE: FMRES_IGNORED;
}

paintballgun.sma:

#include <amxmodx>
#include <fakemeta>
#include <fakemeta_util>
#include <cstrike>
#include <hamsandwich>

#define PLUGIN "Paintball Gun"
#define VERSION "3.4.5"
#define AUTHOR "WhooKid & szelbi"

#define MAX_PAINTBALLS 200
#define TASK_PB_RESET 1000
#define TASK_RELOAD 2000

enum _:cvary { GUN, USP, GLOCK, COLOR, SHOTS, VELOC, SPEED, BLIFE, SOUND, BGLOW, DAMGE, FRIENDLYF, BOMBS, RESPKILL }

new cvar[cvary], tgun, ctgun, beamspr;
new g_paintballs[MAX_PAINTBALLS], g_pbstatus[MAX_PAINTBALLS], g_pbcount, Float:lastshot[33], Float:nextattack[33], freezetime;

new const g_shot_anim[4] = {0, 3, 9, 5};
new const g_pbgun_models[11][] = {"models/v_pbgun.mdl", "models/v_pbgun1.mdl", "models/v_pbgun2.mdl", "models/v_pbgun3.mdl", "models/v_pbgun4.mdl", "models/v_pbgun5.mdl", "models/v_pbgun6.mdl", "models/v_pbgun7.mdl", "models/v_pbgun8.mdl", "models/v_pbgun9.mdl", "models/v_pbgun10.mdl"};

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR);
	
	register_clcmd("say /ent", "ent_info", ADMIN_SLAY);
	
	cvar[GUN] = register_cvar("amx_pbgun", "1");
	cvar[USP] = register_cvar("amx_pbusp", "1");
	cvar[GLOCK] = register_cvar("amx_pbglock", "1");

	if(get_pcvar_num(cvar[GUN]) || get_pcvar_num(cvar[USP]) || get_pcvar_num(cvar[GLOCK]))
	{
		register_logevent("ev_roundstart", 2, "0=World triggered", "1=Round_Start");
		
		if(get_cvar_num("mp_freezetime") > 0)
		register_event("HLTV", "ev_freezetime", "a", "1=0", "2=0");

		register_forward(FM_Touch, "fw_touch");
		register_forward(FM_SetModel, "fw_setmodel");
		register_forward(FM_UpdateClientData, "fw_updateclientdata", 1);
		
		RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_mp5navy", "ham_primaryattack");
		RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_glock18", "ham_primaryattack");
		RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_usp", "ham_primaryattack");
		
		register_event("CurWeapon", "ev_curweapon", "be");

		cvar[COLOR] = register_cvar("pbgun_color", "2");
		cvar[SHOTS] = register_cvar("pbgun_shots", "100");
		cvar[VELOC] = register_cvar("pbgun_velocity", "2000");
		cvar[SPEED] = register_cvar("pbgun_speed", "0.08");
		cvar[BLIFE] = register_cvar("pbgun_life", "15");
		cvar[SOUND] = register_cvar("pbgun_sound", "1");
		cvar[BGLOW] = register_cvar("pbgun_glow", "a");
		cvar[DAMGE] = register_cvar("pbgun_damage", "100");
		cvar[BOMBS] = register_cvar("pbgun_bombside", "0");
		cvar[RESPKILL] = register_cvar("pbgun_respkill", "0");
		cvar[FRIENDLYF] = get_cvar_pointer("mp_friendlyfire");

		new a, max_ents_allow = global_get(glb_maxEntities) - 5;
		for (a = 1; a <= get_pcvar_num(cvar[SHOTS]); a++)
		if(a < MAX_PAINTBALLS)
		if(engfunc(EngFunc_NumberOfEntities) < max_ents_allow)
		{
			g_paintballs[a] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
			if(pev_valid(g_paintballs[a]))
			{
				set_pev(g_paintballs[a], pev_effects, pev(g_paintballs[a], pev_effects) | EF_NODRAW);
				g_pbcount++;
			}
		}
		if(g_pbcount < 1)
		set_fail_state("[AMXX] Failed to load Paintball Gun (unable to create ents)");

		server_print("*** %s v%s by %s Enabled ***", PLUGIN, VERSION, AUTHOR);
	}
}

public plugin_precache()
{
	register_cvar("pbgun_tgun", "3");
	register_cvar("pbgun_ctgun", "7");
	tgun = get_cvar_num("pbgun_tgun");
	ctgun = get_cvar_num("pbgun_ctgun");
	
	precache_model(g_pbgun_models[tgun]);
	precache_model(g_pbgun_models[ctgun]);
	precache_model((ctgun) ? "models/p_pbgun1.mdl" : "models/p_pbgun.mdl");
	precache_model("models/w_pbgun.mdl");
	
	precache_model("models/v_pbusp.mdl");
	precache_model("models/p_pbusp.mdl");


	precache_model("models/v_pbglock.mdl");
	precache_model("models/p_pbglock.mdl");

	precache_sound("misc/pb1.wav");
	precache_sound("misc/pb2.wav");
	precache_sound("misc/pb3.wav");
	precache_sound("misc/pb4.wav");
	precache_sound("misc/pbg.wav");
	precache_model("models/w_paintball.mdl");
	precache_model("sprites/paintball.spr");

	beamspr = precache_model("sprites/laserbeam.spr");
}

public ent_info(id)
{
	client_print(id, print_chat, "[AMXX] [Ent Info (Current/Max)] Paintballs: (%d/%d)   Entities: (%d/%d)", g_pbcount, get_pcvar_num(cvar[SHOTS]), engfunc(EngFunc_NumberOfEntities), global_get(glb_maxEntities));
}

public fw_setmodel(ent, model[]) 
{
	if(equali(model, "models/w_mp5.mdl") && get_pcvar_num(cvar[GUN]))
	{
		engfunc(EngFunc_SetModel, ent, "models/w_pbgun.mdl");
		return FMRES_SUPERCEDE;
	}
	return FMRES_IGNORED;
}

public ev_curweapon(id)
{
	new model[25];
	pev(id, pev_viewmodel2, model, 24);
	
	if(equali(model, "models/v_mp5.mdl") && get_pcvar_num(cvar[GUN]))
	{
		set_pev(id, pev_viewmodel2, (get_user_team(id) == 1)? g_pbgun_models[tgun]: g_pbgun_models[ctgun]);
		set_pev(id, pev_weaponmodel2, (ctgun)? "models/p_pbgun1.mdl": "models/p_pbgun.mdl");
	}
	else if(equali(model, "models/v_usp.mdl") && get_pcvar_num(cvar[USP]))
	{
		set_pev(id, pev_viewmodel2, "models/v_pbusp.mdl");
		set_pev(id, pev_weaponmodel2, "models/p_pbusp.mdl");
	}
	else if(equali(model, "models/v_glock18.mdl") && get_pcvar_num(cvar[GLOCK]))
	{
		set_pev(id, pev_viewmodel2, "models/v_pbglock.mdl");
		set_pev(id, pev_weaponmodel2, "models/p_pbglock.mdl");
	}
}

public fw_updateclientdata(id, sw, cd_handle)
{
	if(user_has_pbgun(id) && cd_handle)
	{
		set_cd(cd_handle, CD_ID, 1);
		get_cd(cd_handle, CD_flNextAttack, nextattack[id]);
		return FMRES_HANDLED;
	}
	return FMRES_IGNORED;
}

public ham_primaryattack(ent)
{
	new id = pev(ent, pev_owner);
	new my_pbgun = user_has_pbgun(id);
	
	if(my_pbgun)
	{
		new ammo = cs_get_weapon_ammo(ent);
		if(ammo)
		{
			new Float:gametime = get_gametime(), Float:g_speed;
			
			if(my_pbgun == 1)
			g_speed = get_pcvar_float(cvar[SPEED]);
			else
			g_speed = (my_pbgun == 2)? get_pcvar_float(cvar[SPEED]) * 2.0: get_pcvar_float(cvar[SPEED]) * 3.0;
			
			if(gametime - lastshot[id] > g_speed && (is_user_bot(id) || nextattack[id] < 0.0) && !freezetime)
			{
				if(paint_fire(id))
				{
					lastshot[id] = gametime;
					cs_set_weapon_ammo(ent, ammo - 1);
					set_pev(id, pev_punchangle, Float:{-0.5, 0.0, 0.0});
					message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, _, id);
					write_byte(g_shot_anim[my_pbgun]);
					write_byte(0);
					message_end();
					if(get_pcvar_num(cvar[SOUND]))
					emit_sound(id, CHAN_AUTO, "misc/pbg.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
				}
			}
		}
	}
	return HAM_SUPERCEDE;
}

public paint_fire(id)
{
	new a, ent;
	while (a++ < g_pbcount - 1 && !ent)
	if(g_pbstatus[a] == 0)
	ent = g_pbstatus[a] = g_paintballs[a];
	if(!ent)
	while (a-- > 1 && !ent)
	if(g_pbstatus[a] == 2)
	ent = g_pbstatus[a] = g_paintballs[a];

	if(pev_valid(ent) && is_user_alive(id))
	{
		new Float:vangles[3], Float:nvelocity[3], Float:voriginf[3], vorigin[3], clr;
		set_pev(ent, pev_classname, "pbBullet");
		set_pev(ent, pev_owner, id);
		engfunc(EngFunc_SetModel, ent, "models/w_paintball.mdl");
		engfunc(EngFunc_SetSize, ent, Float:{-1.0, -1.0, -1.0}, Float:{1.0, 1.0, 1.0});

		switch (get_pcvar_num(cvar[COLOR]))
		{
		case 2: clr = (get_user_team(id) == 1) ? 0 : 1;
		case 3: clr = (get_user_team(id) == 1) ? 4 : 3;
		case 4: clr = (get_user_team(id) == 1) ? 2 : 5;
		default: clr = random_num(0, 6);
		}
		set_pev(ent, pev_skin, clr);
		
		get_user_origin(id, vorigin, 1);
		IVecFVec(vorigin, voriginf);
		engfunc(EngFunc_SetOrigin, ent, voriginf);

		vangles[0] = random_float(-180.0, 180.0);
		vangles[1] = random_float(-180.0, 180.0);
		set_pev(ent, pev_angles, vangles);

		pev(id, pev_v_angle, vangles);
		set_pev(ent, pev_v_angle, vangles);
		pev(id, pev_view_ofs, vangles);
		set_pev(ent, pev_view_ofs, vangles);

		set_pev(ent, pev_solid, 2);
		set_pev(ent, pev_movetype, 5);

		velocity_by_aim(id, get_pcvar_num(cvar[VELOC]), nvelocity);
		
		if(is_user_bot(id))
		{
			nvelocity[0] += random_float(0.0, 200.0) - 100.0;
			nvelocity[1] += random_float(0.0, 200.0) - 100.0;
			nvelocity[2] += random_float(0.0, 70.0) - 35.0;
		}  
		
		set_pev(ent, pev_velocity, nvelocity);
		set_pev(ent, pev_effects, pev(ent, pev_effects) & ~EF_NODRAW);

		set_task(0.1, "paint_glow", ent);
		set_task(15.0 , "paint_reset", ent+TASK_PB_RESET);
	}
	return ent;
}

public fw_touch(bullet, ent)
{
	new class[20];
	pev(bullet, pev_classname, class, 19);
	if(!equali(class, "pbBullet"))
	return FMRES_IGNORED;

	new Float:origin[3], class2[20], owner = pev(bullet, pev_owner), is_ent_alive = is_user_alive(ent);
	pev(ent, pev_classname, class2, 19);
	pev(bullet, pev_origin, origin);

	if(is_ent_alive)
	{
		if(owner == ent || pev(ent, pev_takedamage) == DAMAGE_NO)
		return FMRES_IGNORED;
		if(get_user_team(owner) == get_user_team(ent))
		if(!get_pcvar_num(cvar[FRIENDLYF]))
		return FMRES_IGNORED;

		ExecuteHam(Ham_TakeDamage, ent, owner, owner, float(get_pcvar_num(cvar[DAMGE])), 4098);
	}

	if(!equali(class, class2))
	{	
		set_pev(bullet, pev_velocity, Float:{0.0, 0.0, 0.0});
		set_pev(bullet, pev_classname, "pbPaint");
		set_pev(bullet, pev_solid, 0);
		set_pev(bullet, pev_movetype, 0);
		engfunc(EngFunc_SetModel, bullet, "sprites/paintball.spr");

		new a, findpb = 0;
		while (a++ < g_pbcount && !findpb)
		if(g_paintballs[a] == bullet)
		findpb = g_pbstatus[a] = 2;

		remove_task(bullet);
		remove_task(bullet+TASK_PB_RESET);

		if(get_pcvar_num(cvar[SOUND]))
		{
			static wav[20];
			formatex(wav, 20, is_ent_alive ? "player/pl_pain%d.wav" : "misc/pb%d.wav", is_ent_alive ? random_num(4,7) : random_num(1,4));
			emit_sound(bullet, CHAN_AUTO, wav, 1.0, ATTN_NORM, 0, PITCH_NORM);
		}

		new bool:valid_surface = (is_ent_alive || containi(class2, "door") != -1) ? false : true;
		if(get_pcvar_num(cvar[BOMBS]))
		{
			if(pev(ent, pev_health) && !is_ent_alive)
			{
				ExecuteHam(Ham_TakeDamage, ent, owner, owner, float(pev(ent, pev_health)), 0);
				valid_surface = false;
			}
		}
		else
		{
			if(pev(ent, pev_health) && !is_ent_alive && pev(ent,pev_takedamage))
			{
				ExecuteHam(Ham_TakeDamage, ent, owner, owner, float(pev(ent, pev_health)), 0);
				valid_surface = false;
			}
		}
		if(valid_surface)
		{
			paint_splat(bullet);
			set_task(float(get_pcvar_num(cvar[BLIFE])), "paint_reset", bullet+TASK_PB_RESET);
		}
		else
		paint_reset(bullet+TASK_PB_RESET);

		return FMRES_HANDLED; 
	}

	return FMRES_IGNORED;
}

public paint_splat(ent)
{
	new Float:origin[3], Float:norigin[3], Float:viewofs[3], Float:angles[3], Float:normal[3], Float:aiming[3];
	pev(ent, pev_origin, origin);
	pev(ent, pev_view_ofs, viewofs);
	pev(ent, pev_v_angle, angles);

	norigin[0] = origin[0] + viewofs[0];
	norigin[1] = origin[1] + viewofs[1];
	norigin[2] = origin[2] + viewofs[2];
	aiming[0] = norigin[0] + floatcos(angles[1], degrees) * 1000.0;
	aiming[1] = norigin[1] + floatsin(angles[1], degrees) * 1000.0;
	aiming[2] = norigin[2] + floatsin(-angles[0], degrees) * 1000.0;

	engfunc(EngFunc_TraceLine, norigin, aiming, 0, ent, 0);
	get_tr2(0, TR_vecPlaneNormal, normal);

	vector_to_angle(normal, angles);
	angles[1] += 180.0;
	if(angles[1] >= 360.0) angles[1] -= 360.0;
	set_pev(ent, pev_angles, angles);
	set_pev(ent, pev_v_angle, angles);

	origin[0] += (normal[0] * random_float(0.3, 2.7));
	origin[1] += (normal[1] * random_float(0.3, 2.7));
	origin[2] += (normal[2] * random_float(0.3, 2.7));
	engfunc(EngFunc_SetOrigin, ent, origin);
	set_pev(ent, pev_frame, float(random_num( (pev(ent, pev_skin) * 18), (pev(ent, pev_skin) * 18) + 17 ) ));
	if(pev(ent, pev_renderfx) != kRenderFxNone)
	fm_set_rendering(ent);
}

public paint_glow(ent)
{
	if(pev_valid(ent))
	{
		static pbglow[5], clr[3];
		get_pcvar_string(cvar[BGLOW], pbglow, 4);
		switch (get_pcvar_num(cvar[COLOR]))
		{
		case 2: clr = (get_user_team(pev(ent, pev_owner))==1) ? {255, 0, 0} : {0, 0, 255};
		default: clr = {255, 255, 255};
		}
		if(read_flags(pbglow) & (1 << 0))
		fm_set_rendering(ent, kRenderFxGlowShell, clr[0], clr[1], clr[2], kRenderNormal, 255);
		if(read_flags(pbglow) & (1 << 1))
		{
			message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
			write_byte(TE_BEAMFOLLOW);
			write_short(ent);
			write_short(beamspr);
			write_byte(4);
			write_byte(2);
			write_byte(clr[0]);
			write_byte(clr[1]);
			write_byte(clr[2]);
			write_byte(255);
			message_end();
		}
	}
}

public paint_reset(ent)
{
	remove_task(ent);
	ent -= TASK_PB_RESET;
	new a, findpb = 1;
	while (a++ <= g_pbcount && findpb)
	if(g_paintballs[a] == ent)
	findpb = g_pbstatus[a] = 0;

	set_pev(ent, pev_effects, pev(ent, pev_effects) | EF_NODRAW);
	engfunc(EngFunc_SetSize, ent, Float:{0.0, 0.0, 0.0}, Float:{0.0, 0.0, 0.0});
	set_pev(ent, pev_velocity, Float:{0.0, 0.0, 0.0});
	engfunc(EngFunc_SetOrigin, ent, Float:{-2000.0, -2000.0, -2000.0});
	if(pev(ent, pev_renderfx) != kRenderFxNone)
	fm_set_rendering(ent);
}

public ev_roundstart()
{
	if(get_pcvar_num(cvar[RESPKILL]))
	{
		for(new a=1;a<=g_pbcount;a++)
		{
			if(g_pbstatus[a] != 0)
			paint_reset(g_paintballs[a]+TASK_PB_RESET);
		}
	}
	
	if(freezetime)
	freezetime = 0;
}

public ev_freezetime()
{
	if(get_cvar_num("mp_freezetime") > 0)
	freezetime = 1;
	
	if(!get_pcvar_num(cvar[RESPKILL]))
	{
		for(new a=1;a<=g_pbcount;a++)
		{
			if(g_pbstatus[a] != 0)
			paint_reset(g_paintballs[a]+TASK_PB_RESET);
		}
	}
}

stock user_has_pbgun(id)
{
	if(is_user_alive(id))
	{		
		if(get_user_weapon(id) == CSW_MP5NAVY)
		return 1;
		else if(get_user_weapon(id) == CSW_USP)
		return 2;
		else if(get_user_weapon(id) == CSW_GLOCK18)
		return 3;
	}
	return 0;
}

  • +
  • -
  • 0




Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych