Код
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
const PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)
const SECONDARY_WEAPONS_BIT_SUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE)
#define VIP_FLAG ADMIN_LEVEL_H
new g_rounds
public plugin_init()
{
register_plugin("AdminVip", "0.1", "qwer")
register_event("ResetHUD", "ResetHUD", "be")
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
register_logevent("gameRestart", 2, "1=Game_Commencing")
register_event("TextMsg", "gameRestart", "a", "2=#Game_will_restart_in")
register_clcmd("say /adminka", "info_adm", 0, "- Shows the MOTD.")
register_clcmd("say /dgl", "dgl")
register_clcmd("say /m4a1", "m4a1")
register_clcmd("say /ak47", "ak47")
register_clcmd("say /awp", "awp")
}
public event_round_start ( )
{
g_rounds++
}
public gameRestart ( )
{
g_rounds = 0
}
public ResetHUD(id)
{
set_task(0.5, "VIP", id + 6910)
}
public VIP(TaskID)
{
new id = TaskID - 6910
if ( get_user_flags ( id ) & VIP_FLAG )
{
message_begin(MSG_ALL, get_user_msgid("ScoreAttrib"))
write_byte(id)
write_byte(4)
message_end()
give_item(id, "weapon_hegrenade")
give_item(id, "weapon_flashbang")
give_item(id, "weapon_flashbang")
give_item(id, "weapon_smokegrenade")
give_item(id, "item_kevlar")
give_item(id, "item_assaultsuit")
give_item(id, "item_thighpack")
}
return PLUGIN_HANDLED
}
public client_putinserver (id)
{
set_task(0.5, "vip_connect", id);
}
public vip_connect (id)
{
new name[32]
get_user_name(id, name, 31)
if (get_user_flags(id) & ADMIN_BAN)
{
color_print (0, "К нам присоединился !g[Админ] !t%s!y!", name)
client_cmd (0, "spk sound/radio/vip.wav")
}
else if (get_user_flags(id) & VIP_FLAG)
{
color_print (0, "К нам присоединился !g[VIP]!y игрок !t%s!y!", name)
client_cmd (0, "spk sound/radio/vip.wav")
}
}
public dgl ( id )
{
if ( ! ( get_user_flags ( id ) & VIP_FLAG ) )
{
color_print( id , "^4[VIP]^1 Вы не имеете ^3VIP ^1привилегий!" );
return PLUGIN_HANDLED;
}
if ( ! is_user_alive ( id ) )
{
color_print(id, "^4[VIP] ^3Ты мертв - действие невозможно!");
return PLUGIN_HANDLED;
}
drop_weapons(id, 2)
give_item( id, "weapon_deagle" )
cs_set_user_bpammo( id , CSW_DEAGLE, 35 )
color_print( id , "^4[VIP]^1 Вы получили ^3Deagle" )
return PLUGIN_CONTINUE;
}
public m4a1 ( id )
{
if ( ! ( get_user_flags ( id ) & VIP_FLAG ) )
{
color_print( id , "^4[VIP]^1 Доступно только для ^3VIP ^1игроков!" );
return PLUGIN_HANDLED;
}
if ( ! is_user_alive ( id ) )
{
color_print(id, "^4[VIP] ^3Ты мертв - действие невозможно!");
return PLUGIN_HANDLED;
}
if ( g_rounds < 2 )
{
color_print( id , "^4[VIP]^1 Доступно после^4 2 ^1раунда!" );
return PLUGIN_HANDLED;
}
drop_weapons(id, 1)
give_item( id, "weapon_m4a1" )
cs_set_user_bpammo( id , CSW_M4A1, 90 )
color_print( id , "^4[VIP]^1 Вы получили ^3M4A1" )
return PLUGIN_CONTINUE;
}
public ak47 ( id )
{
if ( ! ( get_user_flags ( id ) & VIP_FLAG ) )
{
color_print( id , "^4[VIP]^1 Вы не имеете ^3VIP ^1привилегий!" );
return PLUGIN_HANDLED;
}
if ( ! is_user_alive ( id ) )
{
color_print(id, "^4[VIP] ^3Ты мертв - действие невозможно!");
return PLUGIN_HANDLED;
}
if ( g_rounds < 2 )
{
color_print( id , "^4[VIP]^1 Доступно после^4 2 ^1раунда!" );
return PLUGIN_HANDLED;
}
drop_weapons(id, 1)
give_item( id, "weapon_ak47" )
cs_set_user_bpammo( id , CSW_AK47, 90
color_print( id , "^4[VIP]^1 Вы получили ^3AK-47" )
return PLUGIN_CONTINUE;
}
public awp ( id )
{
if ( ! ( get_user_flags ( id ) & VIP_FLAG ) )
{
color_print( id , "^4[VIP]^1 Вы не имеете ^3VIP ^1привилегий!" );
return PLUGIN_HANDLED;
}
if ( ! is_user_alive ( id ) )
{
color_print(id, "^4[VIP] ^3Ты мертв - действие невозможно!");
return PLUGIN_HANDLED;
}
if ( g_rounds < 3 )
{
color_print( id , "^4[VIP]^1 Доступно после^4 3 ^1раунда!" );
return PLUGIN_HANDLED;
}
drop_weapons(id, 1)
give_item( id, "weapon_awp" )
cs_set_user_bpammo( id , CSW_AWP, 30 )
color_print( id , "^4[VIP]^1 Вы получили ^3AWP" )
return PLUGIN_CONTINUE;
}
public info_adm(id)
{
show_motd(id, "adminka.txt", "Покупка Админки")
}
stock color_print(id, const input[], any:...)
{
new message[192], player, msg_type
vformat(message, 191, input, 3)
format(message, 191, "^1%s", message)
replace_all(message, 191, "!g", "^4") // !g - зелёный цвет
replace_all(message, 191, "!y", "^1") // !y - стандартный цвет у клиента (обычно жёлтый)
replace_all(message, 191, "!t", "^3") // !t - цвет команды
message[191] = '^0'
if(id)
{
player = id
msg_type = MSG_ONE_UNRELIABLE
}
else
{
for(new i = 1; i <= get_maxplayers(); i++)
{
if(is_user_connected(i))
{
player = i
break
}
}
msg_type = MSG_BROADCAST
}
message_begin(msg_type, get_user_msgid("SayText"), _, player)
write_byte(player)
write_string(message)
message_end()
return 1
}
stock drop_weapons(id, dropwhat)
{
// Get user weapons
static weapons[32], num, i, weaponid
num = 0 // reset passed weapons count (bugfix)
get_user_weapons(id, weapons, num)
// Loop through them and drop primaries or secondaries
for (i = 0; i < num; i++)
{
// Prevent re-indexing the array
weaponid = weapons[i]
if ((dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)) || (dropwhat == 2 && ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM)))
{
// Get weapon entity
static wname[32]
get_weaponname(weaponid, wname, charsmax(wname))
// Player drops the weapon and looses his bpammo
engclient_cmd(id, "drop", wname)
}
}
}