A ja dam inny kod ktory wyciagnelem z KZ arg lub
ZP Niepamietam powinien on pomoc
meffy i Daddy
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta_util>
new g_playerflashcolor[33]
new g_playerenableflash[33]
new g_flashlight_colors[][3] =
{
{100,0,0},{0,100,0},{0,0,100},{0,100,100},{100,0,100},{100,100,0},
{100,0,60},{100,60,0},{0,100,60},{60,100,0},{0,60,100},{60,0,100},
{100,50,50},{50,100,50},{50,50,100},{0,50,50},{50,0,50},{50,50,0}
};
public plugin_init() {
register_plugin("CustomFlashlight","0.11","Avalanche");
register_forward(FM_CmdStart, "fw_Start")
RegisterHam(Ham_Player_PreThink, "player", "FwdPlayerPreThink")
}
public client_connect(id)
g_playerenableflash[id] = false
public FwdPlayerPreThink(id) {
if( g_playerenableflash[id] && is_user_alive(id) )
{
Make_FlashLight(id, g_playerflashcolor[id])
}
}
public fw_Start(id, uc_handle, seed)
{
if(get_uc(uc_handle, UC_Impulse) == 100)
{
if(is_user_alive(id))
{
g_playerflashcolor[id] = random_num(0, sizeof(g_flashlight_colors)-1)
g_playerenableflash[id] = !g_playerenableflash[id]
}
set_uc(uc_handle, UC_Impulse, 0)
return FMRES_HANDLED
}
return FMRES_IGNORED
}
Make_FlashLight(id, color)
{
static Float:origin[3]
fm_get_aim_origin(id, origin)
message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, id)
write_byte(TE_DLIGHT)
engfunc(EngFunc_WriteCoord, origin[0])
engfunc(EngFunc_WriteCoord, origin[1])
engfunc(EngFunc_WriteCoord, origin[2])
write_byte(15)
write_byte(g_flashlight_colors[color][0])
write_byte(g_flashlight_colors[color][1])
write_byte(g_flashlight_colors[color][2])
write_byte(1)
write_byte(60)
message_end()
}