Try this, I have added a check for round end..
PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < hamsandwich >
#include < fun >
#include < cstrike >
#include <fakemeta_util>
#include <fakemeta >
#define ADMIN ADMIN_RCON
#define SILVER ADMIN_LEVEL_G
#define GOLDEN ADMIN_LEVEL_H
#define PLUGIN "DKS Invisible"
#define VERSION "0.2"
#define AUTHOR "Dubai King Server"
enum ChatColor
{
CHATCOLOR_NORMAL = 1,
CHATCOLOR_GREEN,
CHATCOLOR_TEAM_COLOR,
CHATCOLOR_GREY,
CHATCOLOR_RED,
CHATCOLOR_BLUE,
}
new bool:gBlockBuyZone;
new bool: g_bAdminMode;
new gMsgStatusIcon;
new uflags[33];
new g_iMaxPlayers
public client_putinserver(id)
{
if(get_user_flags(id)&ADMIN)
uflags[id] = ADMIN
else if(get_user_flags(id)&GOLDEN)
uflags[id] = GOLDEN
else if(get_user_flags(id)&SILVER)
uflags[id] = SILVER
else
uflags[id] = 0
}
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHam( Ham_Spawn, "player", "ham_PlayerSpawn_Post", 1 );
register_logevent("logevent_round_end", 2, "1=Round_End");
register_concmd( "dks_invisible", "Cmd_AdminMode", ADMIN|SILVER|GOLDEN);
gMsgStatusIcon = get_user_msgid("StatusIcon");
register_message(gMsgStatusIcon, "MessageStatusIcon");
register_event( "HLTV", "Event_RoundStart", "a", "1=0", "2=0" );
g_iMaxPlayers = get_maxplayers()
}
public logevent_round_end()
{
if( g_bAdminMode )
{
for(new id; id <= g_iMaxPlayers; id++)
{
set_user_rendering(id)
}
}
}
public MessageStatusIcon(msgID, dest, receiver) {
// Check if status is to be shown
if(gBlockBuyZone && get_msg_arg_int(1)) {
new const buyzone[] = "buyzone";
// Grab what icon is being shown
new icon[sizeof(buyzone) + 1];
get_msg_arg_string(2, icon, charsmax(icon));
// Check if buyzone icon
if(equal(icon, buyzone)) {
// Remove player from buyzone
RemoveFromBuyzone(receiver);
// Block icon from being shown
set_msg_arg_int(1, ARG_BYTE, 0);
}
}
return PLUGIN_CONTINUE;
}
BlockBuyZones() {
// Hide buyzone icon from all players
message_begin(MSG_BROADCAST, gMsgStatusIcon);
write_byte(0);
write_string("buyzone");
message_end();
// Get all alive players
new players[32], pnum;
get_players(players, pnum, "a");
// Remove all alive players from buyzone
while(pnum-- > 0) {
RemoveFromBuyzone(players[pnum]);
}
// Set that buyzones should be blocked
gBlockBuyZone = true;
}
RemoveFromBuyzone(id) {
// Define offsets to be used
const m_fClientMapZone = 235;
const MAPZONE_BUYZONE = (1 << 0);
const XO_PLAYERS = 5;
// Remove player's buyzone bit for the map zones
set_pdata_int(id, m_fClientMapZone, get_pdata_int(id, m_fClientMapZone, XO_PLAYERS) & ~MAPZONE_BUYZONE, XO_PLAYERS);
}
UnblockBuyZones() {
// Set that buyzone should not be blocked
gBlockBuyZone = false;
}
public Event_RoundStart()
{
if( g_bAdminMode )
set_task( 1.0, "task_AdminMode" );
}
public ham_PlayerSpawn_Post( id )
{
if( is_user_alive( id ) )
{
if( g_bAdminMode )
{
BlockBuyZones()
give_item( id, "weapon_m249" )
cs_set_user_bpammo( id, CSW_M249, 200 )
engclient_cmd( id, "weapon_m249" )
if(access(id, ADMIN) || access(id, SILVER) || access(id, GOLDEN))
{
BlockBuyZones()
strip_user_weapons(id)
engclient_cmd( id, "weapon_knife" )
set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha , 0);
} else {
UnblockBuyZones()
set_user_rendering(id)
}
}
}
}
public Cmd_AdminMode( id, level, cid )
{
if( !cmd_access( id, level, cid, 1 ) )
return PLUGIN_HANDLED;
if( g_bAdminMode )
g_bAdminMode = false;
else g_bAdminMode = true;
g_bAdminMode = true
new szName[32],level[10];
get_user_name( id, szName, 31 );
get_level_by_flag(id,level);
colorChat(0,CHATCOLOR_NORMAL,"$g[$tDKS$g]$n Invisible mode will start on next round",szName,level);
client_print(id, print_chat, "[DKS] Invisible mode activated by %s [%s]",szName,level);
set_hudmessage(255, 0, 0, -1.0, 0.0, 2, 6.0, 120.0)
show_hudmessage(id, "Invisible mode will start on next round")
return PLUGIN_HANDLED;
}
public task_AdminMode()
{
g_bAdminMode = false;
}
get_level_by_flag(id,level[]){
switch(uflags[id]){
case ADMIN: copy(level,13,"ADMIN")
case SILVER: copy(level,13,"SILVER")
case GOLDEN: copy(level,13,"GOLDEN")
}
}
colorChat(id, ChatColor:color, const msg[], {Float,Sql,Result,_}:...)
{
new team, index, MSG_Type
new bool:teamChanged = false
static message[192]
switch(color)
{
case CHATCOLOR_NORMAL: // Normal
{
message[0] = 0x01;
}
case CHATCOLOR_GREEN: // Green
{
message[0] = 0x04;
}
default: // Grey, Red, Blue
{
message[0] = 0x03;
}
}
vformat(message[1], 190, msg, 4);
replace_all(message, 190, "$g", "^x04")
replace_all(message, 190, "$n", "^x01")
replace_all(message, 190, "$t", "^x03")
if(id == 0)
{
index = findAnyPlayer()
MSG_Type = MSG_ALL;
}
else
{
index = id;
MSG_Type = MSG_ONE;
}
if(index != 0)
{
team = get_user_team(index);
if(color == CHATCOLOR_RED && team != 1)
{
messageTeamInfo(index, MSG_Type, "TERRORIST")
teamChanged = true
}
else
if(color == CHATCOLOR_BLUE && team != 2)
{
messageTeamInfo(index, MSG_Type, "CT")
teamChanged = true
}
else
if(color == CHATCOLOR_GREY && team != 0)
{
messageTeamInfo(index, MSG_Type,"")
teamChanged = true
}
messageSayText(index, MSG_Type, message);
if(teamChanged)
{
messageTeamInfo(index, MSG_Type, "SPECTATOR")
}
}
}
messageSayText(id, type, message[])
{
message_begin(type, get_user_msgid("SayText"), _, id)
write_byte(id)
write_string(message)
message_end()
}
messageTeamInfo(id, type, team[])
{
message_begin(type, get_user_msgid("TeamInfo"), _, id)
write_byte(id)
write_string(team)
message_end()
}
findAnyPlayer()
{
static players[32], inum, pid
get_players(players, inum, "ch")
for (new a = 0; a < inum; a++)
{
pid = players[a]
if(is_user_connected(pid))
return pid
}
return 0
}