Raised This Month: $ Target: $400
 0% 

Trying to Fix EJL's Kamikaze Plugin


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
fr8899
BANNED
Join Date: Dec 2007
Old 12-19-2007 , 20:00   Trying to Fix EJL's Kamikaze Plugin
Reply With Quote #1

I run EJL's timebomb plugin on my server. It works great, except for one bug. When a player is the last one alive on their team and they kamikaze, the bomb only works if the timer runs out. If the player gets killed or suicides, the bomb doesn't kill anyone. Can someone help me edit the code so the bomb detonates when they are killed or suicide? Thanks.

PHP Code:
/*************************************************************************** 
* amx_ejl_timebomb.sma     release version 3.1.1           Date: 11/17/02 
*  Author: Eric Lidman      [email protected] 
*  Alias: Ludwig van        Upgrade: http://lidmanmusic.com/cs/plugins.html            

* Formerly my Adminmod 'kamikazi' plugin re-written for AMX mod. 
* PODBOT: If using my podbots controller, podbots use this plugin too. 
* FX updated -- looks way cooler !!! 

* COMMANDS: 

*    say: kamikaze 
*    amx_timebombs < 0 | 1 >       
*    amx_timebombs_default 
*    amx_timebombs_lock 
*    amx_votetimebomb <part of nick> 
*    stopvote 
*    amx_timebomb_credit < 0 | 1 > 
*    amx_timebomb_credit_default   
*    amx_timebomb <part of nick> 

*    Player can become a timebomb by saying "kamikazi" in chat. Admin can 
*    disable the kamikaze function with amx_timebombs 0 and turn it back 
*    on again with amx_timebombs 1. amx_timebombs_credit turns on and off 
*    the giving of frag credit to the kamikazi for any kills he makes by 
*    blowing up members of the other team. Admin can make any live player 
*    without immunity into a timebomb with amx_timebomb <part of nick>. 
*    amx_timebombs_default sets the current timebombs mode as default by 
*    writing it to a vault file and loading it at map start when plugins 
*    are initialized. amx_timebomb_credit_default sets the current kamikazi 
*    frag credit mode as default just as admin_timebombs_default does. 
*    AMX ACCESS_RCON is required to set any defaults. 

* CVARS: 

*    amx_kamikaze_obeyffcvar 1 --if mp_friendlyfire is 1 and this cvar is 
*                                set to 0, this plugin will act as if 
*                                friendlyfire is off ... even if its on. 
*    amx_kamikaze_tkpunish2 1  --if friendlyfire is on, this sets the type 
*                                of punishment given if you kill a certain 
*                                number of teammates detemined by the cvar 
*                                amx_kamikaze_tkpunish3. Can be set 0 - 2 
*                                   0 = no action 
*                                   1 = kick off server 
*                                   2 = ban for 3 hours 
*    amx_kamikaze_tkpunish3 3  --if friendlyfire is on, on killing this 
*                                many of your teammates, the plugin takes 
*                                the action set by amx_kamikaze_tkpunish2 

* THE DETAILS: 

*    Timer has a 15 second fuse. Countdown is done with half-life sounds. 
*    Displayed countdown message is color coded by team (CS t=red ct=blue). 
*    Bystanders will also die when bomb explodes. You know you are a 
*    bystander (or bomb) if you hear the timer beep. No more than 
*    one player can kamikazi any given time. There is no limit to how many 
*    players can be bombs by an admin command. A timebomb player glows red 
*    during the countdown. Dead Players cannot become timebombs. 
*    There is a delay between "kamikaze" runs for each player to keep 
*    players from hogging the bomb. A timebomb player who dies before the 
*    end of countdown explodes one second after death, also killing 
*    bystanders. The bomb is sensitive to the friendlyfire cvar. This way 
*    if FF is off, you dont blow up your teamates. You earn a frag for each 
*    player of the opposing team you blow up as the bomber. This frag credit 
*    only appies as the admin allows and only for kamikazi runs. A player 
*    who was turned into a timebomb by an admin recieves no credit. 
*    There is a delay at round start for kamikazi runs. Also, within the 
*    first 10 seconds of round start, the bomb will only kill the bomber 
*    and no bystanders even if FF is on. Kamikazis/timebombs do not carry 
*    over into the next round and will be exploded at the end of the 
*    round (CS). New: bystanders, if far enough away may only get hurt by 
*    the bomb and not killed outright. This plugin logs kills in the 
*    standard HL format so that log parsers like psyshcostats can record 
*    kamikazi kills for stats pages (if frag credit is on). Also there is 
*    now an option for friendlyfire servers to turn off friendlyfire for 
*    kamikaze kills. Additionallly there is A built in TK punish system 
*    for dealing with kamikaze team kills. See cvars. 

* Setup: Set kamikazi rule for particular maps and lock it if you wish. 
*     
*    Create a file called kamikazi_config.txt and put it into your 
*    ..addons/amx folder. The contents should be the name of the map 
*    followed by 2 numbers which are 1 or 0. The first number turns on 
*    and off kamikazi mode for a map, the second specifies whether the 
*    fist value is locked and cannot be changed by a lower admin. 
*    Example contents of a line:  de_dust 0 1 
*    That 0 turns kamikazi off for de_dust and the 1 locks that so admin 
*    cant change it. 

* Other Credits: 
*       
*    OLO -- for making AMXmod so that we can have a kamikaze with cool FX 
*    f117bomb -- for snippets admin_slay2 that helped me 
*    Ludwig van -- (lol -me) for for writing the original admimod version 

* Additional: 

*   If you have the module from SpaceDude's warcraft3 plugin (war3_ms) you 
*   can make the deahtmessages look more real, so flamethrower kills look 
*   like an actual player killing another player instead of a suicide on the 
*   part of the killed player. To enable this, you need to change the code 
*   below. Simply change the value to 1 where it has #define use_war3 0 
*   Its simple, a one line change, thats it, compile and its ready to go. 

TODO: 
> Hey Lud I was thinking about Kamikaze again. How about making it something 
> you have to buy. 
> Once you buy it you start ticking and Flashing , with the bomb on your back. 
> Then you can detonate yourself when you hearts desire.(/boom) detonator 
> switch? 
> At round end if you haven't detonated yourself 1)then you explode 2)you can 
> carry the Kamikaze bomb over to next round. 
> And if you die prior to typing the detonator switch , oh well you just 
> contiune to Tick !! 
> Also you can have a bomb Radius cvar? 
>   
> Also Lud the other Variation of Kamikaze. 
> The player typing Kamikaze has a Primer(which could be variable) that needs 
> to be meet before the 
>  bomber would be come lethal to his enemy. So what do you think? Also thanks 
> For the deathbeams , 
> Cool. Thanks Eric , Collin 



***************************************************************************/ 

/*  To get the better deathmessages. Change this one  */ 
/*  line so it looks like:    #define use_war3 1      */ 

#define use_war3 0 

new BOMBKILL_RANGE 550  // killing radius of bomb. (96 is playerheight) 
new BOMBHURT_RANGE 900  // hurt radius of bomb. (96 is playerheight) 
new KAMIKAZI_DELAY 40    // time between allowed kamikazi runs for a player 
new BOMB_FUSE 10        // fuse time 

/************************************************************************************ 
*                                                                                  * 
*  *end* customizable section of code. other changes can be done with the cvars    * 
*                                                                                  * 
************************************************************************************/ 


#include <amxmodx> 
#include <amxmisc>
#include <fun>
#if use_war3 == 1 
#include <war3> 
new gmsgDeathMsg 
new redundant_plug 
#endif 

new votenumber 
new votecontroller[33][2
new 
answer[128
new 
option_name[4][32
new 
option[4
new 
Float:vote_ratio 
new st_vote 
new totalvoters 
new bool:bVoteToStop false 
new bool:bomb_lock false 
new bool:tfc_b false 
new bool:dod_running 
new bool:cstrike
new tkcount[33
new 
bgf_message[33
new 
isspy[33

new 
vault_value[128
new 
gmsgFade 
new gmsgShake 
new fuselight 
new c4bomb 
new gibs 
new smoke 
new white 
new fire 
new Float:ejl_nextbomb[33
new 
IsBomb[33
new 
IsKamik[33
new 
wasbomb[33
new 
bool:bKamikAllow true 
new bool:bKamikCredit true 
new bool:rs false 


explode
(vec1[3],id){ 
   
// blast circles 
   
message_beginMSG_BROADCAST,SVC_TEMPENTITY,vec1
   
write_byte21 
   
write_coord(vec1[0]) 
   
write_coord(vec1[1]) 
   
write_coord(vec1[2] + 16
   
write_coord(vec1[0]) 
   
write_coord(vec1[1]) 
   
write_coord(vec1[2] + 1936
   
write_shortwhite 
   
write_byte// startframe 
   
write_byte// framerate 
   
write_byte// life 2 
   
write_byte20 // width 16 
   
write_byte// noise 
   
write_byte188 // r 
   
write_byte220 // g 
   
write_byte255 // b 
   
write_byte255 //brightness 
   
write_byte// speed 
   
message_end() 
     
   
//Explosion2 
   
message_beginMSG_BROADCAST,SVC_TEMPENTITY
   
write_byte12 
   
write_coord(vec1[0]) 
   
write_coord(vec1[1]) 
   
write_coord(vec1[2]) 
   
write_byte188 // byte (scale in 0.1's) 188 
   
write_byte10 // byte (framerate) 
   
message_end() 

   
//TE_Explosion 
   
message_beginMSG_BROADCAST,SVC_TEMPENTITY,vec1
   
write_byte
   
write_coord(vec1[0]) 
   
write_coord(vec1[1]) 
   
write_coord(vec1[2]) 
   
write_shortfire 
   
write_byte65 // byte (scale in 0.1's) 188 
   
write_byte10 // byte (framerate) 
   
write_byte// byte flags 
   
message_end() 

   
//TE_KILLPLAYERATTACHMENTS 
   
message_begin(MSG_BROADCAST,SVC_TEMPENTITY,{0,0,0},id
   
write_byte125 // will expire all TENTS attached to a player. 
   
write_byteid // byte (entity index of player) 
   
message_end() 

   
//Smoke 
   
message_beginMSG_BROADCAST,SVC_TEMPENTITY,vec1
   
write_byte// 5 
   
write_coord(vec1[0]) 
   
write_coord(vec1[1]) 
   
write_coord(vec1[2]) 
   
write_shortsmoke 
   
write_byte20 )  // 2 
   
write_byte10 )  // 10 
   
message_end() 



public 
roundend_cleanup(){ 
    
blowem_up(100
    
rs true 
    set_task
(15.0,"roundstart_delay"


public 
roundstart_delay(){ 
    
rs false 


public 
round_start(){ 
    new 
maxplayers get_maxplayers()+
    
for (new a=1a<maxplayersa++){ 
        if(
wasbomb[a] == 1){ 
            
set_user_rendering(a,kRenderFxNone,255,255,255kRenderNormal,16
            
wasbomb[a] = 
        

    } 
    return 
PLUGIN_CONTINUE 


public 
client_connect(id){ 
    
ejl_nextbomb[id] = 0.0 
    IsBomb
[id] = 
    IsKamik
[id] = 
    wasbomb
[id] = 
    votecontroller
[id][1] = 
    isspy
[id] = 
    
return PLUGIN_CONTINUE 


public 
client_disconnect(id){ 
    
ejl_nextbomb[id] = 0.0 
    IsBomb
[id] = 
    IsKamik
[id] = 
    wasbomb
[id] = 
    votecontroller
[id][1] = 
    isspy
[id] = 
    
return PLUGIN_CONTINUE 


public 
amx_timebombs(id,level,cid){ 
    if (!
cmd_access(id,level,cid,1)) 
        return 
PLUGIN_HANDLED 

    
if(bomb_lock == true){ 
        
console_print(id,"[AMXX] Kamikaze ON/OFF is locked. No change can be made unless you do amx_timebombs_lock")         
        return 
PLUGIN_HANDLED 
    

    if (
read_argc() < 2){ 
        new 
onoff[4
        if(
bKamikAllow == true){ 
            
copy(onoff4"ON"
        }else{ 
            
copy(onoff4"OFF"
        } 
        
console_print(id,"[AMXX] Usage: amx_timebombs < on | off >     Currently: %s"onoff
        return 
PLUGIN_HANDLED 
    


    new 
arg[10
    
read_argv(1,arg,10

    if ( (
equal(arg,"on"2)) || (equal(arg,"1"1)) ){ 
        
bKamikAllow true 
        console_print
(id,"[AMXX] Kamikaze mode is now ON"
        
client_print(0,print_chat,"[AMXX] Admin has turned Kamikaze mode ON"
    }else{ 
        
bKamikAllow false 
        console_print
(id,"[AMXX] Kamikaze mode is now OFF"
        
client_print(0,print_chat,"[AMXX] Admin has turned Kamikaze mode OFF"
    } 

    new 
authid[16],name[32
    
get_user_authid(id,authid,16
    
get_user_name(id,name,32

    
log_amx("^"%s<%d><%s><>^" timebombs_mode %s"nameget_user_userid(id), authidarg

    return 
PLUGIN_HANDLED 


public 
amx_timebombs_d(id,level,cid){ 
    if (!
cmd_access(id,level,cid,1)) 
        return 
PLUGIN_HANDLED 

    
if(bKamikAllow == false){ 
        
ejl_vault("WRITE","Timebombs","off"
        
console_print(id,"[AMXX] Kamikaze mode OFF   is now the default."
    }else{ 
        
ejl_vault("WRITE","Timebombs","on"
        
console_print(id,"[AMXX] Kamikaze mode ON    is now the default."
    } 

    new 
authid[16],name[32
    
get_user_authid(id,authid,16
    
get_user_name(id,name,32

    
log_amx("^"%s<%d><%s><>^" timebombs_mode_d"nameget_user_userid(id), authid

    return 
PLUGIN_HANDLED 


public 
amx_tb_credit(id,level,cid){ 
    if (!
cmd_access(id,level,cid,1)) 
        return 
PLUGIN_HANDLED 

    
if (read_argc() < 2){ 
        new 
onoff[4
        if(
bKamikCredit == true){ 
            
copy(onoff4"ON"
        }else{ 
            
copy(onoff4"OFF"
        } 
        
console_print(id,"[AMXX] Usage: amx_timebomb_credit < on | off >     Currently: %s"onoff
        return 
PLUGIN_HANDLED 
    


    new 
arg[10
    
read_argv(1,arg,10

    if ( (
equal(arg,"on"2)) || (equal(arg,"1"1)) ){ 
        
bKamikCredit true 
        console_print
(id,"[AMXX] Kamikaze frag credit is now ON"
        
client_print(0,print_chat,"[AMXX] Admin has turned Kamikaze frag credit mode ON"
    }else{ 
        
bKamikCredit false 
        console_print
(id,"[AMXX] Kamikaze frag credit is now OFF"
        
client_print(0,print_chat,"[AMXX] Admin has turned Kamikaze frag credit mode OFF"
    } 

    new 
authid[16],name[32
    
get_user_authid(id,authid,16
    
get_user_name(id,name,32

    
log_amx("^"%s<%d><%s><>^" kamikazi_frag_cr %s"nameget_user_userid(id), authidarg

    return 
PLUGIN_HANDLED 


public 
amx_tb_credit_d(id,level,cid){ 
    if (!
cmd_access(id,level,cid,1)) 
        return 
PLUGIN_HANDLED 

    
if(bKamikCredit == false){ 
        
ejl_vault("WRITE","Kamikazi_FragCredit","off"
        
console_print(id,"[AMXX] Kamikaze frag credit:  OFF   is now the default."
    }else{ 
        
ejl_vault("WRITE","Kamikazi_FragCredit","on"
        
console_print(id,"[AMXX] Kamikaze frag credit:  ON    is now the default."
    } 

    new 
authid[16],name[32
    
get_user_authid(id,authid,16
    
get_user_name(id,name,32

    
log_amx("^"%s<%d><%s><>^" kamikazi_frag_cr_d"nameget_user_userid(id), authid

    return 
PLUGIN_HANDLED 


public 
amx_tfc_by(id,level,cid){ 
    if (!
cmd_access(id,level,cid,1)) 
        return 
PLUGIN_HANDLED 

    
if (read_argc() < 2){ 
        new 
onoff[4
        if(
tfc_b == true){ 
            
copy(onoff4"ON"
        }else{ 
            
copy(onoff4"OFF"
        } 
        
console_print(id,"[AMXX] Usage: amx_timebomb_tfc_b < on | off >     Currently: %s"onoff
        return 
PLUGIN_HANDLED 
    


    new 
arg[10
    
read_argv(1,arg,10

    if ( (
equal(arg,"on"2)) || (equal(arg,"1"1)) ){ 
        
tfc_b true 
        console_print
(id,"[AMXX] TFC timebomb bystander damage ON"
        
client_print(0,print_chat,"[AMXX] Admin has turned TFC timebomb bystander damage ON"
    }else{ 
        
tfc_b false 
        console_print
(id,"[AMXX] TFC timebomb bystander damage is now OFF"
        
client_print(0,print_chat,"[AMXX] Admin has turned TFC timebomb bystander damage OFF"
    } 

    new 
authid[16],name[32
    
get_user_authid(id,authid,16
    
get_user_name(id,name,32

    
log_amx("^"%s<%d><%s><>^" tfc_bystander %s"nameget_user_userid(id), authidarg

    return 
PLUGIN_HANDLED 


public 
amx_tfc_by_d(id,level,cid){ 
    if (!
cmd_access(id,level,cid,1)) 
        return 
PLUGIN_HANDLED 

    
if(tfc_b == false){ 
        
ejl_vault("WRITE","TFC_Kamikazi_b","off"
        
console_print(id,"[AMXX] TFC timebomb bystander damage:  OFF   is now the default."
    }else{ 
        
ejl_vault("WRITE","TFC_Kamikazi_b","on"
        
console_print(id,"[AMXX] TFC timebomb bystander damage:  ON    is now the default."
    } 

    new 
authid[16],name[32
    
get_user_authid(id,authid,16
    
get_user_name(id,name,32

    
log_amx("^"%s<%d><%s><>^" tfc_bystander_d"nameget_user_userid(id), authid

    return 
PLUGIN_HANDLED 


public 
lock_unlock(id,level,cid){ 
    if (!
cmd_access(id,level,cid,1)) 
        return 
PLUGIN_HANDLED 

    
if (bomb_lock == true){ 
        
bomb_lock false 
        console_print
(id,"[AMXX] Kamikaze mode lock is OFF."
    }else    { 
        
bomb_lock true 
        console_print
(id,"[AMXX] Kamikazi mode lock is ON."
        if(
bKamikAllow == true){ 
            
console_print(id,"[AMXX] You have locked kamikazi ON mode."
        }else{ 
            
console_print(id,"[AMXX] You have locled Kamikazi OFF mode."
        } 
    } 
    return 
PLUGIN_HANDLED 


public 
check_votes() 

    
set_cvar_string("amx_vote_inprogress","0"
    
ejl_vault("WRITE","CURRENT_VOTE","NULL"

    
bVoteToStop false 
    
for(new 033a++){ 
        
votecontroller[a][1] = 
    

    if(
st_vote == 1){ 
        
st_vote 
        client_print
(0,print_chat,"[AMXX]  Voting sucessfully stopped."
        return 
PLUGIN_HANDLED 
    


    new 
best 
    
new best_count 
    
for(new 04; ++a) { 
        if (
option[a] > best_count){ 
            
best_count option[a
            
best 
        

    } 
    new 
inum totalvoters 
    
new Float:result_v inum ? (float(option[best]) / float(inum)) : 0.0 
    
if (result_v >= vote_ratio) { 
        new 
player str_to_num(option_name[0]) 
        new 
name2[32
        
get_user_name(player,name2,32
        if(
best == 0){ 
            if(
is_user_alive(player) == 0){ 
                
client_print(0,print_chat,"[AMXX] %s is dead and cannot be turned into a bomb.",name2
                return 
PLUGIN_HANDLED 
            

            
bgf_message[player] = 
            IsBomb
[player] = BOMB_FUSE 
            player_attachment
(player
            
client_cmd(0,"spk ^"vox/warning _comma _comma detonation device activated^"")     
            
client_print(0,print_chat,"[AMXX] Voting successful. The result: %s has been turned into a timebomb by vote. (%d - %d of %d)",name2,option[0],option[1],totalvoters
        }else{ 
            
client_print(0,print_chat,"[AMXX] Voting result: %s will not become a timebomb.  (%d - %d of %d)",name2,option[0],option[1],totalvoters
            
log_amx("World triggered ^"voting_success^" (needed ^"%.2f^") (ratio ^"%.2f^") (result ^"bomb^")"vote_ratioresult_v
        } 
    }else { 
        
client_print(0,print_chat,"[AMXX] Bomb voting failed... Not enough for a clear majority  (%d - %d of %d)",option[0],option[1],totalvoters
        
log_amx("World triggered ^"voting_failure^" (needed ^"%.2f^") (ratio ^"%.2f^")"vote_ratioresult_v
    } 
    return 
PLUGIN_HANDLED 


public 
vote_count(id,key){ 
    
ejl_vault("READ","CURRENT_VOTE",""
    if(
equal(vault_value,"TIMEBOMB")){ 
    new 
name[32
    
get_user_name(id,name,32
    if(
votenumber != votecontroller[id][0]){ 
        
votecontroller[id][0] = votenumber 
        
if (get_cvar_float("amx_vote_answers")) { 
            
client_print(0,print_chat,"[AMXX] %s voted for option # %d",name,key+1
        } 
        
option[key] += 
    
}else{ 
        
votecontroller[id][1] +=
    

    }else{ 
        return 
PLUGIN_CONTINUE 
    

    return 
PLUGIN_HANDLED 


public 
admin_votebomb(id,level,cid){ 
    if (!
cmd_access(id,level,cid,2)) 
        return 
PLUGIN_HANDLED 

    
new Float:voting get_cvar_float("amx_last_voting"
    if (
voting get_gametime()){ 
        
console_print(id,"There is already one voting..."
        return 
PLUGIN_HANDLED 
    

    if (
voting && voting get_cvar_float("amx_vote_delay") > get_gametime()) { 
        
console_print(id,"Voting not allowed at this time"
        return 
PLUGIN_HANDLED 
    


    new 
inprogress[32
    
get_cvar_string("amx_vote_inprogress",inprogress,32
    if(
equal(inprogress"0",1)){ 

    new 
arg[32
    
read_argv(1,arg,32
    new 
player cmd_target(id,arg,1
    if (!
player) return PLUGIN_HANDLED 

    
new menu_msg[256
    new 
keys 
    get_user_name
(player,arg,32
    if(
is_user_alive(player) == 0){ 
        
client_print(id,print_console,"[AMXX] %s is dead and cannot be voted a bomb.",arg
        return 
PLUGIN_HANDLED 
    

    if (
cstrike
        
format(menu_msg,256,"\yShould we blow up %s?\w^n^n1.  Yes^n2.  No"arg
    else 
        
format(menu_msg,256,"Should we blow up %s?^n^n1.  Yes^n2.  No"arg
    
num_to_str(player,option_name[0],32
    
keys = (1<<0)|(1<<1

    new 
authid[16],name[32
    
get_user_authid(id,authid,16
    
get_user_name(id,name,32
    
log_amx("^"%s<%d><%s><>^" vote bomb (target ^"%s^")"nameget_user_userid(id), authidarg

    new 
Float:vote_time get_cvar_float("amx_vote_time") + 2.0 
    set_cvar_float
("amx_last_voting",  get_gametime() + vote_time 

    
vote_ratio get_cvar_float("amx_votetimebomb_ratio"
    
copy(answer,128"bomb %s"
    for(new 
033a++){ 
        
votecontroller[a][1] = 
    

    
votenumber++ 
    
set_cvar_string("amx_vote_inprogress","1"
    
ejl_vault("WRITE","CURRENT_VOTE","TIMEBOMB")     
    
bVoteToStop true 

    totalvoters 

    
new Team[33
    new 
maxpl get_maxplayers()+
    
for(new 1maxplk++){ 
        
get_user_team(k,Team,33
        if(!((
equali(Team,"UNAS",4)) || (equali(Team,"SPEC",4)) || (get_user_time(k)== 0) )){ 
            
show_menu(k,keys,menu_msg,floatround(vote_time)) 
            
totalvoters++ 
        } 
    } 

    
set_task(vote_time,"check_votes"
    
st_vote 0     
    client_print
(id,print_console,"[AMXX] Voting has started..."
    for(new 
04;++joption[j] = 
    
}else{ 
    
client_print(id,print_console,"[AMXX] Voting not allowed yet.")     
    } 

    return 
PLUGIN_HANDLED 


public 
stopvote(id,level,cid){ 
    if (!
cmd_access(id,level,cid,1)) 
        return 
PLUGIN_HANDLED 

    
if(bVoteToStop == true){ 
        new 
name[32
        
get_user_name(id,name,32
        
st_vote 
        client_print
(id,print_console,"[AMXX]  ADMIN !!! Ignore the unknown command message -- its ok"
        
client_print(0,print_chat,"[AMXX]  %s has disabled the vote in progress.",name
    } 
    return 
PLUGIN_CONTINUE 


public 
admin_timebomb(id,level,cid){ 
    if (!
cmd_access(id,level,cid,2)) 
        return 
PLUGIN_HANDLED 

    
new arg[32
    
read_argv(1,arg,32
    new 
player cmd_target(id,arg,1
    if (!
player) return PLUGIN_HANDLED 
    
if(is_user_alive(player) == 0){ 
        
console_print(id,"[AMXX] The player is dead and cannot be bombed"
        return 
PLUGIN_HANDLED 
    

    if(
IsBomb[player] > 0){ 
        
console_print(id,"[AMXX] :  That player is already a bomb"
        return 
PLUGIN_HANDLED 
    

    
bgf_message[player] = 
    IsBomb
[player] = BOMB_FUSE 
    
new name2[32
    
get_user_name(player,name2,32
    
client_cmd(0,"spk ^"vox/warning _comma _comma detonation device activated^"")     
    
client_print(0,print_chat,"[AMXX] :  %s has become a human timebomb, run for cover!!!"name2
    new 
authid[16],authid2[16],name[32
    
get_user_authid(player,authid2,16
    
get_user_authid(id,authid,16
    
get_user_name(id,name,32

    
player_attachment(player

    
log_amx("^"%s<%d><%s><>^" timebomb ^"%s<%d><%s><>^""nameget_user_userid(id), authidname2get_user_userid(player), authid2

    
console_print(id,"[AMXX] Client ^"%s^" bombed",name2
    
client_print(0,print_chat,"[AMXX] Admin:    %s  has bombed  %s",name,name2
    return 
PLUGIN_HANDLED 


public 
handle_botsayplugin(){ 
    new 
arg0[8
    
read_argv(1,arg0,7
    new 
iarg0 str_to_num(arg0
    new 
sarg2[192
    
read_args(sarg2,191
    new 
arg1[8
    
read_argv(2,arg1,7
    new 
iarg1 str_to_num(arg1
    if(
is_user_bot(iarg1)){ 
        new 
OnlySay[128
        new 
len strlen(sarg2
        new 
start contain(sarg2,":    "
        
copy(OnlySay,len-start+5,sarg2[start+5]) 
        if(
HandleSay2(iarg1,OnlySay)) 
            
server_cmd("botsayreturn %d 1",iarg0
    } 
    return 
PLUGIN_CONTINUE 


public 
HandleSay(id){ 
    new 
Speech[192
    
read_args(Speech,192
    
remove_quotes(Speech
    if(
HandleSay2(id,Speech))     
        return 
PLUGIN_HANDLED 
    
return PLUGIN_CONTINUE 


public 
HandleSay2(id,Speech[]){ 

    new 
Float:gt get_gametime() 

    if ( (
equal(Speech,"kamik",5)) || (equal(Speech,"kamak",5)) ){ 
        if(
bKamikAllow == false){ 
            
client_print(id,print_chat,"[AMXX] :  Admin has disabled the ability to kamikaze."
            return 
PLUGIN_HANDLED 
        

        if(
is_user_alive(id) == 0){ 
            
client_print(id,print_chat,"[AMXX] :  You cannot become a bomb, you are already dead."
            return 
PLUGIN_HANDLED 
        

        if(
rs == true){ 
            
client_print(id,print_chat,"[AMXX] :  Its too early in the round to become a bomb."
            return 
PLUGIN_HANDLED 
        

        if(
IsBomb[id] > 0){ 
            
client_print(id,print_chat,"[AMXX] :  You are the bomb already."
            return 
PLUGIN_HANDLED 
        

        if(
isspy[id] == 1){ 
            
client_print(id,print_chat,"[AMXX] :  You are a spy, spys cannot become kamikazes."
            return 
PLUGIN_HANDLED 
        
}             
        new 
maxpl get_maxplayers() +
        
for(new 1maxpl; ++a) { 
            if(
IsKamik[a] == 1){ 
                
client_print(id,print_chat,"[AMXX] :  Wait your turn, someone else is the kamikazi."
                return 
PLUGIN_HANDLED 
            

        } 
        if(
ejl_nextbomb[id] > gt ){ 
            
client_print(id,print_chat,"[AMXX] :  You were just a bomb a short while ago, give someone else a chance."
            return 
PLUGIN_HANDLED 
        

        
bgf_message[id] = 
        IsKamik
[id] = 
        IsBomb
[id] = BOMB_FUSE 
        ejl_nextbomb
[id] = gt KAMIKAZI_DELAY 
        
new name[32
        
get_user_name(id,name,32
        
player_attachment(id
        
client_cmd(0,"spk ^"vox/warning _comma _comma detonation device activated^"")     
        
client_print(0,print_chat,"[AMXX] :  %s has become a human timebomb, run for cover!!!"name
        return 
PLUGIN_CONTINUE         
    


    return 
PLUGIN_CONTINUE 


public 
timebomb_timer(){ 

    new 
Float:gt get_gametime() 
    new 
hibomb 100 
    
new maxpl get_maxplayers() +
    
new 
    
for(1maxpla++) { 
        if ((
IsBomb[a] != 0) && (IsBomb[a] < hibomb)) 
            
hibomb a            
        
if ( (IsKamik[a] == 1) && ((ejl_nextbomb[a] - KAMIKAZI_DELAY BOMB_FUSE 5) < gt) ){             
            
IsKamik[a] = 
            IsBomb
[a] = 
        

    } 

    for(
1maxpla++) { 
        if (
IsBomb[a] > 0){ 
            
emit_sound(a,CHAN_ITEM"buttons/blip2.wav"1.0ATTN_NORM0PITCH_NORM
            new 
origin[3
            
get_user_origin(a,origin

            
//TE_SPRITE 
            
message_begin(MSG_BROADCAST,SVC_TEMPENTITY,{0,0,0},a
            
write_byte(17// additive sprite, plays 1 cycle 
            
write_coord(origin[0]) // pos 
            
write_coord(origin[1]) // pos 
            
write_coord(origin[2]+20// pos 
            
write_short (fuselight// spr index     
            
write_byte(20// (scale in 0.1's) 
            
write_byte (200//(brightness) 
            
message_end() 

            if (
IsBomb[a] == 1){ 
                
blowem_up(a)            
            }else{ 
                
IsBomb[a] -= 
                
if (== hibomb){ 
                    new 
name[32
                    new 
team[32
                    
get_user_name(a,name,32
                    
get_user_team(a,team,32
                    if(
equal(team,"T"1)){ 
                        
set_hudmessage(200,0,00.030.7620.022.00.010.12
                    }else{ 
                        
set_hudmessage(0,100,2000.030.7620.022.00.010.12
                    } 
                    
show_hudmessage(0,"%s will explode in %d seconds.",name,IsBomb[a]) 
                    if (
IsBomb[a] == 11){ 
                        
client_cmd(0,"spk ^"fvox/remaining^""
                    } 
                    if (
IsBomb[a] < 11){ 
                        new 
temp[48
                        
num_to_word(IsBomb[a],temp,48
                        
client_cmd(0,"spk ^"fvox/%s^"",temp
                    } 
                } 
                if(
is_user_alive(a) == 0){ 
                    
blowem_up(a
                } 
            } 
        } 
    } 


public 
blowem_up(id){ 
    if(
id == 100){ 
        new 
maxpl get_maxplayers() +
        
for(new 1maxpla++) { 
            if ((
IsBomb[a] > 0) || (IsKamik[a] == 1)){ 
                
IsKamik[a] = 
                IsBomb
[a] = 
                
new name[32
                
get_user_name(a,name,32
                
set_hudmessage(200,255,2000.030.7620.022.00.010.12
                
show_hudmessage(0,"%s has exploded.",name
                new 
origin[3]     
                
get_user_origin(a,origin
                
origin[2] = origin[2] - 26 
                user_kill
(a,1
                
explode(origin,a
                
wasbomb[a] = 
                
#if use_war3 == 1 
                
stop_dm(a,a,0,9876
                
#endif 
            

        } 
    }else{ 
        if (
IsBomb[id] > 0){ 
            new 
players[32], inum 
            
new origin1[3],name[32
            
get_user_name(id,name,31
            
set_hudmessage(200,255,2000.030.7620.022.00.010.12
            
show_hudmessage(0,"%s has exploded.",name
            new 
origin[3]     
            
get_user_origin(id,origin
            new 
maxpl get_maxplayers() +
            
for(new 1maxpla++) { 
                if(
cvar_exists("mp_friendlyfire")){ 
                    new 
ffcvar get_cvar_num("mp_friendlyfire"
                    if( (
ffcvar == 0) || ((ffcvar == 1) && (get_cvar_num("amx_kamikaze_obeyffcvar") == 0)) ){ 
                        if(
get_user_team(a) != get_user_team(id)){ 
                            if((
is_user_alive(a) == 1) && (!= id)){ 
                                
get_user_origin(a,origin1
                                if(
get_distance(origin,origin1) < BOMBKILL_RANGE
                                    
do_victim(a,id,1,origin1,0
                                else if(
get_distance(origin,origin1) < BOMBHURT_RANGE
                                    
do_victim(a,id,0,origin1,0
                            } 
                        } 
                    }else{ 
                        if((
is_user_alive(a) == 1) && (!= id)){ 
                            
get_user_origin(a,origin1
                            if(
get_user_team(a) == get_user_team(id)){ 
                                if(
get_distance(origin,origin1) < BOMBKILL_RANGE){ 
                                    if(!
rs
                                        
do_victim(a,id,1,origin1,1
                                } 
                                else if(
get_distance(origin,origin1) < BOMBHURT_RANGE){ 
                                    if(!
rs
                                        
do_victim(a,id,0,origin1,1
                                } 
                            }else{ 
                                if(
get_distance(origin,origin1) < BOMBKILL_RANGE
                                    
do_victim(a,id,1,origin1,0
                                else if(
get_distance(origin,origin1) < BOMBHURT_RANGE
                                    
do_victim(a,id,0,origin1,0
                            } 
                        }                 
                    } 
                }else{ 
                    if((
is_user_alive(a) == 1) && (!= id)){ 
                        
get_user_origin(a,origin1
                        if(
get_distance(origin,origin1) < BOMBKILL_RANGE
                            
do_victim(a,id,1,origin1,0
                        else if(
get_distance(origin,origin1) < BOMBHURT_RANGE
                            
do_victim(a,id,0,origin1,0
                    } 
                } 
            } 
            
IsBomb[id] = 
            IsKamik
[id] = 
            client_print
(id,print_chat,"[AMXX] :  Sorry, the bomb killed you."
            
user_kill(id,1
            
#if use_war3 == 1 
            
stop_dm(id,id,0,9876
            
#endif 
            
message_begin(MSG_ONE,gmsgFade,{0,0,0},id
            
write_short1<<11 // fade lasts this long furation 
            
write_short1<<11 // fade lasts this long hold time 
            
write_short1<<12 // fade type (in / out) 
            
write_byte250 // fade red 
            
write_byte250 // fade green 
            
write_byte250 // fade blue 
            
write_byte255 // fade alpha 
            
message_end() 

            if((
bKamikCredit == true) && (bgf_message[id] > 0)){ 
                
client_print(id,print_chat,"[AMXX] :  Your kamikazi attempt was a success:  You made %d KILLS."bgf_message[id]) 
            } 
            
origin[2] = origin[2] - 26   
            explode
(origin,id
            
get_players(players,inum,"c"
            for(new 
;inum; ++i){ 
                
message_begin(MSG_ONE,gmsgShake,{0,0,0},players[i]) 
                
write_short1<<14 )// shake amount 
                
write_short1<<14 )// shake lasts this long 
                
write_short1<<14 )// shake noise frequency 
                
message_end() 
            } 

            
//define TE_EXPLODEMODEL 
            
message_begin(MSG_BROADCAST,SVC_TEMPENTITY,{0,0,0},id
            
write_byte(107// spherical shower of models, picks from set 
            
write_coord(origin[0]) // pos 
            
write_coord(origin[1]) 
            
write_coord(origin[2]) 
            
write_coord(175//(velocity) 
            
write_short (gibs//(model index) 
            
write_short (25// (count) 
            
write_byte (100// (life in 0.1's)         
            
message_end()         
            
wasbomb[id] = 1         
            set_user_rendering
(id,kRenderFxNone0,0,0kRenderTransAdd,0
        } 
    } 


do_victim(victim,killer,killvictim,origin1[3],tk){ 
    new 
health get_user_health(victim
    new 
team[32],teamv[32],authid[32],authidv[32],name[32],namev[32
    
get_user_team(victim,teamv,31
    
get_user_name(victim,namev,31
    
get_user_authid(victim,authidv,31
    
get_user_team(killer,team,31
    
get_user_name(killer,name,31
    
get_user_authid(killer,authid,31
    if((
killvictim == 1) || (health 50)){ 
        
client_print(victim,print_chat,"[AMXX] :  Sorry, the bomb killed you."
        if((
bKamikCredit == true) && (IsKamik[killer] == 1)){ 
            new 
bombguyfrags get_user_frags(killer
            if(
tk == 0){ 
                
bgf_message[killer] +=
                set_user_frags
(killer,bombguyfrags 1
            }else{ 
                
tkcount[killer] +=
                set_user_frags
(killer,bombguyfrags 1
                new 
punish1 get_cvar_num("amx_kamikaze_tkpunish1"
                new 
punish2 get_cvar_num("amx_kamikaze_tkpunish2"
                if(
tkcount[killer] > punish2 1){ 
                    if(
punish1 == 1
                        
client_cmd(killer,"echo You were kicked for team killing;disconnect"
                    else if(
punish1 == 2){ 
                        
client_cmd(killer,"echo You were banned for team killing"
                        if (
equal("4294967295",authid)){ 
                            new 
ipa[32
                            
get_user_ip(killer,ipa,31,1
                            
server_cmd("addip 180.0 %s;writeip",ipa
                        }else{ 
                            
server_cmd("banid 180.0 %s kick;writeid",authid
                        }     
                    } 
                } 
            }                 
            
log_message("^"%s<%d><%s><%s>^" killed ^"%s<%d><%s><%s>^" with ^"Kamikaze Bomb^""
            
name,get_user_userid(killer),authid,team,namev,get_user_userid(victim),authidv,teamv)     
        } 
        
#if use_war3 == 1 
        
stop_dm(killer,victim,0,9876
        
#endif 
        
user_kill(victim,1
        
explode(origin1,victim)                 
    }else{ 
        
client_print(victim,print_chat,"[AMXX] :  Ouch, that bomb hurt you."
        
set_user_health(victim,health-50
        if(
get_cvar_num("mp_logdetail") == 3){ 
            
log_message("^"%s<%d><%s><%s>^" attacked ^"%s<%d><%s><%s>^" with ^"Kamikaze Bomb^" (hit ^"chest^") (damage ^"50^") (health ^"%d^")"
            
name,get_user_userid(killer),authid,team,namev,get_user_userid(victim),authidv,teamv,get_user_health(victim)) 
        } 
        if(
tk == 1){ 
            new 
players[32],pNum 
            get_players
(players,pNum,"e",team
            for(new 
i=0;i<pNum;i++) 
                
client_print(players[i],print_chat,"%s  attacked a teammate",name
        } 
    } 


player_attachment(id){ 
    new 
att_life = (BOMB_FUSE 10) + 20 
    
if(att_life 255 || att_life 1
        
att_life 255 

    
//TE_PLAYERATTACHMENT 
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY,{0,0,0},id
    
write_byte 124 //attaches a TENT to a player (this is a high-priority tent) 
    
write_byte id )  //(entity index of player) 
    
write_coord )  // ( attachment origin.z = player origin.z + vertical offset ) 
    
write_short c4bomb // model index 
    
write_short att_life )     // (life * 10 ) 
    
message_end() 


public 
plugin_log(){ 
    new 
args read_logargc() 
    if(
args == 2){ 
        new 
msg[32
        
read_logargv(1,msg,31
        if(
msg[6] == 'S'
            
round_start() 
    } 
    else if(
args == 3){ 
        new 
msg[32
        
read_logargv(1,msg,31
        if(
equal(msg,"changed role to",15)){ 
            new 
clinfo[64],won[32],cutoff,bcount 
            
new classinfo[32]     
            
read_logargv(0,clinfo,63
            
read_logargv(2,classinfo,31
            new 
tcbackw strlen(clinfo
            new 
cbackw tcbackw 
            
for(new i=0;i<tcbackw;i++){ 
                
cbackw -= 
                
if(cbackw 0){ 
                    if(
clinfo[cbackw] == '<'){ 
                        
bcount +=
                        
if(bcount == 2){ 
                            
copy(won,i-cutoff,clinfo[cbackw+1]) 
                        } 
                        else if(
bcount == 1
                            
cutoff 2                         
                    

                } 
            } 
            new 
playerl find_player("c",won
            if(!
playerl) return PLUGIN_CONTINUE 
            
if(equali(classinfo,"Spy")) 
                
isspy[playerl] = 
            
else 
                
isspy[playerl] = 
        
}     
    } 
    return 
PLUGIN_CONTINUE 


public 
new_spawn(id){ 
    if(!
cstrike){ 
        
set_user_rendering(id,kRenderFxNone,255,255,255kRenderNormal,16
        
wasbomb[id] = 
    

    
#if use_war3 == 1 
    
block_message(gmsgDeathMsg
    
#endif 
    
return PLUGIN_CONTINUE 


#if use_war3 == 1 
public stop_dm(id,tid,tbody,num){ 
    if(
num == 9876){ 
        if (
tbody == 1){ 
            
message_beginMSG_ALLgmsgDeathMsg,{0,0,0},0
            
write_byte(id
            
write_byte(tid
            
write_string(" kamikaze bomb"
            
message_end() 
        }else{ 
            
message_beginMSG_ALLgmsgDeathMsg,{0,0,0},0
            
write_byte(id
            
write_byte(tid
            
write_byte(0
            
write_string(" kamikaze bomb"
            
message_end() 
        } 
    }else{ 
        if(
redundant_plug == 0){ 
            new 
killer_id read_data(1
            new 
victim_id read_data(2
            new 
headshot read_data(3
            new 
weaponname[20
            if(
cstrike
                
read_data(4,weaponname,31
            else 
                
read_data(3,weaponname,31
            new 
weapon 
            get_user_attacker
(victim_id,weapon
         
            if (!(
killer_id==victim_id && !headshot && equal(weaponname,"world"))){ 
                
message_beginMSG_ALLgmsgDeathMsg,{0,0,0},0
                
write_byte(killer_id
                
write_byte(victim_id
                
write_byte(headshot
                
write_string(weaponname
                
message_end() 
            } 
        } 
    } 
    return 
PLUGIN_HANDLED 


public 
regulate_plugins_dm(){ 
    new 
nump get_pluginsnum() 
    new 
filename[64],name[64],version[32],author[32],status[32
    for(new 
i=0;i<nump;++i){              
        
get_plugin(i,filename,63,name,63,version,31,author,31,status,31
        if(
equali(filename,"warcraft3.amx")){ 
            
set_cvar_num("amx_ejl_rpdm",1
            
redundant_plug 
        

    } 
    for(new 
i=0;i<nump;++i){              
        
get_plugin(i,filename,63,name,63,version,31,author,31,status,31
        if(
get_cvar_num("amx_ejl_rpdm")){ 
            if( (
equali(filename,"amx_ejl_laserweapon.amx")) && (str_to_num(version[0]) > 1) ) 
                
redundant_plug 
            
else if( (equali(filename,"laser_guns.amx")) && (str_to_num(version[0]) > 1) ) 
                
redundant_plug 
            
else if( (equali(filename,"amx_ejl_missiles.amx")) && (str_to_num(version[0]) > 1) ) 
                
redundant_plug 
            
else if( (equali(filename,"cs_missiles.amx")) && (str_to_num(version[0]) > 1) ) 
                
redundant_plug 
            
else if( (equali(filename,"amx_ejl_flamethrower.amx")) && (str_to_num(version[0]) > 4) ) 
                
redundant_plug 
            
else if( (equali(filename,"cs_flamethrower.amx")) && (str_to_num(version[0]) > 4) ) 
                
redundant_plug 
            
else if( (equali(filename,"amx_ejl_jetpack.amx")) && (str_to_num(version[0]) > 1) ) 
                
redundant_plug 
            
else if( (equali(filename,"luds_jetpack.amx")) && (str_to_num(version[0]) > 1) ) 
                
redundant_plug 
        

    } 
    
set_cvar_num("amx_ejl_rpdm",1
    
set_task(1.0,"regulate_plugins_rs"
    return 
PLUGIN_CONTINUE 


public 
regulate_plugins_rs(){ 
    
set_cvar_num("amx_ejl_rpdm",0
    return 
PLUGIN_CONTINUE 


#endif 

public plugin_precache(){ 
    new 
mod_name[32
    
get_modname(mod_name,31
    
dod_running equal(mod_name,"dod") ? true false 
    
if(dod_running
        
smoke precache_model("sprites/smoke.spr"
    else 
        
smoke precache_model("sprites/steam1.spr"
    
white precache_model("sprites/white.spr"
    
fire precache_model("sprites/explode1.spr"
    
fuselight precache_model("sprites/glow01.spr"
    
c4bomb precache_model("models/w_weaponbox.mdl"
    
gibs precache_model("models/hgibs.mdl"
    
precache_sound"buttons/blip2.wav")   
    return 
PLUGIN_CONTINUE 


public 
plugin_init(){ 
    
register_plugin("Kamikaze","3.1.1","EJL"
    
register_cvar("amx_luds_kamikaze","v3.1.1",FCVAR_SERVER 
    
register_concmd("amx_timebombs","amx_timebombs",ADMIN_SLAY,"<on |off>   turns ability to kamikazi on and off"
    
register_concmd("amx_timebombs_default","amx_timebombs_d",ADMIN_RCON,"sets the current kamikazi mode as default"
    
register_concmd("amx_timebomb_credit","amx_tb_credit",ADMIN_SLAY,"<on |off>   turns kamikazi frag credit on and off"
    
register_concmd("amx_timebomb_credit_default","amx_tb_credit_d",ADMIN_RCON,"sets the current kamikazi frag credit mode as default"
    
register_concmd("amx_timebomb","admin_timebomb",ADMIN_SLAY,"< player >"
    
register_concmd("amx_votetimebomb","admin_votebomb",ADMIN_USER,"< part of nick >"
    
register_concmd("amx_timebombs_lock","lock_unlock",ADMIN_RCON,"Locks/unlocks the current timebombs mode"
    
register_concmd("stopvote","stopvote",ADMIN_MAP,"stops vote in progress"
    
register_clcmd("say","HandleSay"
    
register_event("SendAudio","roundend_cleanup","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw"
    
register_event("TextMsg","roundend_cleanup","a","2&#Game_C","2&#Game_w"
    
register_srvcmd("botsay","handle_botsayplugin"

    
register_cvar("amx_kamikaze_obeyffcvar","1"
    
register_cvar("amx_kamikaze_tkpunish1","1"
    
register_cvar("amx_kamikaze_tkpunish2","3"
    
set_cvar_string("amx_kamikaze_obeyffcvar","1"
    
set_cvar_string("amx_kamikaze_tkpunish1","1"
    
set_cvar_string("amx_kamikaze_tkpunish2","3"

    
register_cvar("amx_vote_inprogress","0"
    
register_cvar("amx_last_voting","0"
    
set_cvar_float("amx_last_voting",0.0
    
register_menucmd(register_menuid("Should we blow up ") ,(1<<0)|(1<<1)|(1<<2)|(1<<3),"vote_count"
    
register_cvar("amx_votetimebomb_ratio","0.51"
    
gmsgFade get_user_msgid("ScreenFade"
    
gmsgShake get_user_msgid("ScreenShake"

    
set_task(1.0,"timebomb_timer",765,"",0,"a"9999

    
ejl_vault("READ","Timebombs",""
    if(
equal(vault_value,"off")) 
        
bKamikAllow false 
    
else 
        
bKamikAllow true 

    ejl_vault
("READ","Kamikazi_FragCredit",""
    if(
equal(vault_value,"off")) 
        
bKamikCredit false 
    
else 
        
bKamikCredit true 

    ejl_vault
("READ","TFC_Kamikazi_b",""
    if(
equal(vault_value,"off")) 
        
tfc_b false 
    
else 
        
tfc_b true 

    
new mod_name[32
    
get_modname(mod_name,31
    
cstrike equal(mod_name,"cstrike") ? true false 

    ejl_vault
("WRITE","CURRENT_VOTE","NULL"
    
set_task(2.2,"set_kamik_rule"

    
register_event("ResetHUD""new_spawn""b"
    
#if use_war3 == 1 
    
gmsgDeathMsg get_user_msgid("DeathMsg"
    
register_event("DeathMsg""stop_dm""a"
    
block_message(gmsgDeathMsg
    
set_task(1.0,"regulate_plugins_dm"
    
register_cvar("amx_ejl_rpdm","0"
    
#endif 

    
return PLUGIN_CONTINUE 


public 
set_kamik_rule(){ 
    new 
ThisMap[33]
    new 
customdir[32]
    new 
file[64]

    
get_customdir(customdirsizeof(customdir))
    
get_mapname(ThisMap33)
    
format (filesizeof(file), "%s/kamikazi_config.txt"customdir)

    if (
file_exists(file) == 1){ 
        new 
line 
        
new data[128
        new 
stextsize 
        
new map[32
        new 
value[2], value2[2
        while((
line=read_file(filelinedata128stextsize))!=0){ 
            
parse(data,map,32,value,2,value2,2
            if(
equali(map,ThisMap)){ 
                if(
equal(value,"1",1)){ 
                    
bKamikAllow true 
                
}else{ 
                    
bKamikAllow false 
                

                if(
equal(value2,"1",1)){ 
                    
bomb_lock true 
                
}             
            } 
        } 
    } 
    return 
PLUGIN_HANDLED 


public 
ejl_vault(rw[],key[],value[]){ 
    new 
data[192
    new 
stxtsize 
    
new line 
    
new skip 
    
new vkey[64
    new 
vvalue[128
    new 
vaultwrite[192]
    new 
customdir[64]
    new 
file[64]

    
get_customdir(customdirsizeof(customdir))
    
format (filesizeof(file), "%s/ejl_vault.ini"customdir)

    if(
equal(rw,"READ")){ 
        if(
file_exists(file) == 1){ 
            
copy(vault_value,128,""
            while((
line=read_file(filelinedata192stxtsize))!=0){ 
                
parse(data,vkey,64,vvalue,128
                if(
equal(vkey,key)){ 
                    
copy(vault_value,128,vvalue
                } 
            } 
        }else{ 
            
write_file(file"**** Plugins use to store values -- immune to crashes and map changes ****"0
        } 
    } 
    else if(
equal(rw,"WRITE")){ 
        if(
file_exists(file) == 1){         
            
format(vaultwrite,192,"%s %s",key,value
            while((
line=read_file(filelinedata192stxtsize))!=0){ 
                
parse(data,vkey,64,vvalue,128
                if(
skip == 0){ 
                    if( (
equal(data,"")) || (equal(vkey,key)) ){ 
                        
skip 
                        write_file
(filevaultwriteline-1
                    } 
                } 
                else if(
equal(vkey,key)){ 
                    
write_file(file""line-1
                } 
            } 
            if(
skip == 0){ 
                
write_file(filevaultwrite, -1
            } 
        } 
    } 
    return 
PLUGIN_CONTINUE 

fr8899 is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:11.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode