Код
$this_var =
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <fun>
#include <colorchat>
#include <fakemeta_util>
#define VIP_FLAG ADMIN_RESERVATION
#define MODEL_FLAG ADMIN_LEVEL_H
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)
new Vip[33], Model[33], Rus[33]
new const Vip_model_te[] = "models/player/pozz_vipps_te/pozz_vipps_te.mdl"
new const Vip_model_ct[] = "models/player/pozz_vipps_ct/pozz_vipps_ct.mdl"
new const Vip_model_ctt[] = "models/player/pozz_vipps_ct/pozz_vipps_ctt.mdl"
new const Vip_connect[] = "misc/nsk-server/nsk/vip_online.wav"
#define MAX_LANG_ARGS 5
enum
{
PRINT_COLOR_GREY,
PRINT_COLOR_RED,
PRINT_COLOR_BLUE,
PRINT_COLOR_PLAYERTEAM
}
static const g_aszTeamNames[][] =
{
"UNASSIGNED",
"TERRORIST",
"CT",
"SPECTATOR"
}
new g_maxplayers, g_rounds = 0
public plugin_init()
{
register_plugin("VIP", "0.1", "Chaiker")
RegisterHam(Ham_Spawn, "player", "fwd_PlayerSpawn", 1)
RegisterHam(Ham_TakeDamage, "player", "fwd_TakeDamage", 1)
register_clcmd("say /dgl", "cmddgl")
register_clcmd("say /awp", "cmdawp")
register_clcmd("say /m4a1", "cmdm4a1")
register_clcmd("say /ak47", "cmdak47")
register_clcmd("say dgl", "cmddgl")
register_clcmd("say awp", "cmdawp")
register_clcmd("say m4a1", "cmdm4a1")
register_clcmd("say ak47", "cmdak47")
register_clcmd("say /rus", "cmdlang")
register_clcmd("say /eng", "cmdlang")
register_clcmd("say /lang", "cmdlang")
register_clcmd("say .кгы", "cmdlang")
register_clcmd("say .утп", "cmdlang")
register_clcmd("say .дфтп", "cmdlang")
register_clcmd("say", "cmdsay")
register_clcmd("say_team", "cmdsayteam")
g_maxplayers = get_maxplayers()
register_logevent("Event_NewRound", 2, "1=Round_Start")
}
public plugin_precache()
{
precache_model(Vip_model_te)
precache_model(Vip_model_ct)
precache_model(Vip_model_ctt)
precache_sound(Vip_connect)
}
public Event_NewRound()
g_rounds++
public fwd_TakeDamage(victim, inflictor, attacker, Float:damage, shouldgib)
{
if(!is_user_connected(victim) || !is_user_connected(attacker))
return HAM_IGNORED
if(cs_get_user_team(victim) == cs_get_user_team(attacker))
return HAM_IGNORED
if(Vip[victim])
{
set_hudmessage(255, 0, 0, 0.46, 0.52, 0, 6.0, 3.0, 0.1, 0.2, 4)
show_hudmessage(victim, "%d", floatround(damage))
return HAM_IGNORED
}
if(Vip[attacker])
{
set_hudmessage(0, 255, 0, 0.52, 0.52, 0, 6.0, 3.0, 0.1, 0.2, 3)
show_hudmessage(attacker, "%d", floatround(damage))
return HAM_IGNORED
}
return HAM_IGNORED
}
public cmdlang(id)
{
if(!Rus[id])
Rus[id] = true
else
Rus[id] = false
}
public cmddgl(id)
{
if(Vip[id])
{
give_item(id, "weapon_deagle")
cs_set_user_bpammo(id, CSW_DEAGLE, 35)
}
else
PrintChatColor(id, PRINT_COLOR_PLAYERTEAM, "!g[DGL] !yЭто оружие доступно только !tVIP !yигрокам!")
return PLUGIN_HANDLED
}
public cmdawp(id)
{
if(get_user_flags(id) & ADMIN_RESERVATION)
if(g_rounds < 5)
{
PrintChatColor(id, PRINT_COLOR_PLAYERTEAM, "!g[AWP] !yЭто оружие можно брать с !t3!y раунда")
return PLUGIN_HANDLED
}
if(Vip[id])
{
drop_weapons(id, 1)
give_item(id, "weapon_awp")
cs_set_user_bpammo(id, CSW_AWP, 30)
}
else
PrintChatColor(id, PRINT_COLOR_PLAYERTEAM, "!g[AWP] !yЭто оружие доступно только !tVIP !yигрокам!")
return PLUGIN_HANDLED
}
public cmdm4a1(id)
{
if(get_user_flags(id) & ADMIN_RESERVATION)
if(g_rounds < 4)
{
PrintChatColor(id, PRINT_COLOR_PLAYERTEAM, "!g[M4A1] !yЭто оружие можно брать со !t2!y раунда")
return PLUGIN_HANDLED
}
if(Vip[id])
{
drop_weapons(id, 1)
give_item(id, "weapon_m4a1")
cs_set_user_bpammo(id, CSW_M4A1, 90)
}
else
PrintChatColor(id, PRINT_COLOR_PLAYERTEAM, "!g[M4A1] !yЭто оружие доступно только !tVIP !yигрокам!")
return PLUGIN_HANDLED
}
public cmdak47(id)
{
if(get_user_flags(id) & ADMIN_RESERVATION)
if(g_rounds < 4)
{
PrintChatColor(id, PRINT_COLOR_PLAYERTEAM, "!g[AK47] !yЭто оружие можно брать со !t2!y раунда")
return PLUGIN_HANDLED
}
if(Vip[id])
{
drop_weapons(id, 1)
give_item(id, "weapon_ak47")
cs_set_user_bpammo(id, CSW_AK47, 90)
}
else
PrintChatColor(id, PRINT_COLOR_PLAYERTEAM, "!g[AK47] !yЭто оружие доступно только !tVIP !yигрокам!")
return PLUGIN_HANDLED
}
public client_putinserver(id)
{
Rus[id] = false
if(get_user_flags(id) & VIP_FLAG)
{
new name[32]
get_user_name(id, name, 31)
client_cmd(0, "spk sound/%s", Vip_connect)
Vip[id] = true
ColorChat(0, GREY, "^04[VIP] ^03На сервер присоеденился VIP игрок: ^04%s", name)
}
else
Vip[id] = false
if(get_user_flags(id) & MODEL_FLAG)
{
Model[id] = true
} else
Model[id] = false
}
public fwd_PlayerSpawn(id)
{
if(!is_user_alive(id))
return PLUGIN_HANDLED
if(!Vip[id] && !Model[id])
return PLUGIN_CONTINUE
if(Vip[id])
{
give_item(id, "weapon_hegrenade")
give_item(id, "weapon_flashbang")
give_item(id, "weapon_flashbang")
give_item(id, "weapon_smokegrenade")
cs_set_user_armor(id, 100, CsArmorType:2)
message_begin(MSG_ALL, get_user_msgid("ScoreAttrib"))
write_byte(id)
write_byte(4)
message_end()
}
if(cs_get_user_team(id) == CS_TEAM_T && Model[id])
cs_set_user_model(id, "pozz_vipps_te")
if(cs_get_user_team(id) == CS_TEAM_CT && Model[id])
cs_set_user_model(id, "pozz_vipps_ct")
return PLUGIN_CONTINUE
}
public cmdsay(id)
{
if(Vip[id])
{
new Arg[128], name[32], Temp = '"', Finded = false
get_user_name(id, name, 31)
read_args(Arg, 127)
for(new i = 127; 0 < i <= 127; i--)
{
if(Finded)
continue
if(Arg[i] == Temp)
{
//server_print("%s - %c", Arg[i], Temp)
Arg[i] = 0
Finded = true
continue
}
//server_print("%d - %s", i, Arg[i])
}
if(Rus[id])
{
replace_all(Arg, 127, "q", "й")
replace_all(Arg, 127, "w", "ц")
replace_all(Arg, 127, "e", "у")
replace_all(Arg, 127, "r", "к")
replace_all(Arg, 127, "t", "е")
replace_all(Arg, 127, "y", "н")
replace_all(Arg, 127, "u", "г")
replace_all(Arg, 127, "i", "ш")
replace_all(Arg, 127, "o", "щ")
replace_all(Arg, 127, "p", "з")
replace_all(Arg, 127, "[", "х")
replace_all(Arg, 127, "]", "ъ")
replace_all(Arg, 127, "a", "ф")
replace_all(Arg, 127, "s", "ы")
replace_all(Arg, 127, "d", "в")
replace_all(Arg, 127, "f", "а")
replace_all(Arg, 127, "g", "п")
replace_all(Arg, 127, "h", "р")
replace_all(Arg, 127, "j", "о")
replace_all(Arg, 127, "k", "л")
replace_all(Arg, 127, "l", "д")
replace_all(Arg, 127, ";", "ж")
replace_all(Arg, 127, "'", "э")
replace_all(Arg, 127, "z", "я")
replace_all(Arg, 127, "x", "ч")
replace_all(Arg, 127, "c", "с")
replace_all(Arg, 127, "v", "м")
replace_all(Arg, 127, "b", "и")
replace_all(Arg, 127, "n", "т")
replace_all(Arg, 127, "m", "ь")
replace_all(Arg, 127, ",", "б")
replace_all(Arg, 127, ".", "ю")
replace_all(Arg, 127, "/", ".")
replace_all(Arg, 127, "Q", "Й")
replace_all(Arg, 127, "W", "Ц")
replace_all(Arg, 127, "E", "У")
replace_all(Arg, 127, "R", "К")
replace_all(Arg, 127, "T", "Е")
replace_all(Arg, 127, "Y", "Н")
replace_all(Arg, 127, "U", "Г")
replace_all(Arg, 127, "I", "Ш")
replace_all(Arg, 127, "O", "Щ")
replace_all(Arg, 127, "P", "З")
replace_all(Arg, 127, "{", "Х")
replace_all(Arg, 127, "}", "Ъ")
replace_all(Arg, 127, "A", "Ф")
replace_all(Arg, 127, "S", "Ы")
replace_all(Arg, 127, "D", "В")
replace_all(Arg, 127, "F", "А")
replace_all(Arg, 127, "G", "П")
replace_all(Arg, 127, "H", "Р")
replace_all(Arg, 127, "J", "О")
replace_all(Arg, 127, "K", "Л")
replace_all(Arg, 127, "L", "Д")
replace_all(Arg, 127, ":", "Ж")
//replace_all(Arg, 127, '"', "Э")
replace_all(Arg, 127, "Z", "Я")
replace_all(Arg, 127, "X", "Ч")
replace_all(Arg, 127, "C", "С")
replace_all(Arg, 127, "V", "М")
replace_all(Arg, 127, "B", "И")
replace_all(Arg, 127, "N", "Т")
replace_all(Arg, 127, "M", "Ь")
replace_all(Arg, 127, "<", "Б")
replace_all(Arg, 127, ">", "Ю")
replace_all(Arg, 127, "?", ",")
replace_all(Arg, 127, "&", "?")
}
if(is_user_alive(id))
{
for(new i = 1; i <= g_maxplayers; i++)
{
if(!is_user_connected(i))
continue
if(is_user_alive(i))
PrintChatColor(i, PRINT_COLOR_PLAYERTEAM + id, "!t%s !y : !g%s", name, Arg[1])
}
} else
{
for(new i = 1; i <= g_maxplayers; i++)
{
if(!is_user_connected(i))
continue
if(!is_user_alive(i))
PrintChatColor(i, PRINT_COLOR_PLAYERTEAM + id, "!y*DEAD* !t%s !y : !g%s", name, Arg[1])
}
}
return PLUGIN_HANDLED_MAIN
}
return PLUGIN_CONTINUE
}
public cmdsayteam(id)
{
if(Vip[id])
{
new Arg[128], name[32], Temp = '"', Finded = false
get_user_name(id, name, 31)
read_args(Arg, 127)
for(new i = 127; 0 < i <= 127; i--)
{
if(Finded)
continue
if(Arg[i] == Temp)
{
//server_print("%s - %c", Arg[i], Temp)
Arg[i] = 0
Finded = true
continue
}
//server_print("%d - %s", i, Arg[i])
}
if(Rus[id])
{
replace_all(Arg, 127, "q", "й")
replace_all(Arg, 127, "w", "ц")
replace_all(Arg, 127, "e", "у")
replace_all(Arg, 127, "r", "к")
replace_all(Arg, 127, "t", "е")
replace_all(Arg, 127, "y", "н")
replace_all(Arg, 127, "u", "г")
replace_all(Arg, 127, "i", "ш")
replace_all(Arg, 127, "o", "щ")
replace_all(Arg, 127, "p", "з")
replace_all(Arg, 127, "[", "х")
replace_all(Arg, 127, "]", "ъ")
replace_all(Arg, 127, "a", "ф")
replace_all(Arg, 127, "s", "ы")
replace_all(Arg, 127, "d", "в")
replace_all(Arg, 127, "f", "а")
replace_all(Arg, 127, "g", "п")
replace_all(Arg, 127, "h", "р")
replace_all(Arg, 127, "j", "о")
replace_all(Arg, 127, "k", "л")
replace_all(Arg, 127, "l", "д")
replace_all(Arg, 127, ";", "ж")
replace_all(Arg, 127, "'", "э")
replace_all(Arg, 127, "z", "я")
replace_all(Arg, 127, "x", "ч")
replace_all(Arg, 127, "c", "с")
replace_all(Arg, 127, "v", "м")
replace_all(Arg, 127, "b", "и")
replace_all(Arg, 127, "n", "т")
replace_all(Arg, 127, "m", "ь")
replace_all(Arg, 127, ",", "б")
replace_all(Arg, 127, ".", "ю")
replace_all(Arg, 127, "/", ".")
replace_all(Arg, 127, "Q", "Й")
replace_all(Arg, 127, "W", "Ц")
replace_all(Arg, 127, "E", "У")
replace_all(Arg, 127, "R", "К")
replace_all(Arg, 127, "T", "Е")
replace_all(Arg, 127, "Y", "Н")
replace_all(Arg, 127, "U", "Г")
replace_all(Arg, 127, "I", "Ш")
replace_all(Arg, 127, "O", "Щ")
replace_all(Arg, 127, "P", "З")
replace_all(Arg, 127, "{", "Х")
replace_all(Arg, 127, "}", "Ъ")
replace_all(Arg, 127, "A", "Ф")
replace_all(Arg, 127, "S", "Ы")
replace_all(Arg, 127, "D", "В")
replace_all(Arg, 127, "F", "А")
replace_all(Arg, 127, "G", "П")
replace_all(Arg, 127, "H", "Р")
replace_all(Arg, 127, "J", "О")
replace_all(Arg, 127, "K", "Л")
replace_all(Arg, 127, "L", "Д")
replace_all(Arg, 127, ":", "Ж")
//replace_all(Arg, 127, '"', "Э")
replace_all(Arg, 127, "Z", "Я")
replace_all(Arg, 127, "X", "Ч")
replace_all(Arg, 127, "C", "С")
replace_all(Arg, 127, "V", "М")
replace_all(Arg, 127, "B", "И")
replace_all(Arg, 127, "N", "Т")
replace_all(Arg, 127, "M", "Ь")
replace_all(Arg, 127, "<", "Б")
replace_all(Arg, 127, ">", "Ю")
replace_all(Arg, 127, "?", ",")
replace_all(Arg, 127, "&", "?")
}
if(cs_get_user_team(id) == CS_TEAM_CT)
{
if(is_user_alive(id))
{
for(new i = 1; i <= g_maxplayers; i++)
{
if(!is_user_connected(i))
continue
if(is_user_alive(i) && cs_get_user_team(id) == CS_TEAM_CT)
PrintChatColor(i, PRINT_COLOR_PLAYERTEAM + id, "!y(Counter-Terrorist) !t%s !y : !g%s", name, Arg[1])
}
} else
{
for(new i = 1; i <= g_maxplayers; i++)
{
if(!is_user_connected(i))
continue
if(!is_user_alive(i) && cs_get_user_team(id) == CS_TEAM_CT)
PrintChatColor(i, PRINT_COLOR_PLAYERTEAM + id, "!y*DEAD* (Counter-Terrorist) !t%s !y : !g%s", name, Arg[1])
}
}
} else if(cs_get_user_team(id) == CS_TEAM_T)
{
if(is_user_alive(id))
{
for(new i = 1; i <= g_maxplayers; i++)
{
if(!is_user_connected(i))
continue
if(is_user_alive(i) && cs_get_user_team(id) == CS_TEAM_T)
PrintChatColor(i, PRINT_COLOR_PLAYERTEAM + id, "!y(Terrorist) !t%s !y : !g%s", name, Arg[1])
}
} else
{
for(new i = 1; i <= g_maxplayers; i++)
{
if(!is_user_connected(i))
continue
if(!is_user_alive(i) && cs_get_user_team(id) == CS_TEAM_T)
PrintChatColor(i, PRINT_COLOR_PLAYERTEAM + id, "!y*DEAD* (Terrorist) !t%s !y : !g%s", name, Arg[1])
}
}
} else if(cs_get_user_team(id) == CS_TEAM_SPECTATOR)
{
if(is_user_alive(id))
{
for(new i = 1; i <= g_maxplayers; i++)
{
if(!is_user_connected(i))
continue
if(cs_get_user_team(id) == CS_TEAM_SPECTATOR)
PrintChatColor(i, PRINT_COLOR_PLAYERTEAM + id, "!y(Spectator) !t%s !y : !g%s", name, Arg[1])
}
}
}
return PLUGIN_HANDLED_MAIN
}
return PLUGIN_CONTINUE
}
stock PrintChatColor(pReceiver, iColor = PRINT_COLOR_PLAYERTEAM, const szMessage[], any:...)
{
new szBuffer[256]
new iArgs = numargs()
if(pReceiver)
{
for(new iArg = 3; iArg < iArgs; iArg++)
{
if(getarg(iArg) != LANG_PLAYER)
continue
setarg(iArg, _, pReceiver)
}
vformat(szBuffer, 255, szMessage, 4)
while (replace(szBuffer, 255, "!y", "^1")) {}
while (replace(szBuffer, 255, "!t", "^3")) {}
while (replace(szBuffer, 255, "!g", "^4")) {}
if (iColor >= PRINT_COLOR_PLAYERTEAM)
UTIL_SayText(MSG_ONE, _, pReceiver, (iColor > PRINT_COLOR_PLAYERTEAM) ? iColor - PRINT_COLOR_PLAYERTEAM : pReceiver, szBuffer)
else
{
new iTeam = _:cs_get_user_team(pReceiver)
if(iTeam % 3 == iColor)
UTIL_SayText(MSG_ONE, _, pReceiver, pReceiver, szBuffer)
else
{
UTIL_TeamInfo(MSG_ONE, _, pReceiver, pReceiver, g_aszTeamNames[iColor])
UTIL_SayText(MSG_ONE, _, pReceiver, pReceiver, szBuffer)
UTIL_TeamInfo(MSG_ONE, _, pReceiver, pReceiver, g_aszTeamNames[iTeam])
}
}
}
else
{
new aiChangeArgs[MAX_LANG_ARGS]
new iChangeArgs, iArg
for(iArg = 3; iArg < iArgs; iArg++)
{
if(getarg(iArg) != LANG_PLAYER)
continue
aiChangeArgs[iChangeArgs++] = iArg
if (iChangeArgs == MAX_LANG_ARGS)
break
}
new apPlayers[32]
new iPlayers
new pPlayer
get_players(apPlayers, iPlayers)
for(new i = 0; i < iPlayers; i++)
{
pPlayer = apPlayers[i]
for(iArg = 0; iArg < iChangeArgs; iArg++)
setarg(aiChangeArgs[iArg], _, pPlayer)
vformat(szBuffer, 255, szMessage, 4)
while (replace(szBuffer, 255, "!y", "^1")) {}
while (replace(szBuffer, 255, "!t", "^3")) {}
while (replace(szBuffer, 255, "!g", "^4")) {}
if(iColor >= PRINT_COLOR_PLAYERTEAM)
UTIL_SayText(MSG_ONE, _, pPlayer, (iColor > PRINT_COLOR_PLAYERTEAM) ? iColor - PRINT_COLOR_PLAYERTEAM : pPlayer, szBuffer)
else
{
new iTeam = _:cs_get_user_team(pPlayer);
if(iTeam % 3 == iColor)
UTIL_SayText(MSG_ONE, _, pPlayer, pPlayer, szBuffer)
else
{
UTIL_TeamInfo(MSG_ONE, _, pPlayer, pPlayer, g_aszTeamNames[iColor])
UTIL_SayText(MSG_ONE, _, pPlayer, pPlayer, szBuffer)
UTIL_TeamInfo(MSG_ONE, _, pPlayer, pPlayer, g_aszTeamNames[iTeam])
}
}
}
}
}
stock UTIL_SayText(iDest, const vecOrigin[3] = {0, 0, 0}, pEntity, pSender, const szMessage[], const szArg1[] = "", const szArg2[] = "")
{
static msgSayText
if(!msgSayText)
msgSayText = get_user_msgid("SayText")
message_begin(iDest, msgSayText, vecOrigin, pEntity)
write_byte(pSender)
write_string(szMessage)
if(szArg1[0])
{
write_string(szArg1)
if(szArg2[0])
write_string(szArg2)
}
message_end()
}
stock UTIL_TeamInfo(iDest, const vecOrigin[3] = { 0, 0, 0 }, pEntity, pPlayer, const szTeamName[])
{
static msgTeamInfo
if(!msgTeamInfo)
msgTeamInfo = get_user_msgid("TeamInfo")
message_begin(iDest, msgTeamInfo, vecOrigin, pEntity)
write_byte(pPlayer)
write_string(szTeamName)
message_end()
}
stock drop_weapons(id, dropwhat)
{
static weapons[32], num, i, weaponid
num = 0
get_user_weapons(id, weapons, num)
for (i = 0; i < num; i++)
{
weaponid = weapons[i]
if ((dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)))
{
static wname[32], weapon_ent
get_weaponname(weaponid, wname, charsmax(wname))
weapon_ent = fm_find_ent_by_owner(-1, wname, id)
set_pev(weapon_ent, pev_iuser1, cs_get_user_bpammo(id, weaponid))
engclient_cmd(id, "drop", wname)
}
}
};