Thread: BombGame
View Single Post
Author Message
Eviatar Mor
Senior Member
Join Date: Jun 2014
Location: israel
Old 08-24-2014 , 08:53   BombGame
Reply With Quote #1

Hey,
i have this mod:
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_KillsData_Deaths}

#define IsPlayer(%1) (1 <= %1 <= g_iMaxPlayers)
const FL_ONGROUND2 = (FL_ONGROUND|FL_PARTIALGROUND|FL_INWATER|FL_CONVEYOR|FL_FLOAT)

new 
g_bAbleToSpawng_bRoundEnded trueg_iExplosiong_iMaxPlayers,
Trie:g_tRemoveEntitiesTrie:g_tMsgArgsdiecount[33], g_iMsgSayTextfirstname[33],
g_msgHideWeaponbool:playerspec[33], oldmoney[33], bool:useoption[33][8], ranid,
timeruserhasswin[33], Randomg_File[64], Array:g_SteamIDTrie:g_NameTrie:g_Kills,
Trie:g_Deathsg_Top15[2048], bool:g_Sort trueg_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 
isizeof gBuyCommandsi++)
        
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(321)
    
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 
0sizeof(szMsgArgs); i++)
        
TrieSetCell(g_tMsgArgsszMsgArgs[i], i)
    new 
iEnt create_entity("hostage_entity")
    if(
pev_valid(iEnt)) {
        
entity_set_origin(iEntFloat:{ 8192.08192.08192.0 })
        
dllfunc(DLLFunc_SpawniEnt)
    }
    
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_File63)
    
add(g_File63"/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 
0sizeof(szRemoveEntities); i++)
        
TrieSetCell(g_tRemoveEntitiesszRemoveEntities[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
(szPlayersiNum"ach")
    if(
iNum 1) {
        
ranid szPlayers[random_num(1iNum)]
        if(
IsPlayer(ranid)/* && !useoption[id][1]*/) {
            
fm_give_item(ranid"weapon_c4")
            
set_task(5.0"Task_GiveGlow"ranid)
            
get_user_name(ranidfirstname32)
            
set_dhudmessage(25500, -1.00.1402.02.0)
            
show_dhudmessage(0"%s first got the bomb"firstname)
            
cs_set_user_money(ranidcs_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 == 1ColorChat(0"Its ^4Gravity Bomb^1 Round, When they ^3dropped^1 the ^3bomb^1 it will be ^4Gravity^1")
            else if(
Random == 2ColorChat(0"Its ^4Teleport Bomb^1 Round, Press ^3[E]^1 to reach the ^3bomb")
            else if(
Random == 3ColorChat(0"Its ^4Low Gravity Bomb^1 Round, When they ^3dropped^1 the ^3bomb^1 it will be ^4Low Gravity^1")
            else if(
Random == 4ColorChat(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], iNumtbool:aldiEnt = -1
    get_players
(szPlayersiNum"ch")
    for(new 
ids=1ids <= g_iMaxPlayersids++) if(is_user_connected(ids) && is_user_alive(ids)) t++
    if(
iNum 1) {
        while((
iEnt find_ent_by_class(iEnt"weaponbox")) != 0) {
            
ExplosionFX(pev(iEntpev_owner))
            
ald true
        
}
        for(new 
0iNumi++) {
            if(
user_has_weapon(szPlayers[i], CSW_C4) && !aldExplosionFX(szPlayers[i])
            if(
== 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], firstname32)
                    
ColorChat(0"^4%s^3 won^1 and received^3 5000$"firstname)
                    
set_dhudmessage(25500, -1.00.4000.10.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=1ids <= g_iMaxPlayersids++) {
        if(!
is_user_connected(ids) || !is_user_alive(ids)) continue
        
ColorChat(ids"You received^3 500$^1 for ^4staying alive")
        
cs_set_user_money(idscs_get_user_money(ids) + 500)
        
oldmoney[ids] = cs_get_user_money(ids)
    }
}

public 
RoundRestart() {
    
remove_task(1111)
    new 
Players[32], iNum
    get_players
(PlayersiNum"ch")
    for(new 
0iNumi++) {
        
playerspec[Players[i]] = false
        cs_set_user_team
(Players[i], CS_TEAM_T)
        
set_dhudmessage(25500, -1.00.4000.10.1)
        
show_dhudmessage(Players[i], "New game started")
    }
}

public 
Message_TextMsg(iMsgIDiDestid)
{
    static 
szMessage[27]
    
get_msg_arg_string(2szMessagecharsmax(szMessage))
    
    if(
TrieKeyExists(g_tMsgArgsszMessage))
        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(2szIcon9)
        if(
equal(szIcon"c4")) {
            
set_msg_arg_int(3ARG_BYTE0)
            
set_msg_arg_int(4ARG_BYTE150)
            
set_msg_arg_int(5ARG_BYTE255)
        }
    }
}

public 
Fwd_SetModel_Pre(iEnt, const szModel[])
{
    static 
szClassname[10]
    
pev(iEntpev_classnameszClassnamecharsmax(szClassname))
    
    if(
equal(szClassname"weaponbox") && !g_bRoundEnded) {
        if(
Random == 1) {
            
set_pev(iEntpev_gravityFloat:0.4)
            
set_rendering(iEntkRenderFxGlowShell1502550kRenderNormal16)
        } else if(
Random == 2)
            
set_rendering(iEntkRenderFxGlowShell02550kRenderNormal16)
        else if(
Random == 3) {
            
set_pev(iEntpev_gravityFloat:2.0)
            
set_rendering(iEntkRenderFxGlowShell2550255kRenderNormal16)
        } else if(
Random == 4) {
            
set_pev(iEntpev_velocityFloat:100.0)
            
set_rendering(iEntkRenderFxGlowShell2551000kRenderNormal16)
        } else    
set_rendering(iEntkRenderFxGlowShell0150255kRenderNormal16)
    }
}

public 
Fwd_EmitSound_Pre(iEntiChannel, 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(iEntid)
{
    if(
pev_valid(iEnt) && IsPlayer(id) && !g_bRoundEnded) {
        static 
szClassname[10]
        
pev(iEntpev_classnameszClassnamecharsmax(szClassname))
        
        if(
equal(szClassname"weaponbox") && (pev(iEntpev_flags) & FL_ONGROUND2)) {
            static 
iOwneriOwner pev(iEntpev_owner)
            if(
iOwner != id) {
                
ranid id
                
new lastname[33]
                
get_user_name(iOwnerlastname32)
                
get_user_name(idfirstname32)
                
emit_sound(iOwnerCHAN_WEAPON"Extreme/Speach/lol.wav"0.1ATTN_NORM0PITCH_NORM)
                
                if(!
useoption[iOwner][4]) fm_set_user_rendering(iOwner)
                if(!
useoption[id][4]) {
                    if(
Random == 1fm_set_user_rendering(idkRenderFxGlowShell1502550kRenderNormal16)
                    else if(
Random == 2fm_set_user_rendering(idkRenderFxGlowShell02550kRenderNormal16)
                    else if(
Random == 3fm_set_user_rendering(idkRenderFxGlowShell2550255kRenderNormal16)
                    else if(
Random == 4fm_set_user_rendering(idkRenderFxGlowShell2551000kRenderNormal16)
                    else 
fm_set_user_rendering(idkRenderFxGlowShell0150255kRenderNormal16)
                }
                
set_dhudmessage(25500, -1.00.1402.02.0)
                
show_dhudmessage(0"Lolz, %s got the bomb by %s"firstnamelastname)
            }
        }
    }
}

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] = falseuseoption[id][5] = falseuseoption[id][7] = false
        
if(playerspec[id]) {
            
ColorChat(id"You can't play till the:^4 will new game started")
            
cs_set_user_team(idCS_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(idg_Data[id][Data_SteamID], 31)
    
get_user_name(idg_Data[id][Data_Name], 20)
    if(!
TrieKeyExists(g_Nameg_Data[id][Data_SteamID]))
        
AddRank(id)
    else 
LoadData(id)
    
UpdateRank(idtrue)
    
oldmoney[id] = 0
    cs_set_user_money
(id0)
    new 
Players[32], num
    get_players
(Players,num,"ch")
    for(new 
i=num i++)
        if(
num && playerspec[Players[i]])
            
playerspec[id] = true
}

ExplosionFX(id) {
    new 
Float:fOrigin[3]
    new 
iOrigin[3]
    
entity_get_vector(idEV_VEC_originfOrigin)
    
FVecIVec(fOriginiOrigin)
    
    
message_begin(MSG_BROADCASTSVC_TEMPENTITYiOrigin)
    
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(idCS_TEAM_SPECTATOR)
    
set_task(0.1"userkill"id)
    
playerspec[id] = true
    user_kill
(id)
    
    
emit_sound(idCHAN_WEAPON"Extreme/fail.wav"1.0ATTN_NORM0PITCH_NORM)
    
    
g_Data[id][Data_Deaths]++
    
g_Sort true
    UpdateRank
(idfalse)
}

public 
Fwd_ClientKill_Pre(id) {
    if(
diecount[id] > 10) {
        
diecount[id] = 0
        server_cmd
("amx_banip #%d 10 ^"BombGamePlease 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] == "^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 ^"BombGamePlease 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] == "^3Warning: The next time you're banned for 10 minutes!" "")
    }
    return 
HAM_SUPERCEDE
}

public 
players_hud() {
    new 
players[32], numFormatex[10], FormatexR[16]
    
get_players(players,num,"ch")
    for(new 
i=num i++) {
        if(
user_has_weapon(players[i], CSW_C4)) formatex(Formatex9", touched")
        if(
Random == 1formatex(Formatex11" [Gravity]")
        else if(
Random == 2formatex(FormatexR12" [Teleport]")
        else if(
Random == 3formatex(FormatexR15" [Low Gravity]")
        else if(
Random == 4formatex(FormatexR10" [Sticky]")
        else 
formatex(FormatexR10" [Normal]")
        
set_dhudmessage(01502550.02is_user_alive(players[i]) ? 0.90 0.7500.20.2)
        
show_dhudmessage(players[i], "Last - %s%s%s"firstnameFormatexFormatexR)
    }
}

public 
ResetHUD(id) { 
    if(!
is_user_bot(id) && IsPlayer(id)) {
        
message_begin(MSG_ONE_UNRELIABLEg_msgHideWeapon_id)
        
write_byte(<< 3)
        
message_end()
    }
}

ShowEffect(id) {
    new 
iOrigin[3]
    
get_user_origin(idiOrigin)
    
    
message_begin(MSG_PVSSVC_TEMPENTITYiOrigin)
    
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(idtemp[0], temp[1])
        if(
weapon == CSW_C4)
            
entity_set_string(idEV_SZ_viewmodel"models/Extreme/v_c4.mdl")
    }
}

public 
C4SoundEffect() {
    new 
szPlayers[32], iNumisal[33]
    
get_players(szPlayersiNum"ch")
    
    new 
iEnt = -1
    
if(iNum) {
        for(new 
0iNumi++) {
            if(
user_has_weapon(szPlayers[i], CSW_C4))
                
isal[szPlayers[i]] = true
            
else while((iEnt find_ent_by_class(iEnt"weaponbox")) != 0)
                
isal[pev(iEntpev_owner)] = true
            
if(isal[szPlayers[i]]) {
                if(
timer 30emit_sound(szPlayers[i], CHAN_WEAPON"weapons/c4_beep1.wav"0.3ATTN_NORM0PITCH_NORM)
                else if(
timer 40emit_sound(szPlayers[i], CHAN_WEAPON"weapons/c4_beep2.wav"0.3ATTN_NORM0PITCH_NORM)
                else if(
timer 45emit_sound(szPlayers[i], CHAN_WEAPON"weapons/c4_beep3.wav"0.3ATTN_NORM0PITCH_NORM)
                else if(
timer 50emit_sound(szPlayers[i], CHAN_WEAPON"weapons/c4_beep4.wav"0.3ATTN_NORM0PITCH_NORM)
                else 
emit_sound(szPlayers[i], CHAN_WEAPON"weapons/c4_beep5.wav"0.3ATTN_NORM0PITCH_NORM)
            }
        }
    }
}

stock ColorChat(index, const Msg[], {FloatSqlResult,_}:...) {
    new 
Buffer[190], Buffer2[192]
    
formatex(Buffer2sizeof(Buffer2)-1"^3[^1 BombGame ^3]^1 %s"Msg)
    
vformat(Buffersizeof(Buffer)-1Buffer23)
    if(!
index) {
        for(new 
1<= g_iMaxPlayersi++) {
            if(!
is_user_connected(i)) continue
            
message_begin(MSG_ONE_UNRELIABLEg_iMsgSayText,_i)
            
write_byte(i)
            
write_string(Buffer)
            
message_end()
        }
    } else {
        if(!
is_user_connected(index)) return
        
message_begin(MSG_ONE_UNRELIABLEg_iMsgSayText,_index)
        
write_byte(index)
        
write_string(Buffer)
        
message_end()
    }
}

public 
ShowShopMenu(id) {
    if(
is_user_connected(id)) {
        new 
szShop[200]
        
formatex(szShopcharsmax(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(shopmenuMPROP_NUMBER_COLOR"\w")
        
menu_display(idshopmenu)
    }
}

public 
ShopMenu(idshopmenuitem)
{
    if(
item == MENU_EXIT) return
    new 
name[33], money cs_get_user_money(id)
    
get_user_name(idname31)
    new 
Data[7], Name[64], AccessCallbackt
    
for(new ids=1ids <= g_iMaxPlayersids++) if(is_user_connected(ids) && is_user_alive(ids)) t++
    if(
3) {
        
ColorChat(id"Need 3 Players alive to this")
        return
    }
    
menu_item_getinfo(shopmenuitemAccessData,5Name63Callback)
    
    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(idCHAN_BODY"Extreme/shop_needpoints.wav"1.0ATTN_NORM0PITCH_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(id500.0 800)
                
ColorChat(0"^4%s ^1Buy ^3^"500 Gravity^""name)
                
cs_set_user_money(idmoney 3000)
            }
        }
        case 
3: {
            if(
money 4000) {
                
emit_sound(idCHAN_BODY"Extreme/shop_needpoints.wav"1.0ATTN_NORM0PITCH_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(idmoney 4000)
            }
        }
        case 
4: {
            if(
money 5000) {
                
emit_sound(idCHAN_BODY"Extreme/shop_needpoints.wav"1.0ATTN_NORM0PITCH_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
(idkRenderFxNone202020kRenderTransAlpha40)
                
ColorChat(0"^4%s ^1Buy ^3^"70%% Invisible^""name)
                
cs_set_user_money(idmoney 5000)
            }
        }
        case 
5: {
            if(
money 6000) {
                
emit_sound(idCHAN_BODY"Extreme/shop_needpoints.wav"1.0ATTN_NORM0PITCH_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(idCSW_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
(szPlayersiNum"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(idsfirstname32)
                    
set_dhudmessage(25500, -1.00.1402.02.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(idmoney 6000)
            }
        }
        case 
6: {
            if(
money 7000) {
                
emit_sound(idCHAN_BODY"Extreme/shop_needpoints.wav"1.0ATTN_NORM0PITCH_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(idCS_TEAM_T)
                
playerspec[id] = false
                ExecuteHamB
(Ham_CS_RoundRespawnid)
                
ColorChat(0"^4%s ^1Buy ^3^"Respawn^""name)
                
cs_set_user_money(idmoney 7000)
            }
        }
        case 
7: {
            if(
money 8000) {
                
emit_sound(idCHAN_BODY"Extreme/shop_needpoints.wav"1.0ATTN_NORM0PITCH_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(idmoney 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."PositionArraySize(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:SteamIDPosition1Position2)
{
    static 
SteamID1[32], SteamID2[32], Kills1Kills2Deaths1Deaths2
    ArrayGetString
(SteamIDPosition1SteamID131)
    
ArrayGetString(SteamIDPosition2SteamID231)
    
TrieGetCell(g_KillsSteamID1Kills1)
    
TrieGetCell(g_KillsSteamID2Kills2)
    
TrieGetCell(g_DeathsSteamID1Deaths1)
    
TrieGetCell(g_DeathsSteamID2Deaths2)
    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(FileData96)

        if(!
strlen(Data))
            continue
        
parse(DataSteamID31Name31Kills15Deaths15)
        
        
ArrayPushString(g_SteamIDSteamID)
        
TrieSetString(g_NameSteamIDName)
        
TrieSetCell(g_KillsSteamIDstr_to_num(Kills))
        
TrieSetCell(g_DeathsSteamIDstr_to_num(Deaths))
    }
    
fclose(File)
}

SaveRanks() {
    new 
File fopen(g_File"w+")
    if(!
File) return
    for(new 
PositionSize ArraySize(g_SteamID), SteamID[32], Name[32], KillsDeathsPosition SizePosition++)
    {
        
ArrayGetString(g_SteamIDPositionSteamID31)
        
TrieGetString(g_NameSteamIDName31)
        
TrieGetCell(g_KillsSteamIDKills)
        
TrieGetCell(g_DeathsSteamIDDeaths)
        
        
fprintf(File"%s ^"%s^" %d %d^n"SteamIDNameKillsDeaths)
    }
    
fclose(File)
}

AddRank(Client) {
    
g_Data[Client][Data_Kills] = 0
    g_Data
[Client][Data_Deaths] = 0

    ArrayPushString
(g_SteamIDg_Data[Client][Data_SteamID])
    
TrieSetString(g_Nameg_Data[Client][Data_SteamID], g_Data[Client][Data_Name])
}

LoadData(Client) {
    
TrieGetCell(g_Killsg_Data[Client][Data_SteamID], g_Data[Client][Data_Kills])
    
TrieGetCell(g_Deathsg_Data[Client][Data_SteamID], g_Data[Client][Data_Deaths])
}

UpdateRank(Clientbool:Name) {
    if(
NameTrieSetString(g_Nameg_Data[Client][Data_SteamID], g_Data[Client][Data_Name])
    
TrieSetCell(g_Killsg_Data[Client][Data_SteamID], g_Data[Client][Data_Kills])
    
TrieSetCell(g_Deathsg_Data[Client][Data_SteamID], g_Data[Client][Data_Deaths])
}

GetPosition(Client) {
    static 
PositionSizeSteamID[32]
    for(
Position 0Size ArraySize(g_SteamID); Position SizePosition++) {
        
ArrayGetString(g_SteamIDPositionSteamID31)

        if(
equal(SteamIDg_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 LengthPositionSizeSteamID[32], Name[32], KillsDeaths
    Length 
formatex(g_Top15[Length], 2047 LengthHeader"Rank""Name""Wins""Deaths by bomb")
    
    for(
Position 0Size min(ArraySize(g_SteamID), 15); Position SizePosition++) {
        
ArrayGetString(g_SteamIDPositionSteamID31)
        
TrieGetString(g_NameSteamIDName31)
        
TrieGetCell(g_KillsSteamIDKills)
        
TrieGetCell(g_DeathsSteamIDDeaths)
        
        
Length += formatex(g_Top15[Length], 2047 LengthBufferPosition 1NameKillsDeaths)
    }
}

public 
client_PreThink(id) {
    if(
is_user_connected(id)) {
        
set_pev(idpev_fuser20.0)
        if(!
user_has_weapon(idCSW_C4) && TeleDelay && pev(idpev_button) & IN_USE
        
&& !(pev(idpev_oldbuttons) & IN_USE) && Random == 2) {
            new 
iEnt = -1Float:origin[3]
            while((
iEnt find_ent_by_class(iEnt"weaponbox")) != 0) {
                if(
id == pev(iEntpev_owner) && !is_user_stuck(id)) {
                    
get_brush_entity_origin(iEntorigin)
                    
origin[2] += 39.0
                    engfunc
(EngFunc_SetOriginidorigin)
                    
TeleDelay false
                    set_task
(2.0"CanTele")
                }
            }
        }
    }
}

is_user_stuck(plr) {
    static 
origin[3]
    
pev(plrpev_originorigin)
    
engfunc(EngFunc_TraceHulloriginoriginIGNORE_MONSTERSpev(plrpev_flags) & FL_DUCKING HULL_HEAD HULL_HUMANplr0)
    return 
get_tr2(0TR_StartSolid)
}

public 
TaskStripUserC4(id) {
    if(
is_user_alive(id) && user_has_weapon(idCSW_C4)) {
        
fm_strip_user_weapons(id)
        new 
players[32], num
        get_players
(playersnum"ach")
        for(new 
i=0numi++)
            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(identity_set_int(id,  EV_INT_watertype, -3)
public 
userkill(iduser_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(Clientshow_motd(Clientg_Top15"Extreme BombGame Top 15")
public 
SetOldMoney(id) {
    if(
userhasswin[id] > 0) {
        
cs_set_user_money(idoldmoney[id] + 5000)
        
userhasswin[id]--
    } else    
cs_set_user_money(idoldmoney[id] == oldmoney[id])
}
public 
Event_HLTV() g_bAbleToSpawn true
public Task_GiveGlow(id) {
    if(
user_has_weapon(idCSW_C4)) Glow(id)
    else {
        new 
iEnt = -1
        
while((iEnt find_ent_by_class(iEnt"weaponbox")) != 0)
            if(
id == pev(iEntpev_owner)) Glow(id)
    }
}

public 
Glow(id) {
    if(
Random == 1fm_set_user_rendering(idkRenderFxGlowShell1502550kRenderNormal16)
    else if(
Random == 2fm_set_user_rendering(idkRenderFxGlowShell02550kRenderNormal16)
    else if(
Random == 3fm_set_user_rendering(idkRenderFxGlowShell2550255kRenderNormal16)
    else if(
Random == 4fm_set_user_rendering(idkRenderFxGlowShell2551000kRenderNormal16)
    else 
fm_set_user_rendering(idkRenderFxGlowShell0150255kRenderNormal16)

But i have a lot of bugs with the bomb...
someone can fix this plugin please !
i need this plugin!
sorry about my bad english.
Eviatar Mor is offline