It would help? :d
This code is extracted from this plugin.
http://forums.alliedmods.net/showthread.php?p=490909
and i added this && cs_get_user_team(id) == CS_TEAM_T
------
edit
------
PHP Code:
#include <amxmodx>
#include <cstrike>
#define MAX_PLAYERS 32
new bool:hasLight[32]
new bool:g_restart_attempt[MAX_PLAYERS + 1]
public plugin_init() {
register_event("ResetHUD", "event_hud_reset", "be")
register_clcmd("fullupdate", "clcmd_fullupdate")
register_event("TextMsg", "event_restart_attempt", "a", "2=#Game_will_restart_in")
}
public clcmd_fullupdate() {
return PLUGIN_HANDLED_MAIN
}
public event_restart_attempt() {
new players[32], num
get_players(players, num, "a")
for (new i; i < num; ++i)
g_restart_attempt[players[i]] = true
}
public event_hud_reset(id) {
if (g_restart_attempt[id]) {
g_restart_attempt[id] = false
return
}
event_player_spawn(id)
}
public event_player_spawn(id)
{
hasLight[id] = false
}
public client_impulse(id, impulse)
{
if(impulse != 100)
return PLUGIN_HANDLED_MAIN
if(!hasLight[id] && cs_get_user_team(id) == CS_TEAM_CT)
{
client_print(id,print_chat,"[H&S] Sorry, you can't use FlashLight!");
return PLUGIN_HANDLED_MAIN
}
return PLUGIN_CONTINUE
}
So now i rewrite it :-)
But there is still problem. Situation:
player has been transferred from Terrorist (where flashlight is available) to CT with flashlight on.
He still has flashlight :/ and can use it.
It works only for new people who never been i Terrorist Team
=========
edit2
i've noticed that this problem is due to this plugin. Normal flashlight is being stoped before round end. But in this plugin depends on player click.
PHP Code:
#include <amxmodx>
#include <engine>
new flashlight[33];
public plugin_init() {
register_plugin("CustomFlashlight","0.10","Avalanche");
register_event("Flashlight","event_flashlight","b");
register_cvar("flashlight_custom","1");
register_cvar("flashlight_r","100");
register_cvar("flashlight_g","100");
register_cvar("flashlight_b","100");
register_cvar("flashlight_radius","9");
register_cvar("flashlight_decay","60");
}
public event_flashlight(id) {
if(!get_cvar_num("flashlight_custom")) {
return;
}
if(flashlight[id]) {
flashlight[id] = 0;
}
else {
flashlight[id] = 1;
}
message_begin(MSG_ONE,get_user_msgid("Flashlight"),{0,0,0},id);
write_byte(flashlight[id]);
write_byte(100);
message_end();
entity_set_int(id,EV_INT_effects,entity_get_int(id,EV_INT_effects) & ~EF_DIMLIGHT);
}
public client_PreThink(id) {
if(!get_cvar_num("flashlight_custom")) {
return;
}
if(flashlight[id]) {
new origin[3];
get_user_origin(id,origin,3);
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(27); // TE_DLIGHT
write_coord(origin[0]); // X
write_coord(origin[1]); // Y
write_coord(origin[2]); // Z
write_byte(get_cvar_num("flashlight_radius")); // radius
write_byte(get_cvar_num("flashlight_r")); // R
write_byte(get_cvar_num("flashlight_g")); // G
write_byte(get_cvar_num("flashlight_b")); // B
write_byte(1); // life
write_byte(get_cvar_num("flashlight_decay")); // decay rate
message_end();
}
}
Could you try to prevent it? I dont know how
__________________