#include <amxmodx>
#include <amxmisc>
#include <cso_gdm>
#include <cstrike>
#include <csx>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <fun>
#include <hamsandwich>
#include <mapname_patcher>
#define PLUGIN "[CSO] Gun Deathmatch"
#define VERSION "1.0.1"
#define AUTHOR "RaZzoR"
#define DICTIONARY "cso_gun_deathmatch.txt"
#define USE_CSO_SKINS
#if defined USE_CSO_SKINS
new const old_v_models[][] = {
"models/v_ak47.mdl",
"models/v_aug.mdl",
"models/v_awp.mdl",
"models/v_deagle.mdl",
"models/v_elite.mdl",
"models/v_famas.mdl",
"models/v_fiveseven.mdl",
"models/v_g3sg1.mdl",
"models/v_galil.mdl",
"models/v_glock18.mdl",
"models/v_hegrenade.mdl",
"models/v_knife.mdl",
"models/v_m3.mdl",
"models/v_m4a1.mdl",
"models/v_m249.mdl",
"models/v_mac10.mdl",
"models/v_mp5.mdl",
"models/v_p90.mdl",
"models/v_p228.mdl",
"models/v_scout.mdl",
"models/v_sg550.mdl",
"models/v_sg552.mdl",
"models/v_tmp.mdl",
"models/v_xm1014.mdl"
}
new const new_v_models[][] = {
"models/cso_gun_deathmatch/v_ak47.mdl",
"models/cso_gun_deathmatch/v_aug.mdl",
"models/cso_gun_deathmatch/v_awp.mdl",
"models/cso_gun_deathmatch/v_deagle.mdl",
"models/cso_gun_deathmatch/v_elite.mdl",
"models/cso_gun_deathmatch/v_famas.mdl",
"models/cso_gun_deathmatch/v_fiveseven.mdl",
"models/cso_gun_deathmatch/v_g3sg1.mdl",
"models/cso_gun_deathmatch/v_galil.mdl",
"models/cso_gun_deathmatch/v_glock18.mdl",
"models/cso_gun_deathmatch/v_hegrenade.mdl",
"models/cso_gun_deathmatch/v_knife.mdl",
"models/cso_gun_deathmatch/v_m3.mdl",
"models/cso_gun_deathmatch/v_m4a1.mdl",
"models/cso_gun_deathmatch/v_m249.mdl",
"models/cso_gun_deathmatch/v_mac10.mdl",
"models/cso_gun_deathmatch/v_mp5.mdl",
"models/cso_gun_deathmatch/v_p90.mdl",
"models/cso_gun_deathmatch/v_p228.mdl",
"models/cso_gun_deathmatch/v_scout.mdl",
"models/cso_gun_deathmatch/v_sg550.mdl",
"models/cso_gun_deathmatch/v_sg552.mdl",
"models/cso_gun_deathmatch/v_tmp.mdl",
"models/cso_gun_deathmatch/v_xm1014.mdl"
}
#endif
new const allow_maps[][][] = {
{ "cs_assault", "Assault" },
{ "cs_camouflage_cso", "Camouflage" },
{ "cs_italy", "Italy" },
{ "de_dust", "Dust" },
{ "de_dust2", "Dust 2" },
{ "de_inferno", "Inferno" },
{ "de_rats", "Mouse Hole" },
{ "dm_gallery_cso", "Gallery" },
{ "dm_industry2", "Industrial 2" },
{ "dm_suzhou", "Suzhou" },
{ "fun_checkmate", "Checkmate" }
}
new const gdm_weapons[][][] = {
{ "", "", "" }, //Not Use
{ "M4A1", "weapon_m4a1", "90" }, //1
{ "AK-47", "weapon_ak47", "90" }, //2
{ "M14 EBR", "weapon_m14", "" },
{ "SG550 Commando", "weapon_sg550", "90" }, //4
{ "G3/SG-1", "weapon_g3sg1", "90" }, //5
{ "MG36", "weapon_mg36", "" },
{ "TAR-21", "weapon_tar21", "" },
{ "AUG", "weapon_aug", "90" }, //8
{ "SG552", "weapon_sg552", "90" }, //9
{ "AS50", "weapon_as50", "" },
{ "M16A4", "weapon_m16a4", "" },
{ "AN94", "weapon_an94", "" },
{ "M14 EBR", "weapon_m14", "" },
{ "StG44", "weapon_stg44", "" },
{ "AWP", "weapon_awp", "30" }, //15
{ "XM2010", "weapon_xm2010", "" },
{ "SVD", "weapon_svd", "" },
{ "Barrett M95", "weapon_m95", "" },
{ "SCAR", "weapon_scar", "" },
{ "XM-8", "weapon_xm8", "" },
{ "XM2010", "weapon_xm2010", "" },
{ "M24", "weapon_m24", "" },
{ "FAMAS", "weapon_famas", "90" }, //23
{ "Galil", "weapon_galil", "90" }, //24
{ "Kriss Super V", "weapon_kriss", "" },
{ "K1A", "weapon_k1a", "" },
{ "USAS12", "weapon_usas12", "" },
{ "Thompson Chicago", "weapon_thompson", "" },
{ "MP5", "weapon_mp5navy", "120" }, //29
{ "StG44", "weapon_stg44", "" },
{ "MP7A1", "weapon_mp7a1", "" },
{ "M3", "weapon_m3", "32" }, //32
{ "XM1014 Automatic Shotgun", "weapon_xm1014", "32" }, //33
{ "Winchester M1887", "weapon_m1887", "" },
{ "KSG12", "weapon_ksg12", "" },
{ "M249", "weapon_m249", "200" }, //36
{ "HK23", "weapon_hk23", "" },
{ "QBB95", "weapon_qbb95", "" },
{ "MG36", "weapon_mg36", "" },
{ "Scout", "weapon_scout", "90" }, //40
{ "P90", "weapon_p90", "100" }, //41
{ "Kriss Super V", "weapon_kriss", "" },
{ "Desert Eagle 50C", "weapon_deagle", "35" }, //43
{ "Dual Beretta", "weapon_elite", "120" }, //44
{ "Anaconda", "weapon_anaconda", "" },
{ "Dual Infinity", "weapon_dinfinity", "" },
{ "TMP", "weapon_tmp", "120" }, //47
{ "MAC-10", "weapon_mac10", "100" }, //48
{ "Infinity Black", "weapon_infib", "" },
{ "P228", "weapon_p228", "52" }, //50
{ "Five-Seven", "weapon_fiveseven", "100" }, //51
{ "Infinity Silver", "weapon_infis", "" },
{ "Glock 18C", "weapon_glock18", "120" } //53
}
new const Float:gdm_wpnhudpos[][] = {
{ 0.00, 0.00 }, //Not Use
{ 0.95, 0.90 },
{ 0.94, 0.90 },
{ 0.92, 0.90 },
{ 0.86, 0.90 },
{ 0.93, 0.90 },
{ 0.94, 0.90 },
{ 0.93, 0.90 },
{ 0.95, 0.90 },
{ 0.94, 0.90 },
{ 0.95, 0.90 },
{ 0.93, 0.90 },
{ 0.94, 0.90 },
{ 0.92, 0.90 },
{ 0.94, 0.90 },
{ 0.95, 0.90 },
{ 0.93, 0.90 },
{ 0.96, 0.90 },
{ 0.90, 0.90 },
{ 0.95, 0.90 },
{ 0.95, 0.90 },
{ 0.93, 0.90 },
{ 0.95, 0.90 },
{ 0.93, 0.90 },
{ 0.95, 0.90 },
{ 0.90, 0.90 },
{ 0.96, 0.90 },
{ 0.93, 0.90 },
{ 0.85, 0.90 },
{ 0.95, 0.90 },
{ 0.94, 0.90 },
{ 0.94, 0.90 },
{ 0.96, 0.90 },
{ 0.79, 0.90 },
{ 0.85, 0.90 },
{ 0.94, 0.90 },
{ 0.94, 0.90 },
{ 0.94, 0.90 },
{ 0.94, 0.90 },
{ 0.94, 0.90 },
{ 0.94, 0.90 },
{ 0.96, 0.90 },
{ 0.90, 0.90 },
{ 0.86, 0.90 },
{ 0.90, 0.90 },
{ 0.91, 0.90 },
{ 0.90, 0.90 },
{ 0.95, 0.90 },
{ 0.93, 0.90 },
{ 0.89, 0.90 },
{ 0.95, 0.90 },
{ 0.90, 0.90 },
{ 0.89, 0.90 },
{ 0.91, 0.90 }
}
new const objective_icons[][] = {
"c4",
"buyzone",
"rescue",
"escape",
"vipsafety"
}
new const gdm_blockmsgs[][] = {
"#Terrorists_Escaped",
"#Hint_ct_vip_zone",
"#Hint_hostage_rescue_zone",
"#Hint_you_are_in_targetzone",
"#Hint_you_are_the_vip",
"#Hint_you_have_the_bomb",
"#Hint_terrorist_vip_zone",
"#Hint_terrorist_escape_zone"
}
new const gdm_sounds[][] = {
"cso_gun_deathmatch/finalattack.wav",
"cso_gun_deathmatch/weaponchange.wav"
}
new const gdm_reqkills[] = {
0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 43, 46, 48, 51, 54, 57, 60
}
new const gdm_cs_weapons[] = {
1, 2, 4, 5, 8, 9, 15, 23, 24, 29, 32, 33, 36, 40, 41, 43, 44, 47, 48, 50, 51, 53
}
new const gdm_hos_4[] = {
0, 4, 8, 12, 16, 20, 24, 28, 32, 36
}
new const gdm_hos_3[] = {
1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 40, 43, 48, 51, 54, 57
}
new const gdm_hos_2[] = {
2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 41, 44, 46, 49, 52, 55, 58
}
new const gdm_hos_1[] = {
3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 42, 45, 47, 50, 53, 56, 59
}
new const gdm_gamename[] = "Gun Deathmatch"
const m_iJoiningState = 121
const m_iMenu = 205
const MENU_CHOOSEAPPEARANCE = 3
const JOIN_CHOOSEAPPEARANCE = 4
new gdm_weapon[33], gdm_level[33]
new pcvar_max_kill, wpn_hud, top3_hud, bot_register, score_hud, tr_score, ct_score, random_map
new bool:gdm_has_grenade[33] = false
public plugin_init()
{
register_dictionary(DICTIONARY)
new map_name[32], buffer[128], index
get_mapname(map_name, 31)
for(index=0;index<sizeof(allow_maps);index++)
{
if(equal(map_name, allow_maps[index][0]))
{
if(strlen(allow_maps[index][1]) > 0)
Patch_MapName(allow_maps[index][1])
break
}
}
if(index == sizeof(allow_maps))
{
formatex(buffer, sizeof(buffer), "%L", LANG_SERVER, "GDM_WRONG_MAP")
set_fail_state(buffer)
return
}
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("gdm_version", VERSION, FCVAR_SERVER|FCVAR_SPONLY)
set_msg_block(get_user_msgid("ClCorpse"), BLOCK_SET)
pcvar_max_kill = register_cvar("GunDM_Max_Score", "800")
register_clcmd("menuselect", "ClCmd_MenuSelect_JoinClass")
register_clcmd("joinclass", "ClCmd_MenuSelect_JoinClass")
register_message(get_user_msgid("StatusIcon"), "msgStatusIcon")
register_message(get_user_msgid("RoundTime"),"Event_RoundTime")
register_message(get_user_msgid("HideWeapon"), "msgHideWeapon")
register_message(get_user_msgid("Money"), "MsgMoney")
register_message(get_user_msgid("TextMsg"), "msgTextMsg")
register_forward(FM_SetModel, "SetModel")
register_forward(FM_GetGameDescription, "GameDesc")
register_forward(FM_ClientKill, "Forward_ClientKill")
RegisterHam(Ham_Spawn, "player", "Spawn", 1)
RegisterHam(Ham_Touch, "armoury_entity", "FwdHamPickupWeapon")
RegisterHam(Ham_Touch, "weaponbox", "FwdHamPickupWeapon")
register_clcmd("drop", "block_drop")
register_clcmd("chooseteam", "block_chooseteam")
register_event("BombDrop", "Event_BombDropped", "a", "4=1")
register_event("ResetHUD", "onResetHUD", "b")
#if defined USE_CSO_SKINS
register_event("CurWeapon","Weapon_Hook","be","1=1")
#endif
wpn_hud = CreateHudSyncObj(1)
top3_hud = CreateHudSyncObj(2)
score_hud = CreateHudSyncObj(3)
TOP3_HUD()
random_map = random(sizeof(allow_maps))
}
public plugin_cfg()
server_cmd("sv_restart 1")
public plugin_precache()
{
#if defined USE_CSO_SKINS
for(new i;i<sizeof(new_v_models);i++)
precache_model(new_v_models[i])
#endif
for(new i;i<sizeof(gdm_sounds);i++)
precache_sound(gdm_sounds[i])
}
#if defined USE_CSO_SKINS
public Weapon_Hook(id)
{
if(!is_user_alive(id))
return PLUGIN_CONTINUE
static model[32]
pev(id, pev_viewmodel2, model, 31)
for(new i=0;i<sizeof(new_v_models);i++)
{
if(equali(model, old_v_models[i]))
{
set_pev(id, pev_viewmodel2, new_v_models[i])
break
}
}
return PLUGIN_CONTINUE
}
#endif
public ClCmd_MenuSelect_JoinClass(id)
{
if(get_pdata_int(id, m_iMenu) == MENU_CHOOSEAPPEARANCE && get_pdata_int(id, m_iJoiningState) == JOIN_CHOOSEAPPEARANCE)
{
new command[11], arg1[32]
read_argv(0, command, charsmax(command))
read_argv(1, arg1, charsmax(arg1))
engclient_cmd(id, command, arg1)
ExecuteHam(Ham_Player_PreThink, id)
if(!is_user_alive(id))
ExecuteHamB(Ham_Spawn, id)
ScoreBoard_HUD(id)
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public msgTextMsg(msg_id, msg_dest, msg_entity)
{
static message[32]
get_msg_arg_string(2, message, charsmax(message))
for(new i=0;i<sizeof(gdm_blockmsgs);i++)
{
if(equal(message, gdm_blockmsgs[i]))
return PLUGIN_CONTINUE
}
return PLUGIN_HANDLED
}
public onResetHUD(id)
{
if(!is_user_connected(id))
return
message_begin(MSG_ONE, get_user_msgid("HideWeapon"), _, id)
write_byte((1<<5))
message_end()
}
public msgStatusIcon(msgid, msgdest, id)
{
static szIcon[11]
get_msg_arg_string(2, szIcon, 10)
for(new i=0;i<sizeof(objective_icons);i++)
{
if(equal(szIcon, objective_icons[i]) && get_msg_arg_int(1))
{
set_pdata_int(id, 235, get_pdata_int(id, 235) & ~(1<<0))
return PLUGIN_HANDLED
}
}
return PLUGIN_CONTINUE
}
public Event_BombDropped()
{
message_begin(MSG_BROADCAST, get_user_msgid("ShowTimer"))
message_end()
}
public block_drop(id)
return PLUGIN_HANDLED
public block_chooseteam(id)
return PLUGIN_HANDLED
public Forward_ClientKill(id)
return FMRES_SUPERCEDE
public FwdHamPickupWeapon()
return HAM_SUPERCEDE
public Event_RoundTime(const MsgId, const MsgDest, const MsgEnt)
set_msg_arg_int(1, ARG_SHORT, get_timeleft())
public msgHideWeapon()
set_msg_arg_int(1, ARG_BYTE, get_msg_arg_int(1) | (1<<5))
public MsgMoney(msgid, dest, id)
{
set_pdata_int(id, 115, 0)
set_msg_arg_int(1, ARG_LONG, 0)
}
public SetModel(iEnt, szModel[])
{
if(equal(szModel, "models/w_", 9))
{
if(szModel[9] != 'h' && !equal(szModel[9], "sm", 2) && !equal(szModel[9], "fl", 2))
set_pev(iEnt, pev_nextthink, get_gametime() + 10.0)
}
}
public client_connect(id)
{
gdm_level[id] = 1
gdm_has_grenade[id] = false
switch(random(3))
{
case 0: gdm_weapon[id] = 1
case 1: gdm_weapon[id] = 2
case 2: gdm_weapon[id] = 3
}
}
public client_putinserver(id)
{
if(!bot_register && is_user_bot(id))
{
bot_register = 1
set_task(0.2, "do_register", id)
}
}
public do_register(id)
{
RegisterHamFromEntity(Ham_Spawn, id, "Spawn", 1)
RegisterHamFromEntity(Ham_Touch, id, "FwdHamPickupWeapon")
}
public client_death(attacker, victim, wpnindex, hitplace, TK)
{
new atk_frags = get_user_frags(attacker)
new attacker_name[32]
get_user_name(attacker, attacker_name, charsmax(attacker_name))
if(attacker == victim)
set_task(3.0, "respawn_task", attacker)
else
set_task(3.0, "respawn_task", victim)
switch(wpnindex)
{
case CSW_GLOCK18:
{
if(gdm_has_grenade[attacker]) return
give_item(attacker, "weapon_hegrenade")
gdm_has_grenade[attacker] = true
client_print(0, print_center, "%L", LANG_PLAYER, "GDM_FINAL_HE", attacker_name)
}
case CSW_HEGRENADE:
{
if(attacker == victim) return
switch(get_user_team(attacker))
{
case 1: client_print(0, print_center, "%L %L: %s", LANG_PLAYER, "GDM_TR_WIN", LANG_PLAYER, "GDM_NEXTMAP", strlen(allow_maps[random_map][1]) > 0 ? allow_maps[random_map][1] : allow_maps[random_map][0])
case 2: client_print(0, print_center, "%L %L: %s", LANG_PLAYER, "GDM_CT_WIN", LANG_PLAYER, "GDM_NEXTMAP", strlen(allow_maps[random_map][1]) > 0 ? allow_maps[random_map][1] : allow_maps[random_map][0])
}
new players[32], pnum, tempid
get_players(players, pnum)
for(new i=0;i<pnum;i++)
{
tempid = players[i]
set_user_godmode(tempid, 1)
}
set_task(1.5, "map_change")
}
}
switch(get_user_team(attacker))
{
case 1: tr_score++
case 2: ct_score++
}
if(gdm_level[attacker] < 17)
{
while(atk_frags >= gdm_reqkills[gdm_level[attacker]])
{
gdm_level[attacker]++
switch(gdm_level[attacker])
{
case 2, 9, 17: gdm_weapon[attacker] += 3
case 3: gdm_weapon[attacker] = 7
case 4:
{
switch(random(3))
{
case 0: gdm_weapon[attacker] = 8
case 1: gdm_weapon[attacker] = 9
case 2: gdm_weapon[attacker] = 10
}
}
case 5:
{
switch(random(4))
{
case 0: gdm_weapon[attacker] = 11
case 1: gdm_weapon[attacker] = 12
case 2: gdm_weapon[attacker] = 13
case 3: gdm_weapon[attacker] = 14
}
}
case 6, 12: gdm_weapon[attacker] += 4
case 7:
{
switch(random(4))
{
case 0: gdm_weapon[attacker] = 19
case 1: gdm_weapon[attacker] = 20
case 2: gdm_weapon[attacker] = 21
case 3: gdm_weapon[attacker] = 22
}
}
case 8:
{
switch(random(3))
{
case 0: gdm_weapon[attacker] = 23
case 1: gdm_weapon[attacker] = 24
case 2: gdm_weapon[attacker] = 25
}
}
case 10:
{
switch(random(3))
{
case 0: gdm_weapon[attacker] = 29
case 1: gdm_weapon[attacker] = 30
case 2: gdm_weapon[attacker] = 31
}
}
case 11:
{
switch(random(4))
{
case 0: gdm_weapon[attacker] = 32
case 1: gdm_weapon[attacker] = 33
case 2: gdm_weapon[attacker] = 34
case 3: gdm_weapon[attacker] = 35
}
}
case 13: gdm_weapon[attacker] = 40
case 14:
{
switch(random(2))
{
case 0: gdm_weapon[attacker] = 41
case 1: gdm_weapon[attacker] = 42
}
}
case 15:
{
switch(random(4))
{
case 0: gdm_weapon[attacker] = 43
case 1: gdm_weapon[attacker] = 44
case 2: gdm_weapon[attacker] = 45
case 3: gdm_weapon[attacker] = 46
}
}
case 16:
{
switch(random(3))
{
case 0: gdm_weapon[attacker] = 47
case 1: gdm_weapon[attacker] = 48
case 2: gdm_weapon[attacker] = 49
}
}
}
strip_user_weapons(attacker)
give_item(attacker, "weapon_knife")
reset_cso_weapons(attacker, gdm_level[attacker])
for(new i=0;i<sizeof(gdm_cs_weapons);i++)
{
if(gdm_weapon[attacker] == gdm_cs_weapons[i])
{
new weapon_id = get_weaponid(gdm_weapons[gdm_weapon[attacker]][1])
new convert_to_num = str_to_num(gdm_weapons[gdm_weapon[attacker]][2])
give_item(attacker, gdm_weapons[gdm_weapon[attacker]][1])
cs_set_user_bpammo(attacker, weapon_id, convert_to_num)
}
else if(gdm_weapon[attacker] != gdm_cs_weapons[i])
{
new buffer[128]
formatex(buffer, sizeof(buffer), "%s.amxx", gdm_weapons[gdm_weapon[attacker]][1])
if(callfunc_begin(gdm_weapons[gdm_weapon[attacker]][1], buffer) == 1)
{
callfunc_push_int(attacker)
callfunc_end()
}
}
}
client_cmd(attacker, "speak ^"%s^"", gdm_sounds[1])
client_print(attacker, print_center, "%L %s", attacker, "GDM_WPNCHANGE", gdm_weapons[gdm_weapon[attacker]][0])
}
}
else
{
if(atk_frags == 60)
{
gdm_level[attacker] = 18
gdm_weapon[attacker] = 53
strip_user_weapons(attacker)
give_item(attacker, "weapon_knife")
reset_cso_weapons(attacker, gdm_level[attacker])
new weapon_id = get_weaponid(gdm_weapons[gdm_weapon[attacker]][1])
new convert_to_num = str_to_num(gdm_weapons[gdm_weapon[attacker]][2])
give_item(attacker, gdm_weapons[gdm_weapon[attacker]][1])
cs_set_user_bpammo(attacker, weapon_id, convert_to_num)
client_cmd(attacker, "speak ^"%s^"", gdm_sounds[0])
client_print(attacker, print_center, "%L %s", attacker, "GDM_FINALATK", gdm_weapons[gdm_weapon[attacker]][0])
}
}
if(tr_score == get_pcvar_num(pcvar_max_kill) || ct_score == get_pcvar_num(pcvar_max_kill))
{
if(tr_score == get_pcvar_num(pcvar_max_kill))
client_print(0, print_center, "%L %L: %s", LANG_PLAYER, "GDM_TR_WIN", LANG_PLAYER, "GDM_NEXTMAP", strlen(allow_maps[random_map][1]) > 0 ? allow_maps[random_map][1] : allow_maps[random_map][0])
else
client_print(0, print_center, "%L %L: %s", LANG_PLAYER, "GDM_CT_WIN", LANG_PLAYER, "GDM_NEXTMAP", strlen(allow_maps[random_map][1]) > 0 ? allow_maps[random_map][1] : allow_maps[random_map][0])
new players[32], pnum, tempid
get_players(players, pnum)
for(new i=0;i<pnum;i++)
{
tempid = players[i]
set_user_godmode(tempid, 1)
}
set_task(1.5, "map_change")
}
}
public grenade_throw(id, gid, wid)
gdm_has_grenade[id] = false
public map_change()
{
new players[32], pnum, tempid
get_players(players, pnum)
for(new i=0;i<pnum;i++)
{
tempid = players[i]
set_user_godmode(tempid, 0)
}
server_cmd("changelevel %s", allow_maps[random_map][0])
}
public GameDesc()
{
forward_return(FMV_STRING, gdm_gamename)
return FMRES_SUPERCEDE
}
public respawn_task(id)
ExecuteHamB(Ham_CS_RoundRespawn, id)
public Spawn(id)
{
if(!is_user_connected(id)) return
set_user_health(id, 100)
set_user_armor(id, 100)
new weapon_name[15]
switch(get_user_team(id))
{
case 1: weapon_name = "weapon_glock18"
case 2: weapon_name = "weapon_usp"
default: return
}
new weapon = find_ent_by_owner(-1, weapon_name, id)
if(!weapon) return
engclient_cmd(id, "drop", weapon_name)
new weaponbox = entity_get_edict(weapon, EV_ENT_owner)
if(!weaponbox || weaponbox == id) return
remove_entity(weaponbox)
remove_entity(weapon)
for(new i=0;i<sizeof(gdm_cs_weapons);i++)
{
if(gdm_weapon[id] == gdm_cs_weapons[i])
{
new weapon_id = get_weaponid(gdm_weapons[gdm_weapon[id]][1])
new convert_to_num = str_to_num(gdm_weapons[gdm_weapon[id]][2])
give_item(id, gdm_weapons[gdm_weapon[id]][1])
cs_set_user_bpammo(id, weapon_id, convert_to_num)
}
else if(gdm_weapon[id] != gdm_cs_weapons[i])
{
new buffer[128]
formatex(buffer, sizeof(buffer), "%s.amxx", gdm_weapons[gdm_weapon[id]][1])
if(callfunc_begin(gdm_weapons[gdm_weapon[id]][1], buffer) == 1)
{
callfunc_push_int(id)
callfunc_end()
}
}
}
if(gdm_has_grenade[id])
give_item(id, "weapon_hegrenade")
set_user_godmode(id, 1)
set_rendering(id, kRenderFxGlowShell, 255, 255, 255, kRenderNormal, 16)
set_task(3.0, "remove_protection", id)
}
public remove_protection(id)
{
set_user_godmode(id, 0)
set_rendering(id, kRenderFxNone, 0, 0, 0, kRenderNormal, 0)
}
public client_PostThink(id)
{
if(!is_user_alive(id)) return
new iSprite[16]
message_begin(MSG_ONE, get_user_msgid("Scenario"), {0,0,0}, id)
write_byte(1)
for(new i=0;i<sizeof(gdm_hos_4);i++)
{
if(get_user_frags(id) == gdm_hos_4[i])
format(iSprite, 15, "hostage4")
}
for(new i=0;i<sizeof(gdm_hos_3);i++)
{
if(get_user_frags(id) == gdm_hos_3[i])
format(iSprite, 15, "hostage3")
}
for(new i=0;i<sizeof(gdm_hos_2);i++)
{
if(get_user_frags(id) == gdm_hos_2[i])
format(iSprite, 15, "hostage2")
}
for(new i=0;i<sizeof(gdm_hos_1);i++)
{
if(get_user_frags(id) == gdm_hos_1[i])
format(iSprite, 15, "hostage1")
}
write_string(iSprite)
write_byte(127)
write_short(0)
message_end()
}
public ScoreBoard_HUD(id)
{
/* ScoreBoard */
set_hudmessage(255, 255, 255, -1.0, 0.00, 0, 6.0, 12.0)
if(gdm_level[id] <= 17)
ShowSyncHudMsg(id, score_hud, "TR %i [%i %L] CT %i ^n%L %i", tr_score, get_pcvar_num(pcvar_max_kill), id, "GDM_KILL", ct_score, id, "GDM_LV", gdm_level[id])
else
ShowSyncHudMsg(id, score_hud, "TR %i [%i %L] CT %i ^n%L Max", tr_score, get_pcvar_num(pcvar_max_kill), id, "GDM_KILL", ct_score, id, "GDM_LV")
/* Weapons */
set_hudmessage(255, 212, 0, gdm_wpnhudpos[gdm_weapon[id]][0], gdm_wpnhudpos[gdm_weapon[id]][1], 0, 6.0, 12.0)
ShowSyncHudMsg(id, wpn_hud, "%s", gdm_weapons[gdm_weapon[id]][0])
set_task(0.2, "ScoreBoard_HUD", id)
}
public TOP3_HUD()
{
/* TOP3 */
new players[32], num, top1, top2, top3
new top1_name[33], top2_name[33], top3_name[33]
get_players(players, num)
SortCustom1D(players, num, "sort_bestplayer")
top1 = players[0]
top2 = players[1]
top3 = players[2]
get_user_name(top1, top1_name, charsmax(top1_name))
get_user_name(top2, top2_name, charsmax(top2_name))
get_user_name(top3, top3_name, charsmax(top3_name))
set_hudmessage(0, 255, 255, -0.00, 0.21, 0, 6.0, 12.0)
if(get_user_frags(top1) >= 1)
{
if(gdm_level[top1] <= 17)
ShowSyncHudMsg(0, top3_hud, "%L %L%i %s", LANG_PLAYER, "GDM_1ST", LANG_PLAYER, "GDM_LV", gdm_level[top1], top1_name)
else
ShowSyncHudMsg(0, top3_hud, "%L %LMax %s", LANG_PLAYER, "GDM_1ST", LANG_PLAYER, "GDM_LV", top1_name)
}
if(get_user_frags(top2) >= 1)
{
if(gdm_level[top1] <= 17 && gdm_level[top2] <= 17)
ShowSyncHudMsg(0, top3_hud, "%L %L%i %s ^n%L %L%i %s", LANG_PLAYER, "GDM_1ST", LANG_PLAYER, "GDM_LV", gdm_level[top1], top1_name, LANG_PLAYER, "GDM_2ND", LANG_PLAYER, "GDM_LV", gdm_level[top2], top2_name)
else if(gdm_level[top1] > 17 && gdm_level[top2] <= 17)
ShowSyncHudMsg(0, top3_hud, "%L %LMax %s ^n%L %L%i %s", LANG_PLAYER, "GDM_1ST", LANG_PLAYER, "GDM_LV", top1_name, LANG_PLAYER, "GDM_2ND", LANG_PLAYER, "GDM_LV", gdm_level[top2], top2_name)
else
ShowSyncHudMsg(0, top3_hud, "%L %LMax %s ^n%L %LMax %s", LANG_PLAYER, "GDM_1ST", LANG_PLAYER, "GDM_LV", top1_name, LANG_PLAYER, "GDM_2ND", LANG_PLAYER, "GDM_LV", top2_name)
}
if(get_user_frags(top3) >= 1)
{
if(gdm_level[top1] <= 17 && gdm_level[top2] <= 17 && gdm_level[top3] <= 17)
ShowSyncHudMsg(0, top3_hud, "%L %L%i %s ^n%L %L%i %s ^n%L %L%i %s", LANG_PLAYER, "GDM_1ST", LANG_PLAYER, "GDM_LV", gdm_level[top1], top1_name, LANG_PLAYER, "GDM_2ND", LANG_PLAYER, "GDM_LV", gdm_level[top2], top2_name, LANG_PLAYER, "GDM_3RD", LANG_PLAYER, "GDM_LV", gdm_level[top3], top3_name)
else if(gdm_level[top1] > 17 && gdm_level[top2] <= 17 && gdm_level[top3] <= 17)
ShowSyncHudMsg(0, top3_hud, "%L %LMax %s ^n%L %L%i %s ^n%L %L%i %s", LANG_PLAYER, "GDM_1ST", LANG_PLAYER, "GDM_LV", top1_name, LANG_PLAYER, "GDM_2ND", LANG_PLAYER, "GDM_LV", gdm_level[top2], top2_name, LANG_PLAYER, "GDM_3RD", LANG_PLAYER, "GDM_LV", gdm_level[top3], top3_name)
else if(gdm_level[top1] > 17 && gdm_level[top2] > 17 && gdm_level[top3] <= 17)
ShowSyncHudMsg(0, top3_hud, "%L %LMax %s ^n%L %LMax %s ^n%L %L%i %s", LANG_PLAYER, "GDM_1ST", LANG_PLAYER, "GDM_LV", top1_name, LANG_PLAYER, "GDM_2ND", LANG_PLAYER, "GDM_LV", top2_name, LANG_PLAYER, "GDM_3RD", LANG_PLAYER, "GDM_LV", gdm_level[top3], top3_name)
else
ShowSyncHudMsg(0, top3_hud, "%L %LMax %s ^n%L %LMax %s ^n%L %LMax %s", LANG_PLAYER, "GDM_1ST", LANG_PLAYER, "GDM_LV", top1_name, LANG_PLAYER, "GDM_2ND", LANG_PLAYER, "GDM_LV", top2_name, LANG_PLAYER, "GDM_3RD", LANG_PLAYER, "GDM_LV", top3_name)
}
if(get_timeleft() <= 0)
{
if(tr_score > ct_score)
client_print(0, print_center, "%L %L: %s", LANG_PLAYER, "GDM_TR_WIN", LANG_PLAYER, "GDM_NEXTMAP", strlen(allow_maps[random_map][1]) > 0 ? allow_maps[random_map][1] : allow_maps[random_map][0])
else
client_print(0, print_center, "%L %L: %s", LANG_PLAYER, "GDM_CT_WIN", LANG_PLAYER, "GDM_NEXTMAP", strlen(allow_maps[random_map][1]) > 0 ? allow_maps[random_map][1] : allow_maps[random_map][0])
new players[32], pnum, tempid
get_players(players, pnum)
for(new i=0;i<pnum;i++)
{
tempid = players[i]
set_user_godmode(tempid, 1)
}
set_task(1.5, "map_change")
}
set_task(0.2, "TOP3_HUD")
}
public sort_bestplayer(id1, id2)
{
if(get_user_frags(id1) > get_user_frags(id2))
return -1
else if(get_user_frags(id1) < get_user_frags(id2))
return 1
return 0
}