Die Motion Rate

Плъгини използващи ReAPI модула.
Аватар
RideeR ;]
Извън линия
Потребител
Потребител
Мнения: 170
Регистриран на: 05 Окт 2016, 21:30
Получена благодарност: 3 пъти

Die Motion Rate

Мнение от RideeR ;] » 13 Окт 2016, 16:11

reapi_die_motion_rate.jpg
reapi_die_motion_rate.jpg (22.06 KiB) Преглеждано 2798 пъти
reapi_die_motion_rate.jpg
reapi_die_motion_rate.jpg (22.06 KiB) Преглеждано 2798 пъти
Автор:
  • Vaqtincha
Описание:
Плъгинът променя скоростта на анимацията на падане на труп след убийство на играч и звукът от него.

Изисквания:
Настройки:

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

/**■■■■■■■■■■■■■■■■■■■■■■■■■■■■ CONFIG START ■■■■■■■■■■■■■■■■■■■■■■■■■■■■*/

#define ONLY_HEADSHOT_KILL    // Промяна на скоростта на падане на труп само при HeadShot

#define VOICE_PITCH    70    // Скоростта на възпроизвеждане на звук от смъртта
#define MOTION_RATE    0.17    // Скоростта на анимацията на падане на трупа

/**■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ CONFIG END ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■*/ 
Прикачени файлове
reapi_die_motion_rate.rar
(960 Байта) Свалено 251 пъти
reapi_die_motion_rate.rar
(960 Байта) Свалено 251 пъти
Последно промяна от 1fRaNkkK на 09 Окт 2017, 16:32, променено общо 1 път.
Причина: Премахнат .amxx, само .sma е добавен!

Аватар
mount4
Извън линия
Потребител
Потребител
Мнения: 187
Регистриран на: 03 Ное 2016, 19:54
Местоположение: Варна
Обратна връзка:

Re: Die Motion Rate

Мнение от mount4 » 05 Ное 2016, 02:09

Промених малко този код и сега немога да го компилирам заради reapi-то.
Добавих тези .inc файлове https://github.com/s1lentq/reapi/tree/m ... ng/include
в този онлайн компилатор https://amx.freakz.ro
както и reapi_version.inc от тук https://github.com/s1lentq/reapi/tree/master/reapi/src

дава ми следните errors:

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

AMX Mod X Compiler 1.8.3-manual
Copyright (c) 1997-2006 ITB CompuPhase
Copyright (c) 2004-2013 AMX Mod X Team

Modified for www.Freakz.ro / amx.freakz.ro

amx/include/cssdk_const.inc(5) : error 010: invalid function or declaration
amx/include/cssdk_const.inc(11) : error 010: invalid function or declaration
amx/include/cssdk_const.inc(15) : error 010: invalid function or declaration
amx/include/cssdk_const.inc(18) : error 010: invalid function or declaration
amx/include/cssdk_const.inc(22) : error 010: invalid function or declaration
amx/include/cssdk_const.inc(37) : error 010: invalid function or declaration
amx/include/cssdk_const.inc(43) : error 010: invalid function or declaration
amx/include/cssdk_const.inc(45) : error 010: invalid function or declaration
amx/include/cssdk_const.inc(47) : error 010: invalid function or declaration
amx/include/cssdk_const.inc(51) : error 010: invalid function or declaration
amx/include/cssdk_const.inc(55) : error 010: invalid function or declaration
amx/include/cssdk_const.inc(60) : error 010: invalid function or declaration
amx/include/cssdk_const.inc(64) : error 010: invalid function or declaration
amx/include/cssdk_const.inc(67) : error 010: invalid function or declaration
amx/include/cssdk_const.inc(71) : error 010: invalid function or declaration
amx/include/cssdk_const.inc(74) : error 010: invalid function or declaration
amx/include/cssdk_const.inc(77) : error 010: invalid function or declaration
amx/include/cssdk_const.inc(81) : error 010: invalid function or declaration
amx/include/cssdk_const.inc(83) : error 075: input line too long (after substitutions)
amx/include/cssdk_const.inc(89) : error 010: invalid function or declaration
amx/include/cssdk_const.inc(93) : error 010: invalid function or declaration
amx/include/cssdk_const.inc(103) : error 010: invalid function or declaration
amx/include/cssdk_const.inc(110) : error 010: invalid function or declaration
amx/include/cssdk_const.inc(114) : error 010: invalid function or declaration
amx/include/cssdk_const.inc(126) : error 010: invalid function or declaration
amx/include/cssdk_const.inc(131) : error 010: invalid function or declaration

Compilation aborted.
26 Errors.
Done.
Колко ли не търсих в google как става компилирането с reapi и няма инфо.
Промяната ми е -> слях този код с кода на gib_death за да може всеки път на случаен принцип да се използва 1 от 2-та ефект-а, или ефекта от gib_death или slow motion-a.

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

/**■■■■■■■■■■■■■■■■■■■■■■■■■■■■ CONFIG START ■■■■■■■■■■■■■■■■■■■■■■■■■■■■*/

//#define ONLY_HEADSHOT_KILL

#define VOICE_PITCH		70		// fast ~120
#define MOTION_RATE 	0.17	// fast ~2.17

//#define USE_ZP // uncomment this line to use Zombie Plague mode (gib effects apply only to zombies)

/**■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ CONFIG END ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■*/

#include <amxmodx>
#include <hamsandwich>
#include <engine>
#include <reapi>

#if defined VOICE_PITCH
	#include <fakemeta>
	new g_iFwdEmitSound
#endif

#if defined USE_ZP
#include <zombieplague>
#endif

#define BREAK_GLASS       0x01
#define BREAK_METAL       0x02
#define BREAK_FLESH       0x04
#define BREAK_WOOD        0x08
#define BREAK_CONCRETE    0x40

new const g_sz_Const_GibModels[][] =
{
	"models/hgibs.mdl",
	"models/glassgibs.mdl",
	"models/woodgibs.mdl",
	"models/metalplategibs.mdl",
	"models/cindergibs.mdl",
	"models/ceilinggibs.mdl",
	"models/computergibs.mdl",
	"models/rockgibs.mdl",
	"models/bookgibs.mdl",
	"models/garbagegibs.mdl",
	"models/bonegibs.mdl",
	"models/cactusgibs.mdl",
	"models/webgibs.mdl"
}

new const g_i_Const_GibMaterials[sizeof g_sz_Const_GibModels] =
{
	BREAK_FLESH,
	BREAK_GLASS,
	BREAK_WOOD,
	BREAK_METAL,
	BREAK_CONCRETE,
	BREAK_CONCRETE,
	BREAK_METAL,
	BREAK_CONCRETE,
	BREAK_FLESH,
	BREAK_FLESH,
	BREAK_FLESH,
	BREAK_WOOD,
	BREAK_FLESH
}

new HookChain:g_hSetAnimation, g_i_CacheGibsMdl[sizeof g_sz_Const_GibModels],
g_i_CacheAvailableGibs[sizeof g_sz_Const_GibModels],g_i_CacheAvailableNum,
g_p_Cvar_GibType,g_p_Cvar_GibSpread,g_p_Cvar_GibCount,g_p_Cvar_GibLife
public plugin_precache() for(new i=0;i<sizeof g_sz_Const_GibModels;i++) g_i_CacheGibsMdl[i] = precache_model(g_sz_Const_GibModels[i])

public plugin_init()
{
	register_plugin("Gib Death + Die Motion Rate", "1.0", "<VeCo>, Vaqtincha & mount4")
	
	
	g_p_Cvar_GibType = register_cvar("gib_type","abcdefghijklm")
	g_p_Cvar_GibSpread = register_cvar("gib_spread","10")
	g_p_Cvar_GibCount = register_cvar("gib_count","8")
	g_p_Cvar_GibLife = register_cvar("gib_life","30")
	
	
	register_logevent("LogEvent_RoundStart",2,"1=Round_Start")
	
	//RegisterHam(Ham_Killed,"player","HamHook_Player_Killed_Post",1)
	RegisterHookChain(RG_CBasePlayer_Killed, "CBasePlayer_Killed", .post = 0)
#if defined VOICE_PITCH
	RegisterHookChain(RG_CBasePlayer_Killed, "CBasePlayer_KilledP", .post = 1)
#endif
	DisableHookChain(g_hSetAnimation = RegisterHookChain(RG_CBasePlayer_SetAnimation, "CBasePlayer_SetAnimation", .post = 1))
	
#if !defined USE_ZP
	set_msg_block(get_user_msgid("ClCorpse"), BLOCK_SET)
#else
	register_message(get_user_msgid("ClCorpse"),"MessageHook_ClCorpse")
#endif
}

public LogEvent_RoundStart()
{
	g_i_CacheAvailableNum = 0
	
	
	new sz_CacheCvar_Type[42]
	get_pcvar_string(g_p_Cvar_GibType, sz_CacheCvar_Type,charsmax(sz_CacheCvar_Type))
	
	new i_CacheCvar_StrLen = strlen(sz_CacheCvar_Type)
	
	
	for(new i=0;i<i_CacheCvar_StrLen;i++)
	{
		if(sz_CacheCvar_Type[i] > 'm' || sz_CacheCvar_Type[i] < 'a') continue
		
		g_i_CacheAvailableGibs[g_i_CacheAvailableNum++] = sz_CacheCvar_Type[i] - 'a'
	}
}

/*public HamHook_Player_Killed_Post(id)
{
}*/

#if defined USE_ZP
public MessageHook_ClCorpse(msgid,msgdest,id) return zp_get_user_zombie(get_msg_arg_int(12))
#endif

/* ------------- */

public CBasePlayer_Killed(const index, const pevAttacker, iGib)
{
	if(random(2) == 0)
	{

	#if defined USE_ZP
		if(!zp_get_user_zombie(id)) return HAM_IGNORED
	#endif
	
		entity_set_int(index,EV_INT_effects,entity_get_int(index,EV_INT_effects) | EF_NODRAW)

		new i_GetGib = g_i_CacheAvailableGibs[(g_i_CacheAvailableNum>1) ? random(g_i_CacheAvailableNum) : 0]
	
		new i_v_Origin[3]
		get_user_origin(index,i_v_Origin)
	
		message_begin(MSG_PVS,SVC_TEMPENTITY, i_v_Origin)
		{
			write_byte(TE_BREAKMODEL)
			
			write_coord(i_v_Origin[0])
			write_coord(i_v_Origin[1])
			write_coord(i_v_Origin[2] + 16)
			
			write_coord(32)
			write_coord(32)
			write_coord(32)
			
			write_coord(0)
			write_coord(0)
			write_coord(25)
			
			write_byte(get_pcvar_num(g_p_Cvar_GibSpread))
			
			write_short(g_i_CacheGibsMdl[i_GetGib])
			
			write_byte(get_pcvar_num(g_p_Cvar_GibCount))
			write_byte(get_pcvar_num(g_p_Cvar_GibLife))
			
			write_byte(g_i_Const_GibMaterials[i_GetGib])
		}
		message_end()
		return HC_CONTINUE
		
	} else
	{
		if(!pevAttacker || index == pevAttacker)
			return HC_CONTINUE

	#if defined ONLY_HEADSHOT_KILL
		if(get_member(index, m_LastHitGroup) != HITGROUP_HEAD)
			return HC_CONTINUE
	#endif
		EnableHookChain(g_hSetAnimation)

	#if defined VOICE_PITCH
		g_iFwdEmitSound = register_forward(FM_EmitSound, "EmitSound_Pre", ._post = 0)
	#endif
		return HC_CONTINUE
	}
}

public CBasePlayer_SetAnimation(const index, const PLAYER_ANIM:playerAnim)
{
	DisableHookChain(g_hSetAnimation)
	if(playerAnim == PLAYER_DIE)
		set_entvar(index, var_framerate, MOTION_RATE)

	return HC_CONTINUE
}

#if defined VOICE_PITCH
public CBasePlayer_KilledP(const index, const pevAttacker, iGib)
{
	if(g_iFwdEmitSound)
	{
		unregister_forward(FM_EmitSound, g_iFwdEmitSound, .post = 0)
		g_iFwdEmitSound = 0
	}
}

public EmitSound_Pre(const iEntity, iChannel, const szSample[], Float:fVol, Float:fAttn, iFlags, iPitch)
{
	if(iChannel == CHAN_VOICE)
	{
		emit_sound(iEntity, iChannel, szSample, fVol, fAttn, iFlags, VOICE_PITCH)
		return FMRES_SUPERCEDE
	}

	return FMRES_IGNORED
}
#endif
Установих че "random" функцията е адски тъпо объркана. Примерно ако напишеш random(255) максималното число което щи се падне е 254 а не 255 !!!
Сега се чудя за random_num(0, 255) как е, дали и тя е объркана по същия начин и още не съм пробвал да видя.

-------------------------------------

едит:
оправих се! Сетих се да проверя дали в архива на reapi-то където е модула има includes и се оказа че ги има.
Пробвах с тях, качих ги пак в онлайн компилатора и този път стана. Незнам защо нестана с тези от github.

aaand guess what ? the modified by me plugin works ! двата ефекта са брутални и се получи много добро. Test it ;p
U can see in the server in my подпис. (ако нее crash-нал заради bad plugins, иначе е 24/7 uptime)
Последно промяна от Petrowch0 на 05 Ное 2016, 11:46, променено общо 1 път.
94.190.190.195:27015 -> Изображение <-- Runemod here !
94.190.190.195:27017 -> Изображение

Segmentation fault Изображение <-- Opera browser !

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

Обратно към “Плъгини за ReAPI”

Кой е на линия

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