PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta_util>
#include <hamsandwich>
#include <dhudmessage>
#include <cstrike>
enum RankData{Data_SteamID[32], Data_Name[32], Data_Kills, Data_Deaths}
#define IsPlayer(%1) (1 <= %1 <= g_iMaxPlayers)
const FL_ONGROUND2 = (FL_ONGROUND|FL_PARTIALGROUND|FL_INWATER|FL_CONVEYOR|FL_FLOAT)
new g_bAbleToSpawn, g_bRoundEnded = true, g_iExplosion, g_iMaxPlayers,
Trie:g_tRemoveEntities, Trie:g_tMsgArgs, diecount[33], g_iMsgSayText, firstname[33],
g_msgHideWeapon, bool:playerspec[33], oldmoney[33], bool:useoption[33][8], ranid,
timer, userhasswin[33], Random, g_File[64], Array:g_SteamID, Trie:g_Name, Trie:g_Kills,
Trie:g_Deaths, g_Top15[2048], bool:g_Sort = true, g_Data[33][RankData], bool:TeleDelay=true
new gBuyCommands[][] = {"chooseteam", "jointeam", "usp", "glock", "deagle", "p228", "elites", "fn57", "m3", "xm1014", "mp5", "tmp", "p90", "mac10", "ump45", "ak47", "galil", "famas", "sg552", "m4a1", "aug", "scout", "awp", "g3sg1", "sg550", "m249", "vest", "vesthelm", "flash",
"hegren", "sgren", "defuser", "nvgs", "shield", "primammo", "secammo", "km45", "9x19mm", "nighthawk", "228compact", "12gauge", "autoshotgun", "smg", "mp", "c90", "cv47", "defender", "clarion", "krieg552", "bullpup", "magnum", "d3au1", "krieg550", "buyammo1", "buyammo2", "buy"}
public plugin_init() {
register_plugin("Extreme Bomb Game", "1.0.6", "Exolent & ZeDoX")
for(new i; i < sizeof gBuyCommands; i++)
register_clcmd(gBuyCommands[i], "Fwd_ClientKill_Pre")
register_clcmd("say /rank", "SayRank")
register_clcmd("say /top15", "SayTop15")
register_clcmd("say /shop", "ShowShopMenu")
register_event("HLTV", "Event_HLTV", "a", "1=0", "2=0")
register_event("ResetHUD", "ResetHUD", "be")
register_event("TextMsg", "RoundRestart", "a", "2&#Game_w")
register_event("CurWeapon", "Event_CurWeapon", "be","1=1")
register_logevent("LogEvent_Round_Start", 2, "1=Round_Start")
register_logevent("LogEvent_Round_End", 2, "1=Round_End")
register_message(get_user_msgid("TextMsg"), "Message_TextMsg")
register_message(get_user_msgid("StatusIcon"), "MessageStatusIcon")
register_forward(FM_SetModel, "Fwd_SetModel_Pre")
register_forward(FM_EmitSound, "Fwd_EmitSound_Pre")
register_forward(FM_Touch, "Fwd_Touch_Pre")
register_forward(FM_ClientKill, "Fwd_ClientKill_Pre2")
register_forward(FM_GetGameDescription, "GameDesc")
RegisterHam(Ham_Spawn, "player", "Ham_Spawn_Post", 1)
RegisterHam(Ham_Touch, "weaponbox", "FwdHamPlayerWeaponTouch")
RegisterHam(Ham_Touch, "armoury_entity", "FwdHamPlayerWeaponTouch")
g_tMsgArgs = TrieCreate()
g_iMsgSayText = get_user_msgid("SayText")
g_iMaxPlayers = get_maxplayers()
g_msgHideWeapon = get_user_msgid("HideWeapon")
g_SteamID = ArrayCreate(32, 1)
g_Name = TrieCreate()
g_Kills = TrieCreate()
g_Deaths = TrieCreate()
new const szMsgArgs[][] = {"#C4_Plant_Must_Be_On_Ground","#C4_Plant_At_Bomb_Spot","#Game_bomb_drop","#Weapon_Cannot_Be_Dropped","#Game_bomb_pickup","#Got_bomb"}
for(new i = 0; i < sizeof(szMsgArgs); i++)
TrieSetCell(g_tMsgArgs, szMsgArgs[i], i)
new iEnt = create_entity("hostage_entity")
if(pev_valid(iEnt)) {
entity_set_origin(iEnt, Float:{ 8192.0, 8192.0, 8192.0 })
dllfunc(DLLFunc_Spawn, iEnt)
}
set_task(1.0, "players_hud",2222,_,_, "b")
set_task(120.0, "Message",2222,_,_, "b")
set_task(15.0 , "SortTask",2222,_,_,"b")
get_datadir(g_File, 63)
add(g_File, 63, "/ranks.ini")
ArraySort(g_SteamID, "SortRanks")
LoadRanks()
WriteTop15()
}
public plugin_precache() {
precache_model("models/Extreme/v_c4.mdl")
precache_sound("Extreme/Speach/lol.wav")
precache_sound("Extreme/Speach/loki_cheers.wav")
precache_sound("Extreme/fail.wav")
precache_sound("Extreme/shop_needpoints.wav")
g_iExplosion = precache_model("sprites/zerogxplode.spr")
g_tRemoveEntities = TrieCreate()
new const szRemoveEntities[][] = {"info_map_parameters","info_bomb_target","info_hostage_rescue","func_bomb_target","func_hostage_rescue","hostage_entity","weaponbox","armoury_entity"}
for(new i = 0; i < sizeof(szRemoveEntities); i++)
TrieSetCell(g_tRemoveEntities, szRemoveEntities[i], i)
}
public plugin_end() {
TrieDestroy(g_tRemoveEntities)
TrieDestroy(g_tMsgArgs)
ArraySort(g_SteamID, "SortRanks")
SaveRanks()
ArrayDestroy(g_SteamID)
}
public GameDesc() {
forward_return(FMV_STRING, "BombGame 1.0.6")
return FMRES_SUPERCEDE
}
public LogEvent_Round_Start() {
new szPlayers[32], iNum
get_players(szPlayers, iNum, "ach")
if(iNum > 1) {
ranid = szPlayers[random_num(1, iNum)]
if(IsPlayer(ranid)/* && !useoption[id][1]*/) {
fm_give_item(ranid, "weapon_c4")
set_task(5.0, "Task_GiveGlow", ranid)
get_user_name(ranid, firstname, 32)
set_dhudmessage(255, 0, 0, -1.0, 0.14, 0, 2.0, 2.0)
show_dhudmessage(0, "%s first got the bomb", firstname)
cs_set_user_money(ranid, cs_get_user_money(ranid) + 300)
ColorChat(0, "^4%s^1 first got the ^3bomb^1 and received^3 300$", firstname)
Random = random_num(0,7)
if(Random == 1) ColorChat(0, "Its ^4Gravity Bomb^1 Round, When they ^3dropped^1 the ^3bomb^1 it will be ^4Gravity^1")
else if(Random == 2) ColorChat(0, "Its ^4Teleport Bomb^1 Round, Press ^3[E]^1 to reach the ^3bomb")
else if(Random == 3) ColorChat(0, "Its ^4Low Gravity Bomb^1 Round, When they ^3dropped^1 the ^3bomb^1 it will be ^4Low Gravity^1")
else if(Random == 4) ColorChat(0, "Its ^4Sticky Bomb^1 Round, When they ^3dropped^1 the ^3bomb^1 it will be ^4Sticky^1")
g_bAbleToSpawn = false
g_bRoundEnded = false
timer = 0
set_task(1.5, "C4SoundEffect", 1111,_,_,"b")
set_task(1.0, "C4TimerPlus", 1111,_,_,"b")
} else set_task(0.2, "LogEvent_Round_Start", 1111)
}
}
public LogEvent_Round_End() {
remove_task(1111)
g_bRoundEnded = true
new szPlayers[32], iNum, t, bool:ald, iEnt = -1
get_players(szPlayers, iNum, "ch")
for(new ids=1; ids <= g_iMaxPlayers; ids++) if(is_user_connected(ids) && is_user_alive(ids)) t++
if(iNum > 1) {
while((iEnt = find_ent_by_class(iEnt, "weaponbox")) != 0) {
ExplosionFX(pev(iEnt, pev_owner))
ald = true
}
for(new i = 0; i < iNum; i++) {
if(user_has_weapon(szPlayers[i], CSW_C4) && !ald) ExplosionFX(szPlayers[i])
if(t == 2) {
if(is_user_alive(szPlayers[i])) {
g_Data[szPlayers[i]][Data_Kills]++
g_Sort = true
userhasswin[szPlayers[i]] = 2
UpdateRank(szPlayers[i], false)
get_user_name(szPlayers[i], firstname, 32)
ColorChat(0, "^4%s^3 won^1 and received^3 5000$", firstname)
set_dhudmessage(255, 0, 0, -1.0, 0.40, 0, 0.1, 0.1)
show_dhudmessage(0, "%s is Winner^nNew game started", firstname)
client_cmd(szPlayers[i], " spk ^"Extreme/Speach/loki_cheers.wav^"")
set_task(8.0, "Restart")
}
}
}
}
for(new ids=1; ids <= g_iMaxPlayers; ids++) {
if(!is_user_connected(ids) || !is_user_alive(ids)) continue
ColorChat(ids, "You received^3 500$^1 for ^4staying alive")
cs_set_user_money(ids, cs_get_user_money(ids) + 500)
oldmoney[ids] = cs_get_user_money(ids)
}
}
public RoundRestart() {
remove_task(1111)
new Players[32], iNum
get_players(Players, iNum, "ch")
for(new i = 0; i < iNum; i++) {
playerspec[Players[i]] = false
cs_set_user_team(Players[i], CS_TEAM_T)
set_dhudmessage(255, 0, 0, -1.0, 0.40, 0, 0.1, 0.1)
show_dhudmessage(Players[i], "New game started")
}
}
public Message_TextMsg(iMsgID, iDest, id)
{
static szMessage[27]
get_msg_arg_string(2, szMessage, charsmax(szMessage))
if(TrieKeyExists(g_tMsgArgs, szMessage))
return PLUGIN_HANDLED
return PLUGIN_CONTINUE
}
public MessageStatusIcon(const iMsgId, const iMsgDest, const id) {
if(get_msg_arg_int(1) != 0) {
new szIcon[10]
get_msg_arg_string(2, szIcon, 9)
if(equal(szIcon, "c4")) {
set_msg_arg_int(3, ARG_BYTE, 0)
set_msg_arg_int(4, ARG_BYTE, 150)
set_msg_arg_int(5, ARG_BYTE, 255)
}
}
}
public Fwd_SetModel_Pre(iEnt, const szModel[])
{
static szClassname[10]
pev(iEnt, pev_classname, szClassname, charsmax(szClassname))
if(equal(szClassname, "weaponbox") && !g_bRoundEnded) {
if(Random == 1) {
set_pev(iEnt, pev_gravity, Float:0.4)
set_rendering(iEnt, kRenderFxGlowShell, 150, 255, 0, kRenderNormal, 16)
} else if(Random == 2)
set_rendering(iEnt, kRenderFxGlowShell, 0, 255, 0, kRenderNormal, 16)
else if(Random == 3) {
set_pev(iEnt, pev_gravity, Float:2.0)
set_rendering(iEnt, kRenderFxGlowShell, 255, 0, 255, kRenderNormal, 16)
} else if(Random == 4) {
set_pev(iEnt, pev_velocity, Float:100.0)
set_rendering(iEnt, kRenderFxGlowShell, 255, 100, 0, kRenderNormal, 16)
} else set_rendering(iEnt, kRenderFxGlowShell, 0, 150, 255, kRenderNormal, 16)
}
}
public Fwd_EmitSound_Pre(iEnt, iChannel, const szSound[])
{
if(szSound[0] == 'h' && szSound[1] == 'o' && szSound[2] == 's' && szSound[3] == 't' && szSound[4] == 'a' && szSound[5] == 'g' && szSound[6] == 'e')
{
client_cmd(0, "spk radio/terwin.wav")
return FMRES_SUPERCEDE
}
return FMRES_IGNORED
}
public Fwd_Touch_Pre(iEnt, id)
{
if(pev_valid(iEnt) && IsPlayer(id) && !g_bRoundEnded) {
static szClassname[10]
pev(iEnt, pev_classname, szClassname, charsmax(szClassname))
if(equal(szClassname, "weaponbox") && (pev(iEnt, pev_flags) & FL_ONGROUND2)) {
static iOwner; iOwner = pev(iEnt, pev_owner)
if(iOwner != id) {
ranid = id
new lastname[33]
get_user_name(iOwner, lastname, 32)
get_user_name(id, firstname, 32)
emit_sound(iOwner, CHAN_WEAPON, "Extreme/Speach/lol.wav", 0.1, ATTN_NORM, 0, PITCH_NORM)
if(!useoption[iOwner][4]) fm_set_user_rendering(iOwner)
if(!useoption[id][4]) {
if(Random == 1) fm_set_user_rendering(id, kRenderFxGlowShell, 150, 255, 0, kRenderNormal, 16)
else if(Random == 2) fm_set_user_rendering(id, kRenderFxGlowShell, 0, 255, 0, kRenderNormal, 16)
else if(Random == 3) fm_set_user_rendering(id, kRenderFxGlowShell, 255, 0, 255, kRenderNormal, 16)
else if(Random == 4) fm_set_user_rendering(id, kRenderFxGlowShell, 255, 100, 0, kRenderNormal, 16)
else fm_set_user_rendering(id, kRenderFxGlowShell, 0, 150, 255, kRenderNormal, 16)
}
set_dhudmessage(255, 0, 0, -1.0, 0.14, 0, 2.0, 2.0)
show_dhudmessage(0, "Lolz, %s got the bomb by %s", firstname, lastname)
}
}
}
}
public Ham_Spawn_Post(id)
{
if(IsPlayer(id) && is_user_alive(id)) {
fm_set_user_rendering(id)
fm_strip_user_weapons(id)
set_task(1.5, "SetOldMoney", id)
useoption[id][4] = false; useoption[id][5] = false; useoption[id][7] = false
if(playerspec[id]) {
ColorChat(id, "You can't play till the:^4 will new game started")
cs_set_user_team(id, CS_TEAM_SPECTATOR)
set_task(0.1, "userkill", id)
} else if(!g_bAbleToSpawn) {
ShowEffect(id)
ColorChat(id, "You can't play till the:^4 next round")
} else set_task(0.1, "TaskStripUserC4", id)
}
}
public client_putinserver(id) {
get_user_ip(id, g_Data[id][Data_SteamID], 31)
get_user_name(id, g_Data[id][Data_Name], 20)
if(!TrieKeyExists(g_Name, g_Data[id][Data_SteamID]))
AddRank(id)
else LoadData(id)
UpdateRank(id, true)
oldmoney[id] = 0
cs_set_user_money(id, 0)
new Players[32], num
get_players(Players,num,"ch")
for(new i=0 ; i < num ; i++)
if(num > 1 && playerspec[Players[i]])
playerspec[id] = true
}
ExplosionFX(id) {
new Float:fOrigin[3]
new iOrigin[3]
entity_get_vector(id, EV_VEC_origin, fOrigin)
FVecIVec(fOrigin, iOrigin)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY, iOrigin)
write_byte(TE_EXPLOSION)
write_coord(iOrigin[0])
write_coord(iOrigin[1])
write_coord(iOrigin[2])
write_short(g_iExplosion)
write_byte(30)
write_byte(15)
write_byte(0)
message_end()
cs_set_user_team(id, CS_TEAM_SPECTATOR)
set_task(0.1, "userkill", id)
playerspec[id] = true
user_kill(id)
emit_sound(id, CHAN_WEAPON, "Extreme/fail.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
g_Data[id][Data_Deaths]++
g_Sort = true
UpdateRank(id, false)
}
public Fwd_ClientKill_Pre(id) {
if(diecount[id] > 10) {
diecount[id] = 0
server_cmd("amx_banip #%d 10 ^"BombGame: Please stop flood the Server!^"", get_user_userid(id))
} else {
++diecount[id]
ColorChat(id, "you can't use this command, Attempt number:^4 %i ^1of^4 10 %s", diecount[id], diecount[id] == 9 ? "^3Warning: The next time you're banned for 10 minutes!" : "")
}
return PLUGIN_HANDLED
}
public Fwd_ClientKill_Pre2(id) {
if(diecount[id] > 10) {
diecount[id] = 0
server_cmd("amx_banip #%d 10 ^"BombGame: Please stop flood the Server!^"", get_user_userid(id))
} else {
++diecount[id]
ColorChat(id, "you can't use this command, Attempt number:^4 %i ^1of^4 10 %s", diecount[id], diecount[id] == 9 ? "^3Warning: The next time you're banned for 10 minutes!" : "")
}
return HAM_SUPERCEDE
}
public players_hud() {
new players[32], num, Formatex[10], FormatexR[16]
get_players(players,num,"ch")
for(new i=0 ; i < num ; i++) {
if(user_has_weapon(players[i], CSW_C4)) formatex(Formatex, 9, ", touched")
if(Random == 1) formatex(Formatex, 11, " [Gravity]")
else if(Random == 2) formatex(FormatexR, 12, " [Teleport]")
else if(Random == 3) formatex(FormatexR, 15, " [Low Gravity]")
else if(Random == 4) formatex(FormatexR, 10, " [Sticky]")
else formatex(FormatexR, 10, " [Normal]")
set_dhudmessage(0, 150, 255, 0.02, is_user_alive(players[i]) ? 0.90 : 0.75, 0, 0.2, 0.2)
show_dhudmessage(players[i], "Last - %s%s%s", firstname, Formatex, FormatexR)
}
}
public ResetHUD(id) {
if(!is_user_bot(id) && IsPlayer(id)) {
message_begin(MSG_ONE_UNRELIABLE, g_msgHideWeapon, _, id)
write_byte(1 << 3)
message_end()
}
}
ShowEffect(id) {
new iOrigin[3]
get_user_origin(id, iOrigin)
message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin)
write_byte(TE_TELEPORT)
write_coord(iOrigin[0])
write_coord(iOrigin[1])
write_coord(iOrigin[2])
message_end()
user_silentkill(id)
}
public Event_CurWeapon(id) {
if(is_user_alive(id) && is_user_connected(id)) {
new temp[2], weapon = get_user_weapon(id, temp[0], temp[1])
if(weapon == CSW_C4)
entity_set_string(id, EV_SZ_viewmodel, "models/Extreme/v_c4.mdl")
}
}
public C4SoundEffect() {
new szPlayers[32], iNum, isal[33]
get_players(szPlayers, iNum, "ch")
new iEnt = -1
if(iNum) {
for(new i = 0; i < iNum; i++) {
if(user_has_weapon(szPlayers[i], CSW_C4))
isal[szPlayers[i]] = true
else while((iEnt = find_ent_by_class(iEnt, "weaponbox")) != 0)
isal[pev(iEnt, pev_owner)] = true
if(isal[szPlayers[i]]) {
if(timer < 30) emit_sound(szPlayers[i], CHAN_WEAPON, "weapons/c4_beep1.wav", 0.3, ATTN_NORM, 0, PITCH_NORM)
else if(timer < 40) emit_sound(szPlayers[i], CHAN_WEAPON, "weapons/c4_beep2.wav", 0.3, ATTN_NORM, 0, PITCH_NORM)
else if(timer < 45) emit_sound(szPlayers[i], CHAN_WEAPON, "weapons/c4_beep3.wav", 0.3, ATTN_NORM, 0, PITCH_NORM)
else if(timer < 50) emit_sound(szPlayers[i], CHAN_WEAPON, "weapons/c4_beep4.wav", 0.3, ATTN_NORM, 0, PITCH_NORM)
else emit_sound(szPlayers[i], CHAN_WEAPON, "weapons/c4_beep5.wav", 0.3, ATTN_NORM, 0, PITCH_NORM)
}
}
}
}
stock ColorChat(index, const Msg[], {Float, Sql, Result,_}:...) {
new Buffer[190], Buffer2[192]
formatex(Buffer2, sizeof(Buffer2)-1, "^3[^1 BombGame ^3]^1 %s", Msg)
vformat(Buffer, sizeof(Buffer)-1, Buffer2, 3)
if(!index) {
for(new i = 1; i <= g_iMaxPlayers; i++) {
if(!is_user_connected(i)) continue
message_begin(MSG_ONE_UNRELIABLE, g_iMsgSayText,_, i)
write_byte(i)
write_string(Buffer)
message_end()
}
} else {
if(!is_user_connected(index)) return
message_begin(MSG_ONE_UNRELIABLE, g_iMsgSayText,_, index)
write_byte(index)
write_string(Buffer)
message_end()
}
}
public ShowShopMenu(id) {
if(is_user_connected(id)) {
new szShop[200]
formatex(szShop, charsmax(szShop), "\r[\w Extreme \r]\y GameBomb Shop Menu^n\dYour Cash - \w%d", cs_get_user_money(id))
new shopmenu = menu_create(szShop, "ShopMenu")
menu_additem(shopmenu, "\yNot get the bomb first \r[\w2000\y$\r]", "1")
menu_additem(shopmenu, "\y500 Gravity\d From Round \r[\w3000\y$\r]", "2")
menu_additem(shopmenu, "\yFrostNades \r[\w4000\y$\r]", "3")
menu_additem(shopmenu, "\y70%% Invisible\d From Round \r[\w5000\y$\r]", "4")
menu_additem(shopmenu, "\ySend the bomb\d Per Map \r[\w6000\y$\r]", "5")
menu_additem(shopmenu, "\yRespawn \dFrom spec \r[\w7000\y$\r]", "6")
menu_additem(shopmenu, "\yNot touch the bomb\d Per Map \r[\w8000\y$\r]", "7")
menu_setprop(shopmenu, MPROP_NUMBER_COLOR, "\w")
menu_display(id, shopmenu)
}
}
public ShopMenu(id, shopmenu, item)
{
if(item == MENU_EXIT) return
new name[33], money = cs_get_user_money(id)
get_user_name(id, name, 31)
new Data[7], Name[64], Access, Callback, t
for(new ids=1; ids <= g_iMaxPlayers; ids++) if(is_user_connected(ids) && is_user_alive(ids)) t++
if(t < 3) {
ColorChat(id, "Need 3 Players alive to this")
return
}
menu_item_getinfo(shopmenu, item, Access, Data,5, Name, 63, Callback)
new Key = str_to_num(Data)
switch (Key)
{
case 1: {
ColorChat(id, "^"Not get the bomb first^" is disable")
/*if(money < 2000) {
emit_sound(id, CHAN_BODY, "Extreme/shop_needpoints.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
ColorChat(id, "You need more^4 %d money^1 for this!", money - 2000)
} else if(!is_user_alive(id))
ColorChat(id, "You must be alive !")
else {
useoption[id][1] = true
ColorChat(0, "^4%s ^1Buy ^3^"Not get the bomb first^"", name)
cs_set_user_money(id, money - 2000)
}*/
}
case 2: {
if(money < 3000) {
emit_sound(id, CHAN_BODY, "Extreme/shop_needpoints.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
ColorChat(id, "You need more^4 %d money^1 for this!", money - 3000)
} else if(!is_user_alive(id))
ColorChat(id, "You must be alive !")
else {
fm_set_user_gravity(id, 500.0 / 800)
ColorChat(0, "^4%s ^1Buy ^3^"500 Gravity^"", name)
cs_set_user_money(id, money - 3000)
}
}
case 3: {
if(money < 4000) {
emit_sound(id, CHAN_BODY, "Extreme/shop_needpoints.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
ColorChat(id, "You need more^4 %d money^1 for this!", money - 4000)
} else if(!is_user_alive(id))
ColorChat(id, "You must be alive !")
else {
fm_give_item(id, "weapon_smokegrenade")
ColorChat(0, "^4%s ^1Buy ^3^"FrostNades^"", name)
cs_set_user_money(id, money - 4000)
}
}
case 4: {
if(money < 5000) {
emit_sound(id, CHAN_BODY, "Extreme/shop_needpoints.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
ColorChat(id, "You need more^4 %d money^1 for this!", money - 5000)
} else if(!is_user_alive(id))
ColorChat(id, "You must be alive !")
else {
useoption[id][4] = true
fm_set_user_rendering(id, kRenderFxNone, 20, 20, 20, kRenderTransAlpha, 40)
ColorChat(0, "^4%s ^1Buy ^3^"70%% Invisible^"", name)
cs_set_user_money(id, money - 5000)
}
}
case 5: {
if(money < 6000) {
emit_sound(id, CHAN_BODY, "Extreme/shop_needpoints.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
ColorChat(id, "You need more^4 %d money^1 for this!", money - 6000)
} else if(!is_user_alive(id))
ColorChat(id, "You must be alive !")
else if(!user_has_weapon(id, CSW_C4))
ColorChat(id, "You no have a bomb !")
else if(useoption[id][5])
ColorChat(id, "You are use that option")
else {
fm_strip_user_weapons(id)
fm_set_rendering(id)
new szPlayers[32], iNum
get_players(szPlayers, iNum, "ach")
new ids = 0
ids = szPlayers[(iNum > 1) ? random(iNum) : 0]
if(IsPlayer(id) && !useoption[id][5] && id != ids) {
fm_give_item(ids, "weapon_c4")
Task_GiveGlow(ids)
get_user_name(ids, firstname, 32)
set_dhudmessage(255, 0, 0, -1.0, 0.14, 0, 2.0, 2.0)
show_dhudmessage(0, "%s got the bomb by ^"Send the bomb^"", firstname)
} else LogEvent_Round_Start
useoption[id][5] = true
ColorChat(0, "^4%s ^1Buy ^3^"Send the bomb^"", name)
cs_set_user_money(id, money - 6000)
}
}
case 6: {
if(money < 7000) {
emit_sound(id, CHAN_BODY, "Extreme/shop_needpoints.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
ColorChat(id, "You need more^4 %d money^1 for this!", money - 7000)
} else if(is_user_alive(id))
ColorChat(id, "You must be died !")
else {
cs_set_user_team(id, CS_TEAM_T)
playerspec[id] = false
ExecuteHamB(Ham_CS_RoundRespawn, id)
ColorChat(0, "^4%s ^1Buy ^3^"Respawn^"", name)
cs_set_user_money(id, money - 7000)
}
}
case 7: {
if(money < 8000) {
emit_sound(id, CHAN_BODY, "Extreme/shop_needpoints.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
ColorChat(id, "You need more^4 %d money^1 for this!", money - 8000)
} else if(!is_user_alive(id))
ColorChat(id, "You must be alive !")
else if(useoption[id][7])
ColorChat(id, "You are use that option")
else {
useoption[id][7] = true
ColorChat(0, "^4%s ^1Buy ^3^"Not touch the bomb^"", name)
cs_set_user_money(id, money - 8000)
}
}
}
}
public SayRank(Client) {
new Position = GetPosition(Client)
if(Position)
ColorChat(Client, "* Your rank is ^3%d^1 of ^3%d^1 with ^4%d^1 wins and ^4%d^1 deaths by bomb.", Position, ArraySize(g_SteamID), g_Data[Client][Data_Kills], g_Data[Client][Data_Deaths])
else ColorChat(Client, "* You are not ranked.")
}
public SortTask() {
if(g_Sort) {
ArraySort(g_SteamID, "SortRanks")
WriteTop15()
SaveRanks()
}
}
public SortRanks(Array:SteamID, Position1, Position2)
{
static SteamID1[32], SteamID2[32], Kills1, Kills2, Deaths1, Deaths2
ArrayGetString(SteamID, Position1, SteamID1, 31)
ArrayGetString(SteamID, Position2, SteamID2, 31)
TrieGetCell(g_Kills, SteamID1, Kills1)
TrieGetCell(g_Kills, SteamID2, Kills2)
TrieGetCell(g_Deaths, SteamID1, Deaths1)
TrieGetCell(g_Deaths, SteamID2, Deaths2)
if(Kills1 - Deaths1 < Kills2 - Deaths2)
return 1
else if(Kills1 - Deaths1 > Kills2 - Deaths2)
return -1
return 0
}
LoadRanks() {
new File = fopen(g_File, "r")
if(!File)
return
new Data[96], SteamID[32], Name[32], Kills[16], Deaths[16]
while (!feof(File)) {
fgets(File, Data, 96)
if(!strlen(Data))
continue
parse(Data, SteamID, 31, Name, 31, Kills, 15, Deaths, 15)
ArrayPushString(g_SteamID, SteamID)
TrieSetString(g_Name, SteamID, Name)
TrieSetCell(g_Kills, SteamID, str_to_num(Kills))
TrieSetCell(g_Deaths, SteamID, str_to_num(Deaths))
}
fclose(File)
}
SaveRanks() {
new File = fopen(g_File, "w+")
if(!File) return
for(new Position, Size = ArraySize(g_SteamID), SteamID[32], Name[32], Kills, Deaths; Position < Size; Position++)
{
ArrayGetString(g_SteamID, Position, SteamID, 31)
TrieGetString(g_Name, SteamID, Name, 31)
TrieGetCell(g_Kills, SteamID, Kills)
TrieGetCell(g_Deaths, SteamID, Deaths)
fprintf(File, "%s ^"%s^" %d %d^n", SteamID, Name, Kills, Deaths)
}
fclose(File)
}
AddRank(Client) {
g_Data[Client][Data_Kills] = 0
g_Data[Client][Data_Deaths] = 0
ArrayPushString(g_SteamID, g_Data[Client][Data_SteamID])
TrieSetString(g_Name, g_Data[Client][Data_SteamID], g_Data[Client][Data_Name])
}
LoadData(Client) {
TrieGetCell(g_Kills, g_Data[Client][Data_SteamID], g_Data[Client][Data_Kills])
TrieGetCell(g_Deaths, g_Data[Client][Data_SteamID], g_Data[Client][Data_Deaths])
}
UpdateRank(Client, bool:Name) {
if(Name) TrieSetString(g_Name, g_Data[Client][Data_SteamID], g_Data[Client][Data_Name])
TrieSetCell(g_Kills, g_Data[Client][Data_SteamID], g_Data[Client][Data_Kills])
TrieSetCell(g_Deaths, g_Data[Client][Data_SteamID], g_Data[Client][Data_Deaths])
}
GetPosition(Client) {
static Position, Size, SteamID[32]
for(Position = 0, Size = ArraySize(g_SteamID); Position < Size; Position++) {
ArrayGetString(g_SteamID, Position, SteamID, 31)
if(equal(SteamID, g_Data[Client][Data_SteamID]))
return Position + 1
}
return 0
}
WriteTop15() {
static const Header[] = "<p align=^"center^"><body bgcolor=#000000><font color=green><font size=^"6^"><pre>BombGame Rank 1.0 by ZeDoX & hleV^n<font size=^"3^"><font color=#FFB000><p align=^"left^">%5s %22s %5s %5s^n^n"
static const Buffer[] = "<font size=^"3^">%4d %22s %5d %6d^n"
static Length, Position, Size, SteamID[32], Name[32], Kills, Deaths
Length = formatex(g_Top15[Length], 2047 - Length, Header, "Rank", "Name", "Wins", "Deaths by bomb")
for(Position = 0, Size = min(ArraySize(g_SteamID), 15); Position < Size; Position++) {
ArrayGetString(g_SteamID, Position, SteamID, 31)
TrieGetString(g_Name, SteamID, Name, 31)
TrieGetCell(g_Kills, SteamID, Kills)
TrieGetCell(g_Deaths, SteamID, Deaths)
Length += formatex(g_Top15[Length], 2047 - Length, Buffer, Position + 1, Name, Kills, Deaths)
}
}
public client_PreThink(id) {
if(is_user_connected(id)) {
set_pev(id, pev_fuser2, 0.0)
if(!user_has_weapon(id, CSW_C4) && TeleDelay && pev(id, pev_button) & IN_USE
&& !(pev(id, pev_oldbuttons) & IN_USE) && Random == 2) {
new iEnt = -1, Float:origin[3]
while((iEnt = find_ent_by_class(iEnt, "weaponbox")) != 0) {
if(id == pev(iEnt, pev_owner) && !is_user_stuck(id)) {
get_brush_entity_origin(iEnt, origin)
origin[2] += 39.0
engfunc(EngFunc_SetOrigin, id, origin)
TeleDelay = false
set_task(2.0, "CanTele")
}
}
}
}
}
is_user_stuck(plr) {
static origin[3]
pev(plr, pev_origin, origin)
engfunc(EngFunc_TraceHull, origin, origin, IGNORE_MONSTERS, pev(plr, pev_flags) & FL_DUCKING ? HULL_HEAD : HULL_HUMAN, plr, 0)
return get_tr2(0, TR_StartSolid)
}
public TaskStripUserC4(id) {
if(is_user_alive(id) && user_has_weapon(id, CSW_C4)) {
fm_strip_user_weapons(id)
new players[32], num
get_players(players, num, "ach")
for(new i=0; i < num; i++)
if(ranid != players[i] && !g_bRoundEnded)
fm_strip_user_weapons(players[i])
}
}
public FwdHamPlayerWeaponTouch(const iEntity, const id) return (IsPlayer(id) && useoption[id][7]) ? HAM_SUPERCEDE : HAM_IGNORED
public Restart() server_cmd("sv_restartround 1")
public client_PostThink(id) entity_set_int(id, EV_INT_watertype, -3)
public userkill(id) user_silentkill(id)
public C4TimerPlus() timer++
public CanTele() TeleDelay = true
public Message() ColorChat(0, "Type ^4/shop^1 to open the ^3BombGame^1 Shop Menu")
public SayTop15(Client) show_motd(Client, g_Top15, "Extreme BombGame Top 15")
public SetOldMoney(id) {
if(userhasswin[id] > 0) {
cs_set_user_money(id, oldmoney[id] + 5000)
userhasswin[id]--
} else cs_set_user_money(id, oldmoney[id] == 1 ? 0 : oldmoney[id])
}
public Event_HLTV() g_bAbleToSpawn = true
public Task_GiveGlow(id) {
if(user_has_weapon(id, CSW_C4)) Glow(id)
else {
new iEnt = -1
while((iEnt = find_ent_by_class(iEnt, "weaponbox")) != 0)
if(id == pev(iEnt, pev_owner)) Glow(id)
}
}
public Glow(id) {
if(Random == 1) fm_set_user_rendering(id, kRenderFxGlowShell, 150, 255, 0, kRenderNormal, 16)
else if(Random == 2) fm_set_user_rendering(id, kRenderFxGlowShell, 0, 255, 0, kRenderNormal, 16)
else if(Random == 3) fm_set_user_rendering(id, kRenderFxGlowShell, 255, 0, 255, kRenderNormal, 16)
else if(Random == 4) fm_set_user_rendering(id, kRenderFxGlowShell, 255, 100, 0, kRenderNormal, 16)
else fm_set_user_rendering(id, kRenderFxGlowShell, 0, 150, 255, kRenderNormal, 16)
}
But i have a lot of bugs with the bomb...