Trzymaj
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <fakemeta_util>
new g_flashlight_colors[][3] =
{
{250,0,0}, {0,250,0}, {0,0,250}, {150,0,150},
{250,150,0}, {0,200,200}, {250,250,0}, {250,250,250}
};
new g_flashlight_name[][] =
{
"Czerwony", "Zielony", "Niebieski", "Rozowy",
"Zolty", "Aqua", "Zolty", "Bialy"
}
new g_playerflashcolor[33], g_playerenableflash[33];
public plugin_init() {
register_plugin("Latrka hns", "0.4", "byqq");
register_forward(FM_PlayerPreThink, "fw_playerprethink", 0);
register_forward(FM_CmdStart, "fw_start");
}
public client_connect(id)
{
g_playerenableflash[id] = false;
}
public fw_playerprethink(id)
{
if(g_playerenableflash[id] && is_user_alive(id))
Make_FlashLight(id, g_playerflashcolor[id]);
return FMRES_IGNORED;
}
public fw_start(id, uc_handle, seed)
{
if(get_uc(uc_handle, UC_Impulse) == 100)
{
if(is_user_alive(id) && get_user_team(id) == 1) {
set_uc(uc_handle, UC_Impulse, 0)
return FMRES_HANDLED;
}
else
if(is_user_alive(id))
{
new name[32];
get_user_name(id, name, 31);
g_playerflashcolor[id] = random_num(0, sizeof(g_flashlight_colors)-1);
g_playerenableflash[id] = !g_playerenableflash[id];
if(g_playerenableflash[id])
{
set_hudmessage(255, 0, 0, 0.57, 0.37, 0, 6.0, 12.0)
show_hudmessage(0, "Latarka %s: %s", name, g_flashlight_name[g_playerflashcolor[id]]);
}
}
set_uc(uc_handle, UC_Impulse, 0);
return FMRES_HANDLED;
}
return FMRES_IGNORED;
}
Make_FlashLight(id, color)
{
new players[32], num;
get_players(players, num);
for(new i = 0; i < num; i++)
{
new index = players[i];
static Float:origin[3];
fm_get_aim_origin(id, origin);
message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, index);
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(10);
message_end();
}
}


Dodatki SourceMod












