
   /*********************************************************************
   ******
   *     amx_ejl_dice.sma        version     2.1                    Date:
   11/03/2002
   *   Eric Lidman           ejlmozart@hotmail.com
   *   Alias: Ludwig van     Upgrade:
   http://lidmanmusic.com/cs/plugins.html
   *
   *  Yes,  another  roll  the  dice  plugin with some different options.
   There are
   *  gambling  limits  and  admin controls, and default setting. Lots of
   FX.
   *  Prizes include:
   *
   *    The Wild Ride (very funny)
   *    A Lightsabre (which you can kill enemies with)
   *    Smoking Drunkard (yet another barrel of laughs)
   *    Slap Disease (possible death)
   *    Zeusmode (Godmode,Maxspeed,Noclip combined)
   *    Old Man (makes you slow)
   *    Race Car in The Red (makes you fast, very fast)
   *    Glowing (with a random chance for death)
   *    Invisible Man (invisble, maxspeed, and godmode)
   *    100 Chickens (CS, but headcrabs for other mods)
   *    250 Health
   *    Timebomb - * FX updated -- looks way cooler !!!
   *    Noclip
   *    Godmode
   *
   *  Admin Commands and CVARS:
   *
   *    amx_dice <on|off> : COMMAND: Turns dice games on or off.
   *    amx_dice_default  :  COMMAND:  sets  the current gambling mode as
   default
   *
   *    amx_dicedelay  180  :CVAR:  set  either  in admin.cfg, the server
   console,
   *                         or   by  amx_cvar  command.  Sets  the  time
   players
   *                         have to wait before gambling again.
   *
   *  Client commands:
   *
   *    say  roll the dice
   *    say  i feel lucky
   *
   *  PODBOT:  If  using  my  podbots controller, podbots use this plugin
   too.
   *
   *    Speeds increased in speed based prizes, most notably "Race Car in
   Red"
   *    Provides  its own sv_maxspeed changes to allow speed based prizes
   to
   *    to work without requiring you to config any cvars mnaually.
   *
   *    Includes a cvar for setting the gambling delay.
   *
   **********************************************************************
   ****/
   #include <amxmod>
   #include <amxmisc>
   new vault_value[128]
   new   BOMBKILL_RANGE   =  450  //  killing  radius  of  bomb.  (96  is
   playerheight)
   // Time of rewards, in seconds
   #define GODMODE_TIME 15
   #define NOCLIP_TIME 10
   #define SLOW_TIME 10
   #define GLOW_TIME 10
   #define SPEED_TIME 17
   #define SLAP_TIME 12
   #define INVISIBLE_TIME 17
   #define TIMEBOMB_TIME 15
   #define ZEUSMODE_TIME 20
   #define GRAVITY_TIME 3
   #define DRINKING_TIME 20
   #define LSABER_TIME 20
   // other prizes
   // 250 health
   // chickens (cstrike chickens -- headcrabs for other mods like tfc)
   new moves[4][] = {"+moveleft","+moveright","+back","+forward"}
   new dcounter[33]
   new moved[33]
   new heart_a[33]
   new Float:ejl_ff
   new HasPrize[33][2]
   new wasbomb[33]
   new bool:bBombCredit = true
   new bool:bGamesEnabled = true
   new bool:bIsGambling = false
   new bool:rs=false
   new Float:LastGambleTime[33]
   new Float:oldspeed[33]
   new smoke
   new white
   new fire
   new chicken
   new gmsgShake
   new saber
   new wbottle
   new c4bomb
   new fuselight
   new gibs
   new old_svspeed
   new modname[32]
   #define PRIZE_GODMODE 1
   #define PRIZE_NOCLIP 2
   #define PRIZE_ZEUSMODE 3
   #define PRIZE_SLAP 4
   #define PRIZE_SPEED 5
   #define PRIZE_TIMEBOMB 6
   #define PRIZE_INVISIBLE 7
   #define PRIZE_GLOW 8
   #define PRIZE_SLOW 9
   #define PRIZE_GRAVITY 10
   #define PRIZE_LSABER 11
   #define PRIZE_DRINKING 12
   public plugin_init(){
       register_plugin("Roll The Dice Plugin", "2.1", "EJL")
       register_concmd("amx_dice",      "admin_dice",      ADMIN_LEVEL_H,
   "<on|off>: Turns dice games on or off.")
       register_concmd("amx_dice_default","amx_dice_d",ADMIN_RCON,": sets
   the current gambling mode as default")
       register_clcmd("say", "HandleSay")
       register_cvar("amx_dicedelay","180.0")
       register_cvar("amx_luds_rollthedice","v2.0",FCVAR_SERVER )
       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&#Ga
   me_w")
       gmsgShake = get_user_msgid("ScreenShake")
       set_task(3.0,"delay_configs")
       set_task(1.0,"ejl_dice_timer",77,"",0,"a", 9999)
       register_srvcmd("botsay","handle_botsayplugin")
       return PLUGIN_CONTINUE
   }
   public delay_configs(){
       old_svspeed = get_cvar_num("sv_maxspeed")
       ejl_vault("READ","Dice","")
       if(equal(vault_value,"off")){
           bGamesEnabled = false
       }else{
           server_cmd("sv_maxspeed 1000")
           bGamesEnabled = true
       }
       return PLUGIN_CONTINUE
   }
   public plugin_precache(){
       smoke = precache_model("sprites/steam1.spr")
       white = precache_model("sprites/white.spr")
       fire = precache_model("sprites/explode1.spr")
       saber = precache_model("sprites/laserbeam.spr")
       fuselight = precache_model("sprites/glow01.spr")
       c4bomb = precache_model("models/w_weaponbox.mdl")
       gibs = precache_model("models/hgibs.mdl")
       precache_sound("ambience/zapmachine.wav")
       precache_sound("vox/_period.wav")
       get_modname(modname,32)
       if(equal(modname,"cstrike")){
           chicken = precache_model("models/chick.mdl")
       }else{
           chicken = precache_model("models/headcrab.mdl")
       }
       if(file_exists("models/winebottle.mdl")==1){
           wbottle = precache_model("models/winebottle.mdl")
       }else{
           wbottle = precache_model("models/can.mdl")
       }
       precache_sound( "buttons/blip2.wav")
       return PLUGIN_CONTINUE
   }
   public client_connect(id){
       LastGambleTime[id] = -1000.0
       wasbomb[id] = 0
       return PLUGIN_CONTINUE
   }
   public client_disconnect(id){
       LastGambleTime[id] = -1000.0
       wasbomb[id] = 0
       return PLUGIN_CONTINUE
   }
   public roundend_cleanup() {
       times_up(100)
       rs = true
       set_task(15.0,"dice_rs_delay")
   }
   public dice_rs_delay(){
       rs = false
   }
   public round_start(){
       new maxplayers = get_maxplayers()+1
       for (new a=1; a<maxplayers; a++){
           if(wasbomb[a] == 1){
               set_user_rendering(a,kRenderFxNone,255,255,255,
   kRenderNormal,16)
               wasbomb[a] = 0
           }
       }
       return PLUGIN_CONTINUE
   }
   playsoundall(ww[]){
       client_cmd(0,"play %s",ww)
   }
   public admin_dice(id,level,cid){
       if (!cmd_access(id,level,cid,1))
           return PLUGIN_HANDLED
       if (read_argc() < 2){
           new onoff[4]
           if(bGamesEnabled == true){
               copy(onoff, 4, "ON")
           }else{
               copy(onoff, 4, "OFF")
           }
           client_print(id,print_console,"[AMX]  Usage:  amx_dice  < 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)) ){
           server_cmd("sv_maxspeed 1000")
           bGamesEnabled = true
           console_print(id,"[AMX] Gambling mode is now ON")
           client_print(0,print_chat,"[AMX]  Admin  has  turned  Gambling
   mode ON")
       }else{
           server_cmd("sv_maxspeed %d",old_svspeed)
           bGamesEnabled = false
           console_print(id,"[AMX] Gambling mode is now OFF")
           client_print(0,print_chat,"[AMX]  Admin  has  turned  Gambling
   mode OFF")
       }
       new authid[16],name[32]
       get_user_authid(id,authid,16)
       get_user_name(id,name,32)
       log_to_file("addons/amx/admin.log","^"%s<%d><%s><>^"     dice_mode
   %s",name,get_user_userid(id),authid,arg)
       return PLUGIN_HANDLED
   }
   public amx_dice_d(id,level,cid){
       if (!cmd_access(id,level,cid,1))
           return PLUGIN_HANDLED
       if(bGamesEnabled == false){
           ejl_vault("WRITE","Dice","off")
           console_print(id,"[AMX]   Gambling   mode   OFF   is  now  the
   default.")
       }else{
           ejl_vault("WRITE","Dice","on")
           console_print(id,"[AMX]   Gambling   mode   ON    is  now  the
   default.")
       }
       new authid[16],name[32]
       get_user_authid(id,authid,16)
       get_user_name(id,name,32)
       log_to_file("addons/amx/admin.log","^"%s<%d><%s><>^"
   dice_mode_d",name,get_user_userid(id),authid)
       return PLUGIN_HANDLED
   }
   public handle_botsayplugin(){
       new arg0[8]
       read_argv(1,arg0,7)
       new iarg0 = strtonum(arg0)
       new sarg2[192]
       read_args(sarg2,191)
       new arg1[8]
       read_argv(2,arg1,7)
       new iarg1 = strtonum(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[]) {
       if  ( (equali(Speech, "roll the dice")) || (equali(Speech, "i feel
   lucky")) ){
           if(bGamesEnabled == false){
               client_print(id,print_chat, "[AMX] <Dice Dealer> Admin has
   disabled gambling. Bug him to re-enable it.")
               return PLUGIN_HANDLED
           }
           else if(is_user_alive(id) == 0){
               client_print(id,print_chat,  "[AMX] <Dice Dealer> Dead men
   roll no dice.")
               return PLUGIN_HANDLED
           }
           else     if    (get_gametime()    <    LastGambleTime[id]    +
   get_cvar_float("amx_dicedelay")){
               client_print(id,print_chat,   "[AMX]   <Dice  Dealer>  Try
   later. You gambled recently, give someone else a chance.")
               return PLUGIN_HANDLED
           }
           else if (bIsGambling == true){
               client_print(id,print_chat,  "[AMX] <Dice Dealer> I'm busy
   with someone else, please wait.")
               return PLUGIN_HANDLED
           }
           heart_a[id] = 0
           bIsGambling = true
           new Red = random(256)
           new Green = random(256)
           new Blue = random(256)
           new Dieone = random(6) +1
           new Dietwo = random(6) +1
           new Roll = Dieone + Dietwo
           new User[32]
           get_user_name(id,User,32)
           client_print(id,print_chat,  "[AMX]  <Dice  Dealer> You rolled
   [%d] [%d]", Dieone, Dietwo)
           if (Roll == 2){
               client_print(0,print_chat,     "[AMX]     <Dice    Dealer>
   Congratulations, %s won Godmode!", User)
               HasPrize[id][0] = PRIZE_GODMODE
               HasPrize[id][1] = GODMODE_TIME
               set_user_godmode(id,1)
               set_user_rendering(id,kRenderFxGlowShell,  Red,Green,Blue,
   kRenderNormal,16)
           }
           else if (Roll == 12){
               new rndm = random(2)
               if(rndm == 1){
                   client_print(0,print_chat,  "[AMX] <Dice Dealer> Whoa,
   %s won ZeusMode!!", User)
                   HasPrize[id][0] = PRIZE_ZEUSMODE
                   HasPrize[id][1] = ZEUSMODE_TIME
                   client_cmd(id, "cl_forwardspeed 700")
                   oldspeed[id] = get_user_maxspeed(id)
                   set_user_maxspeed(id,700.0)
                   set_user_godmode(id,1)
                   set_user_noclip(id,1)
                   set_user_rendering(id,kRenderFxGlowShell,
   Red,Green,Blue, kRenderNormal,16)
               }else{
                   client_print(0,print_chat,  "[AMX]  <Dice  Dealer> The
   force is strong with this one, %s won a lightsaber!!", User)
                   HasPrize[id][0] = PRIZE_LSABER
                   HasPrize[id][1] = LSABER_TIME
                   new tid[2]
                   tid[0] = id
                   set_user_godmode(id,1)
                   tid[1] = 1
                   set_task(0.1,"lightsaber",0,tid,2,"a",(LSABER_TIME*10)
   -10)
                   emit_sound(id,CHAN_ITEM,    "ambience/zapmachine.wav",
   1.0, ATTN_NORM, 0, PITCH_NORM)
               }
           }
           else if (Roll == 4){
               new rndm = random(2)
               if(rndm == 1){
                   client_print(0,print_chat,    "[AMX]   <Dice   Dealer>
   Congratulations, %s won Noclip!", User)
                   HasPrize[id][0] = PRIZE_NOCLIP
                   HasPrize[id][1] = NOCLIP_TIME
                   set_user_noclip(id,1)
                   set_user_rendering(id,kRenderFxGlowShell,
   Red,Green,Blue, kRenderNormal,16)
               }else{
                   client_print(0,print_chat, "[AMX] <Dice Dealer> %s won
   100 CHICKENS !!!", User)
                   set_hudmessage(200,0,0,  0.03,  0.62,  2,  0.02,  5.0,
   0.01, 0.1, 1)
                   show_hudmessage(0,"%s is throwing chickens!!!", User)
                   mod_spawn(id)
                   bIsGambling = false
               }
           }
           else if (Roll == 10){
               new rndm = random(5)
               if(rndm > 2){
                   client_print(0,print_chat,  "[AMX] <Dice Dealer> Nice,
   %s is glowing! But is glowing healthy?", User)
                   HasPrize[id][0] = PRIZE_GLOW
                   HasPrize[id][1] = random(GLOW_TIME) + 2
                   set_user_rendering(id,kRenderFxGlowShell,
   Red,Green,Blue, kRenderNormal,16)
               }else{
                   set_user_health(id,250)
                   client_print(0,print_chat,  "[AMX]  <Dice  Dealer>  %s
   won and now has 250 health!!!", User)
                   client_cmd(0, "spk ^"fvox/beep _comma beep _comma beep
   _comma administering_medical^"")
                   set_hudmessage(200,0,0,  0.03,  0.62,  2,  0.02,  5.0,
   0.01, 0.1, 1)
                   show_hudmessage(0,"%s    won    and    now   has   250
   health.",User)
                   bIsGambling = false
               }
           }
           else if (Roll == 9){
               new rndm = random(5)
               if(rndm > 2){
                   client_print(0,print_chat,  "[AMX]  <Dice  Dealer>  %s
   has contracted the deadly slap disease!", User)
                   HasPrize[id][0] = PRIZE_SLAP
                   HasPrize[id][1] = random(SLAP_TIME) + 2
                   user_slap(id,5)
                   set_user_rendering(id,kRenderFxGlowShell,
   Red,Green,Blue, kRenderNormal,16)
               }else{
                   client_print(0,print_chat, "[AMX] <Dice Dealer> %s won
   100 CHICKENS !!!", User)
                   set_hudmessage(200,0,0,  0.03,  0.62,  2,  0.02,  5.0,
   0.01, 0.1, 1)
                   show_hudmessage(0,"%s is throwing chickens!!!", User)
                   mod_spawn(id)
                   bIsGambling = false
               }
           }
           else if (Roll == 11){
               client_print(0,print_chat,  "[AMX] <Dice Dealer> The force
   is strong with this one, %s won a lightsaber!!", User)
               HasPrize[id][0] = PRIZE_LSABER
               HasPrize[id][1] = LSABER_TIME
               new tid[2]
               tid[0] = id
               set_user_godmode(id,1)
               tid[1] = 1
               set_task(0.1,"lightsaber",0,tid,2,"a",(LSABER_TIME*10)-10)
               emit_sound(id,CHAN_ITEM,  "ambience/zapmachine.wav",  1.0,
   ATTN_NORM, 0, PITCH_NORM)
           }
           else if (Roll == 5){
               new rndm = random(5)
               if(rndm > 3){
                   client_print(0,print_chat,  "[AMX]  <Dice  Dealer>  %s
   has won turbo mode!", User)
                   HasPrize[id][0] = PRIZE_SPEED
                   HasPrize[id][1] = SPEED_TIME
                   client_cmd(id, "cl_forwardspeed 1000")
                   oldspeed[id] = get_user_maxspeed(id)
                   set_user_maxspeed(id,1000.0)
                   set_user_rendering(id,kRenderFxGlowShell,
   Red,Green,Blue, kRenderNormal,16)
               }else{
                   client_print(0,print_chat, "[AMX] <Dice Dealer>  %s is
   going for a wild ride!", User)
                   HasPrize[id][0] = PRIZE_GRAVITY
                   HasPrize[id][1] = GRAVITY_TIME
                   set_user_rendering(id,kRenderFxGlowShell,
   Red,Green,Blue, kRenderNormal,16)
                   set_user_gravity(id,-50.0)
               }
           }
           else if (Roll == 6){
               client_print(0,print_chat,  "[AMX] <Dice Dealer> Oh no, %s
   is an old man now.", User)
               HasPrize[id][0] = PRIZE_SLOW
               HasPrize[id][1] = SLOW_TIME
               oldspeed[id] = get_user_maxspeed(id)
               set_user_maxspeed(id,72.0)
               set_user_rendering(id,kRenderFxGlowShell,  Red,Green,Blue,
   kRenderNormal,16)
           }
           else if (Roll == 8){
               client_print(0,print_chat, "[AMX] <Dice Dealer>  %s is the
   invisible man now!", User)
               HasPrize[id][0] = PRIZE_INVISIBLE
               HasPrize[id][1] = INVISIBLE_TIME
               client_cmd(id, "cl_forwardspeed 500")
               oldspeed[id] = get_user_maxspeed(id)
               set_user_maxspeed(id,500.0)
               set_user_godmode(id,1)
               set_user_rendering(id,kRenderFxNone,                0,0,0,
   kRenderTransAdd,5)
           }
           else if (Roll == 3){
               client_print(0,print_chat,  "[AMX]  <Dice  Dealer>  %s  is
   going for a wild ride!", User)
               HasPrize[id][0] = PRIZE_GRAVITY
               HasPrize[id][1] = GRAVITY_TIME
               set_user_rendering(id,kRenderFxGlowShell,  Red,Green,Blue,
   kRenderNormal,16)
               set_user_gravity(id,-50.0)
           }
           else if (Roll == 7){
               new rndm = random(5)
               if(rndm > 2){
                   client_print(0,print_chat, "[AMX] <Dice Dealer>  %s is
   now a human time-bomb!  Everyone RUN for cover", User)
                   HasPrize[id][0] = PRIZE_TIMEBOMB
                   HasPrize[id][1] = TIMEBOMB_TIME
                   client_cmd(0,  "spk ^"warning _comma detonation device
   activated^"")
                   player_attachment(id)
               }else{
                   client_print(0,print_chat, "[AMX] <Dice Dealer>  %s is
   now a smoking drunkard!", User)
                   HasPrize[id][0] = PRIZE_DRINKING
                   HasPrize[id][1] = DRINKING_TIME
                   new tid[1]
                   tid[0] = id
                   dcounter[id] = 0
                   set_task(0.5,"smokin_1",0,tid,1,"a",DRINKING_TIME*2)
                   set_user_rendering(id,kRenderFxGlowShell,
   Red,Green,Blue, kRenderNormal,16)
               }
           }
           LastGambleTime[id] = get_gametime()
           return PLUGIN_CONTINUE
       }
       return PLUGIN_CONTINUE
   }
   public ejl_dice_timer(){
       if(bIsGambling == false){
           return PLUGIN_CONTINUE
       }
       new Red = random(256)
       new Green = random(256)
       new Blue = random(256)
       new Float:gt = get_gametime()
       new maxpl = get_maxplayers() +1
       new a
       for(a=1; a < maxpl; a++) {
           if  (  (HasPrize[a][0] > 0) && ((LastGambleTime[a] + 60) < gt)
   ){
               HasPrize[a][0] = 0
               HasPrize[a][1] = 0
               bIsGambling = false
           }
       }
       for(a=1; a < maxpl; a++) {
           if (HasPrize[a][0] > 0){
               if(HasPrize[a][0] == PRIZE_TIMEBOMB){
                   emit_sound(a,CHAN_ITEM,    "buttons/blip2.wav",   1.0,
   ATTN_NORM, 0, PITCH_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 (HasPrize[a][1] == 1){
                       times_up(a)
                   }else{
                       HasPrize[a][1] -= 1
                       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,0,  0.03,  0.62, 2, 0.02,
   2.0, 0.01, 0.1, 1)
                       }else{
                           set_hudmessage(0,100,200, 0.03, 0.62, 2, 0.02,
   2.0, 0.01, 0.1, 1)
                       }
                       show_hudmessage(0,"%s    will    explode   in   %d
   seconds.",name,HasPrize[a][1])
                       if (HasPrize[a][1] == 11){
                           client_cmd(0,"spk ^"fvox/remaining^"")
                       }
                       if (HasPrize[a][1] < 11){
                           new temp[48]
                           num_to_word(HasPrize[a][1],temp,48)
                           client_cmd(0,"spk ^"fvox/%s^"",temp)
                       }
                   }
                   if(is_user_alive(a) == 0){
                       times_up(a)
                   }
               }
               else if(HasPrize[a][0] == PRIZE_SLAP){
                   if (HasPrize[a][1] == 1){
                       times_up(a)
                   }else{
                       HasPrize[a][1] -= 1
                       user_slap(a,5)
                       new name[32]
                       get_user_name(a,name,32)
                       set_user_rendering(a,kRenderFxGlowShell,
   Red,Green,Blue, kRenderNormal,16)
                       set_hudmessage(Red,Green,Blue,   0.03,   0.62,  2,
   0.02, 2.0, 0.01, 0.1, 1)
                       show_hudmessage(0,"%s  has  slap  disease  for  %d
   seconds.",name,HasPrize[a][1])
                   }
                   if(is_user_alive(a) == 0){
                       times_up(a)
                   }
               }
               else if(HasPrize[a][0] == PRIZE_GLOW){
                   if (HasPrize[a][1] == 1){
                       times_up(a)
                   }else{
                       HasPrize[a][1] -= 1
                       new name[32]
                       get_user_name(a,name,32)
                       set_user_rendering(a,kRenderFxGlowShell,
   Red,Green,Blue, kRenderNormal,16)
                       set_hudmessage(Red,Green,Blue,   0.03,   0.62,  2,
   0.02, 2.0, 0.01, 0.1, 1)
                       show_hudmessage(0,"%s    is    glowing    for   %d
   seconds.",name,HasPrize[a][1])
                   }
                   if(is_user_alive(a) == 0){
                       times_up(a)
                   }
               }
               else if(HasPrize[a][0] == PRIZE_SLOW){
                   if (HasPrize[a][1] == 1){
                       times_up(a)
                   }else{
                       HasPrize[a][1] -= 1
                       new name[32]
                       get_user_name(a,name,32)
                       if(get_user_maxspeed(a) > 80)
                           heart_a[a] +=1
                       if(heart_a[a] > 2)
                           HasPrize[a][1] = 1
                       set_user_maxspeed(a,72.0)
                       set_user_rendering(a,kRenderFxGlowShell,
   Red,Green,Blue, kRenderNormal,16)
                       set_hudmessage(Red,Green,Blue,   0.03,   0.62,  2,
   0.02, 2.0, 0.01, 0.1, 1)
                       show_hudmessage(0,"%s   is   an  old  man  for  %d
   seconds.",name,HasPrize[a][1])
                   }
                   if(is_user_alive(a) == 0){
                       times_up(a)
                   }
               }
               else if(HasPrize[a][0] == PRIZE_SPEED){
                   if (HasPrize[a][1] == 1){
                       times_up(a)
                   }else{
                       HasPrize[a][1] -= 1
                       new name[32]
                       get_user_name(a,name,32)
                       set_user_maxspeed(a,1000.0)
                       set_user_rendering(a,kRenderFxGlowShell,
   Red,Green,Blue, kRenderNormal,16)
                       set_hudmessage(Red,Green,Blue,   0.03,   0.62,  2,
   0.02, 2.0, 0.01, 0.1, 1)
                       show_hudmessage(0,"%s is a race car in the red for
   %d seconds.",name,HasPrize[a][1])
                   }
                   if(is_user_alive(a) == 0){
                       times_up(a)
                   }
               }
               else if(HasPrize[a][0] == PRIZE_INVISIBLE){
                   if (HasPrize[a][1] == 1){
                       times_up(a)
                   }else{
                       HasPrize[a][1] -= 1
                       new name[32]
                       get_user_name(a,name,32)
                       set_user_maxspeed(a,500.0)
                       set_hudmessage(Red,Green,Blue,   0.03,   0.62,  2,
   0.02, 2.0, 0.01, 0.1, 1)
                       show_hudmessage(0,"%s    is   invisible   for   %d
   seconds.",name,HasPrize[a][1])
                   }
                   if(is_user_alive(a) == 0){
                       times_up(a)
                   }
               }
               else if(HasPrize[a][0] == PRIZE_GODMODE){
                   if (HasPrize[a][1] == 1){
                       times_up(a)
                   }else{
                       HasPrize[a][1] -= 1
                       new name[32]
                       get_user_name(a,name,32)
                       set_user_rendering(a,kRenderFxGlowShell,
   Red,Green,Blue, kRenderNormal,16)
                       set_hudmessage(Red,Green,Blue,   0.03,   0.62,  2,
   0.02, 2.0, 0.01, 0.1, 1)
                       show_hudmessage(0,"%s    has    godmode   for   %d
   seconds.",name,HasPrize[a][1])
                   }
                   if(is_user_alive(a) == 0){
                       times_up(a)
                   }
               }
               else if(HasPrize[a][0] == PRIZE_NOCLIP){
                   if (HasPrize[a][1] == 1){
                       times_up(a)
                   }else{
                       HasPrize[a][1] -= 1
                       new name[32]
                       get_user_name(a,name,32)
                       set_user_rendering(a,kRenderFxGlowShell,
   Red,Green,Blue, kRenderNormal,16)
                       set_hudmessage(Red,Green,Blue,   0.03,   0.62,  2,
   0.02, 2.0, 0.01, 0.1, 1)
                       show_hudmessage(0,"%s    has    noclip    for   %d
   seconds.",name,HasPrize[a][1])
                   }
                   if(is_user_alive(a) == 0){
                       times_up(a)
                   }
               }
               else if(HasPrize[a][0] == PRIZE_ZEUSMODE){
                   if (HasPrize[a][1] == 1){
                       times_up(a)
                   }else{
                       HasPrize[a][1] -= 1
                       new name[32]
                       get_user_name(a,name,32)
                       set_user_maxspeed(a,700.0)
                       set_user_rendering(a,kRenderFxGlowShell,
   Red,Green,Blue, kRenderNormal,16)
                       set_hudmessage(Red,Green,Blue,   0.03,   0.62,  2,
   0.02, 2.0, 0.01, 0.1, 1)
                       show_hudmessage(0,"%s    has   ZUESMODE   for   %d
   seconds.",name,HasPrize[a][1])
                   }
                   if(is_user_alive(a) == 0){
                       times_up(a)
                   }
               }
               else if(HasPrize[a][0] == PRIZE_GRAVITY){
                   if (HasPrize[a][1] == 1){
                       times_up(a)
                   }else{
                       new name[32]
                       get_user_name(a,name,32)
                       set_user_rendering(a,kRenderFxGlowShell,
   Red,Green,Blue, kRenderNormal,16)
                       set_hudmessage(Red,Green,Blue,   0.03,   0.62,  2,
   0.02, 2.0, 0.01, 0.1, 1)
                       HasPrize[a][1] -= 1
                       if (HasPrize[a][1] == 1){
                           playsoundall("ambience/fallscream.wav")
                           set_user_gravity(a,30.0)
                           show_hudmessage(0,"%s         is         being
   dropped.",name)
                       }else{
                           if (HasPrize[a][1] == GRAVITY_TIME -1) {
                               client_cmd(a,"+jump")
                           }
                           set_user_gravity(a,-50.0)
                           show_hudmessage(0,"%s  will  be  dropped in %d
   seconds.",name,HasPrize[a][1])
                       }
                   }
                   if(is_user_alive(a) == 0){
                       times_up(a)
                   }
               }
               else if(HasPrize[a][0] == PRIZE_LSABER){
                   if (HasPrize[a][1] == 1){
                       times_up(a)
                   }else{
                       HasPrize[a][1] -= 1
                       new name[32]
                       get_user_name(a,name,32)
                       set_hudmessage(Red,Green,Blue,   0.03,   0.62,  2,
   0.02, 2.0, 0.01, 0.1, 1)
                       show_hudmessage(0,"%s  is  a  Jedi  Knight  for %d
   seconds.",name,HasPrize[a][1])
                   }
                   if(is_user_alive(a) == 0){
                       times_up(a)
                   }
               }
               else if(HasPrize[a][0] == PRIZE_DRINKING){
                   if (HasPrize[a][1] == 1){
                       times_up(a)
                   }else{
                       HasPrize[a][1] -= 1
                       new name[32]
                       get_user_name(a,name,32)
                       set_user_rendering(a,kRenderFxGlowShell,
   Red,Green,Blue, kRenderNormal,16)
                       set_hudmessage(Red,Green,Blue,   0.03,   0.62,  2,
   0.02, 2.0, 0.01, 0.1, 1)
                       show_hudmessage(0,"%s is a smoking drunkard for %d
   seconds.",name,HasPrize[a][1])
                   }
                   if(is_user_alive(a) == 0){
                       times_up(a)
                   }
               }
           }
       }
       return PLUGIN_CONTINUE
   }
   public times_up(id){
       bIsGambling = false
       new bombguyfrags
       new bgf_message = 0
       new maxpl = get_maxplayers() +1
       new t
       new players[32], inum
       for(t=1; t < maxpl; t++) {
           if (HasPrize[t][0] > 0){
               if(HasPrize[t][0] == PRIZE_TIMEBOMB){
                   if(id == 100){
                       for(new a = 1; a < maxpl; a++) {
                           if (HasPrize[a][1] > 0){
                               HasPrize[a][0] = 0
                               HasPrize[a][1] = 0
                               new name[32]
                               get_user_name(a,name,32)
                               set_hudmessage(200,255,200, 0.03, 0.62, 2,
   0.02, 2.0, 0.01, 0.1, 1)
                               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)
                               get_players(players,inum,"c")
                               for(new i = 0 ;i < inum; ++i){
                                   message_begin(MSG_ONE,gmsgShake,{0,0,0
   },players[i])
                                   write_short( 1<<14 )// shake amount
                                   write_short(  1<<14  )//  shake  lasts
   this long
                                   write_short(  1<<14  )//  shake  noise
   frequency
                                   message_end()
                               }
                               //define TE_EXPLODEMODEL
                               message_begin(MSG_BROADCAST,SVC_TEMPENTITY
   ,{0,0,0},a)
                               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[a] = 1
                               set_user_rendering(a,kRenderFxNone, 0,0,0,
   kRenderTransAdd,0)
                           }
                       }
                   }else{
                       if (HasPrize[id][1] > 0){
                           new name[32]
                           new team[32]
                           get_user_name(id,name,32)
                           set_hudmessage(200,255,200,   0.03,  0.62,  2,
   0.02, 2.0, 0.01, 0.1, 1)
                           show_hudmessage(0,"%s has exploded.",name)
                           ejl_ff = get_cvar_float("mp_friendlyfire")
                               new origin[3]
                            get_user_origin(id,origin)
                           get_user_team(id, team , 32);
                           for(new a = 1; a < maxpl; a++) {
                               new origin1[3]
                               new team1[32]
                               get_user_origin(a,origin1)
                               get_user_team(a, team1 , 32)
                               if(is_user_alive(a) != 0){
                                   if(    !    (origin[0]-origin1[0]    >
   BOMBKILL_RANGE || origin[0]-origin1[0] < - BOMBKILL_RANGE ||
                                              origin[1]-origin1[1]      >
   BOMBKILL_RANGE || origin[1]-origin1[1] < - BOMBKILL_RANGE ||
                                              origin[2]-origin1[2]      >
   BOMBKILL_RANGE || origin[2]-origin1[2] < - BOMBKILL_RANGE) ){
                                       if(ejl_ff == 0){
                                           if(!equal(team, team1, 1)){
                                               client_print(a,print_chat,
   "[AMX] :  Sorry, the bomb killed you.")
                                               if((a     !=     id)    &&
   (bBombCredit == true)){
                                                   bombguyfrags         =
   get_user_frags(id)
                                                   bombguyfrags +=1
                                                   bgf_message +=1
                                                   set_user_frags(id,bomb
   guyfrags)
                                               }
                                               user_kill(a,1)
                                               explode(origin1,a)
                                           }
                                       }
                                       if(ejl_ff == 1){
                                           if(rs == false){
                                               client_print(a,print_chat,
   "[AMX] :  Sorry, the bomb killed
   you.")
                                               if((!equal(team,    team1,
   1)) && (bBombCredit == true) ){
                                                   bombguyfrags         =
   get_user_frags(id)
                                                   bombguyfrags +=1
                                                   bgf_message +=1
                                                   set_user_frags(id,bomb
   guyfrags)
                                               }
                                               if(a != id){
                                                   explode(origin1,a)
                                               }
                                               user_kill(a,1)
                                           }else{
                                               client_print(a,print_chat,
   "[AMX] :  Sorry, the bomb killed you.")
                                               if(a == id){
                                                   user_kill(a,1)
                                               }
                                           }
                                       }
                                   }
                               }
                           }
                           HasPrize[id][0] = 0
                           HasPrize[id][1] = 0
                           if(ejl_ff == 0){
                               client_print(id,print_chat,"[AMX]
   :  Sorry, the bomb killed you.")
                               user_kill(id,1)
                           }
                           if((bBombCredit  ==  true)  &&  (bgf_message >
   0)){
                               client_print(id,print_chat,"[AMX]  :  Your
   bombing was a success:  You made %d KILLS.", bgf_message)
                           }
                            origin[2] = origin[2] - 26
                           explode(origin,id)
                           get_players(players,inum,"c")
                           for(new i = 0 ;i < inum; ++i){
                               message_begin(MSG_ONE,gmsgShake,{0,0,0},pl
   ayers[i])
                               write_short( 1<<14 )// shake amount
                               write_short(  1<<14  )//  shake lasts this
   long
                               write_short(   1<<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,kRenderFxNone,    0,0,0,
   kRenderTransAdd,0)
                       }
                   }
               }
               else if(HasPrize[t][0] == PRIZE_SLAP){
                   if(id == 100){
                       for(new a = 1; a < maxpl; a++) {
                           if (HasPrize[a][1] > 0){
                               HasPrize[a][0] = 0
                               HasPrize[a][1] = 0
                               set_user_rendering(a,kRenderFxNone,255,255
   ,255, kRenderNormal,16)
                           }
                       }
                   }else{
                       if (HasPrize[id][1] > 0){
                           new name[32]
                           get_user_name(id,name,32)
                           set_user_rendering(id,kRenderFxNone,255,255,25
   5, kRenderNormal,16)
                           set_hudmessage(200,255,200,   0.03,  0.62,  2,
   0.02, 2.0, 0.01, 0.1, 1)
                           new rand = random(4)
                               new origin[3]
                            get_user_origin(id,origin)
                           if(rand > 0){
                               show_hudmessage(0,  "Slap disease has left
   %s.",name)
                           }else{
                               show_hudmessage(0,   "Slap   disease   has
   killed %s",name)
                               user_kill(id,1)
                                origin[2] = origin[2] - 26
                               explode(origin,id)
                               get_players(players,inum,"c")
                               for(new i = 0 ;i < inum; ++i){
                                   message_begin(MSG_ONE,gmsgShake,{0,0,0
   },players[i])
                                   write_short( 1<<14 )// shake amount
                                   write_short(  1<<14  )//  shake  lasts
   this long
                                   write_short(  1<<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] +26)
                               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,kRenderFxNone,
   0,0,0, kRenderTransAdd,0)
                           }
                           HasPrize[id][0] = 0
                           HasPrize[id][1] = 0
                       }
                   }
               }
               else if(HasPrize[t][0] == PRIZE_GLOW){
                   if(id == 100){
                       for(new a = 1; a < maxpl; a++) {
                           if (HasPrize[a][1] > 0){
                               HasPrize[a][0] = 0
                               HasPrize[a][1] = 0
                               set_user_rendering(a,kRenderFxNone,255,255
   ,255, kRenderNormal,16)
                           }
                       }
                   }else{
                       if (HasPrize[id][1] > 0){
                           new name[32]
                           get_user_name(id,name,32)
                           set_user_rendering(id,kRenderFxNone,255,255,25
   5, kRenderNormal,16)
                           set_hudmessage(200,255,200,   0.03,  0.62,  2,
   0.02, 2.0, 0.01, 0.1, 1)
                           new rand = random(3)
                               new origin[3]
                            get_user_origin(id,origin)
                           if(rand > 0){
                               show_hudmessage(0,  "%s has safely stopped
   glowing.",name)
                           }else{
                               show_hudmessage(0,   "Glowing  has  killed
   %s",name)
                               user_kill(id,1)
                                origin[2] = origin[2] - 26
                               explode(origin,id)
                               get_players(players,inum,"c")
                               for(new i = 0 ;i < inum; ++i){
                                   message_begin(MSG_ONE,gmsgShake,{0,0,0
   },players[i])
                                   write_short( 1<<14 )// shake amount
                                   write_short(  1<<14  )//  shake  lasts
   this long
                                   write_short(  1<<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] + 26)
                               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,kRenderFxNone,
   0,0,0, kRenderTransAdd,0)
                           }
                           HasPrize[id][0] = 0
                           HasPrize[id][1] = 0
                       }
                   }
               }
               else if(HasPrize[t][0] == PRIZE_SLOW){
                   if(id == 100){
                       for(new a = 1; a < maxpl; a++) {
                           if (HasPrize[a][1] > 0){
                               HasPrize[a][0] = 0
                               HasPrize[a][1] = 0
                               set_user_maxspeed(a,oldspeed[a])
                               set_user_rendering(a,kRenderFxNone,255,255
   ,255, kRenderNormal,16)
                           }
                       }
                   }else{
                       if (HasPrize[id][1] > 0){
                           new name[32]
                           get_user_name(id,name,32)
                           set_user_maxspeed(id,oldspeed[id])
                           set_user_rendering(id,kRenderFxNone,255,255,25
   5, kRenderNormal,16)
                           set_hudmessage(200,255,200,   0.03,  0.62,  2,
   0.02, 2.0, 0.01, 0.1, 1)
                           if(heart_a[id] > 2){
                               user_kill(id,1)
                               show_hudmessage(0, "%s was old and died of
   a heart attack.",name)
                           }else{
                               show_hudmessage(0, "%s is no longer an old
   man.",name)
                           }
                           heart_a[id] = 0
                           HasPrize[id][0] = 0
                           HasPrize[id][1] = 0
                       }
                   }
               }
               else if(HasPrize[t][0] == PRIZE_SPEED){
                   if(id == 100){
                       for(new a = 1; a < maxpl; a++) {
                           if (HasPrize[a][1] > 0){
                               HasPrize[a][0] = 0
                               HasPrize[a][1] = 0
                               client_cmd(a, "cl_forwardspeed 400")
                               set_user_maxspeed(a,oldspeed[a])
                               set_user_rendering(a,kRenderFxNone,255,255
   ,255, kRenderNormal,16)
                           }
                       }
                   }else{
                       if (HasPrize[id][1] > 0){
                           new name[32]
                           get_user_name(id,name,32)
                           client_cmd(id, "cl_forwardspeed 400")
                           set_user_maxspeed(id,oldspeed[id])
                           set_user_rendering(id,kRenderFxNone,255,255,25
   5, kRenderNormal,16)
                           set_hudmessage(200,255,200,   0.03,  0.62,  2,
   0.02, 2.0, 0.01, 0.1, 1)
                           show_hudmessage(0, "%s is out of gas.",name)
                           HasPrize[id][0] = 0
                           HasPrize[id][1] = 0
                       }
                   }
               }
               else if(HasPrize[t][0] == PRIZE_INVISIBLE){
                   if(id == 100){
                       for(new a = 1; a < maxpl; a++) {
                           if (HasPrize[a][1] > 0){
                               HasPrize[a][0] = 0
                               HasPrize[a][1] = 0
                               client_cmd(a, "cl_forwardspeed 400")
                               set_user_maxspeed(a,oldspeed[a])
                               set_user_godmode(a,0)
                               set_user_rendering(a,kRenderFxNone,255,255
   ,255, kRenderNormal,16)
                           }
                       }
                   }else{
                       if (HasPrize[id][1] > 0){
                           new name[32]
                           get_user_name(id,name,32)
                           client_cmd(id, "cl_forwardspeed 400")
                           set_user_maxspeed(id,oldspeed[id])
                           set_user_godmode(id,0)
                           set_user_rendering(id,kRenderFxNone,255,255,25
   5, kRenderNormal,16)
                           set_hudmessage(200,255,200,   0.03,  0.62,  2,
   0.02, 2.0, 0.01, 0.1, 1)
                           show_hudmessage(0,    "%s    is    no   longer
   invisible.",name)
                           HasPrize[id][0] = 0
                           HasPrize[id][1] = 0
                       }
                   }
               }
               else if(HasPrize[t][0] == PRIZE_GODMODE){
                   if(id == 100){
                       for(new a = 1; a < maxpl; a++) {
                           if (HasPrize[a][1] > 0){
                               HasPrize[a][0] = 0
                               HasPrize[a][1] = 0
                               set_user_godmode(a,0)
                               set_user_rendering(a,kRenderFxNone,255,255
   ,255, kRenderNormal,16)
                           }
                       }
                   }else{
                       if (HasPrize[id][1] > 0){
                           new name[32]
                           get_user_name(id,name,32)
                           set_user_godmode(id,0)
                           set_user_rendering(id,kRenderFxNone,255,255,25
   5, kRenderNormal,16)
                           set_hudmessage(200,255,200,   0.03,  0.62,  2,
   0.02, 2.0, 0.01, 0.1, 1)
                           show_hudmessage(0,    "%s    no   longer   has
   godmode.",name)
                           HasPrize[id][0] = 0
                           HasPrize[id][1] = 0
                       }
                   }
               }
               else if(HasPrize[t][0] == PRIZE_NOCLIP){
                   if(id == 100){
                       for(new a = 1; a < maxpl; a++) {
                           if (HasPrize[a][1] > 0){
                               HasPrize[a][0] = 0
                               HasPrize[a][1] = 0
                               set_user_noclip(a,0)
                               set_user_rendering(a,kRenderFxNone,255,255
   ,255, kRenderNormal,16)
                           }
                       }
                   }else{
                       if (HasPrize[id][1] > 0){
                           new name[32]
                           get_user_name(id,name,32)
                           set_user_noclip(id,0)
                           set_user_rendering(id,kRenderFxNone,255,255,25
   5, kRenderNormal,16)
                           set_hudmessage(200,255,200,   0.03,  0.62,  2,
   0.02, 2.0, 0.01, 0.1, 1)
                           show_hudmessage(0,    "%s    no   longer   has
   noclip.",name)
                           HasPrize[id][0] = 0
                           HasPrize[id][1] = 0
                       }
                   }
               }
               else if(HasPrize[t][0] == PRIZE_ZEUSMODE){
                   if(id == 100){
                       for(new a = 1; a < maxpl; a++) {
                           if (HasPrize[a][1] > 0){
                               HasPrize[a][0] = 0
                               HasPrize[a][1] = 0
                               client_cmd(a, "cl_forwardspeed 400")
                               set_user_godmode(a,0)
                               set_user_noclip(a,0)
                               set_user_maxspeed(a,oldspeed[a])
                               set_user_rendering(a,kRenderFxNone,255,255
   ,255, kRenderNormal,16)
                           }
                       }
                   }else{
                       if (HasPrize[id][1] > 0){
                           new name[32]
                           get_user_name(id,name,32)
                           set_user_godmode(id,0)
                           set_user_noclip(id,0)
                           client_cmd(id, "cl_forwardspeed 400")
                           set_user_maxspeed(id,oldspeed[id])
                           set_user_rendering(id,kRenderFxNone,255,255,25
   5, kRenderNormal,16)
                           set_hudmessage(200,255,200,   0.03,  0.62,  2,
   0.02, 2.0, 0.01, 0.1, 1)
                           show_hudmessage(0,    "%s    no   longer   has
   ZEUSMODE.",name)
                           HasPrize[id][0] = 0
                           HasPrize[id][1] = 0
                       }
                   }
               }
               else if(HasPrize[t][0] == PRIZE_GRAVITY){
                   if(id == 100){
                       for(new a = 1; a < maxpl; a++) {
                           if (HasPrize[a][1] > 0){
                               client_cmd(a,"-jump")
                               HasPrize[a][0] = 0
                               HasPrize[a][1] = 0
                               set_user_gravity(a,1.0)
                               set_user_rendering(a,kRenderFxNone,255,255
   ,255, kRenderNormal,16)
                                   new origin[3]
                                get_user_origin(a,origin)
                                origin[2] = origin[2] - 26
                               explode(origin,id)
                               get_players(players,inum,"c")
                               for(new i = 0 ;i < inum; ++i){
                                   message_begin(MSG_ONE,gmsgShake,{0,0,0
   },players[i])
                                   write_short( 1<<14 )// shake amount
                                   write_short(  1<<14  )//  shake  lasts
   this long
                                   write_short(  1<<14  )//  shake  noise
   frequency
                                   message_end()
                               }
                               //define TE_EXPLODEMODEL
                               message_begin(MSG_BROADCAST,SVC_TEMPENTITY
   ,{0,0,0},a)
                               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[a] = 1
                               set_user_rendering(a,kRenderFxNone, 0,0,0,
   kRenderTransAdd,0)
                           }
                       }
                   }else{
                       if (HasPrize[id][1] > 0){
                           new name[32]
                           get_user_name(id,name,32)
                           client_cmd(id,"-jump")
                           set_user_gravity(id,1.0)
                           set_user_rendering(id,kRenderFxNone,255,255,25
   5, kRenderNormal,16)
                           set_hudmessage(200,255,200,   0.03,  0.62,  2,
   0.02, 2.0, 0.01, 0.1, 1)
                           show_hudmessage(0,  "%s  died  of  a  terrible
   fall.",name)
                           user_kill(id,1)
                               new origin[3]
                            get_user_origin(id,origin)
                            origin[2] = origin[2] - 26
                           explode(origin,id)
                           get_players(players,inum,"c")
                           for(new i = 0 ;i < inum; ++i){
                               message_begin(MSG_ONE,gmsgShake,{0,0,0},pl
   ayers[i])
                               write_short( 1<<14 )// shake amount
                               write_short(  1<<14  )//  shake lasts this
   long
                               write_short(   1<<14   )//   shake   noise
   frequency
                               message_end()
                           }
                           HasPrize[id][0] = 0
                           HasPrize[id][1] = 0
                           //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,kRenderFxNone,    0,0,0,
   kRenderTransAdd,0)
                       }
                   }
               }
               else if(HasPrize[t][0] == PRIZE_LSABER){
                   if(id == 100){
                       for(new a = 1; a < maxpl; a++) {
                           if (HasPrize[a][1] > 0){
                               HasPrize[a][0] = 0
                               HasPrize[a][1] = 0
                           }
                       }
                   }else{
                       if (HasPrize[id][1] > 0){
                           new name[32]
                           get_user_name(id,name,32)
                           set_user_godmode(id,0)
                           emit_sound(id,CHAN_ITEM,    "vox/_period.wav",
   1.0, ATTN_NORM, 0, PITCH_NORM)
                           set_hudmessage(200,255,200,   0.03,  0.62,  2,
   0.02, 2.0, 0.01, 0.1, 1)
                           show_hudmessage(0,   "%s  has  lost  his  Jedi
   powers.",name)
                           HasPrize[id][0] = 0
                           HasPrize[id][1] = 0
                       }
                   }
               }
               else if(HasPrize[t][0] == PRIZE_DRINKING){
                   if(id == 100){
                       for(new a = 1; a < maxpl; a++) {
                           if (HasPrize[a][1] > 0){
                               HasPrize[a][0] = 0
                               HasPrize[a][1] = 0
                               set_user_rendering(a,kRenderFxNone,255,255
   ,255, kRenderNormal,16)
                           }
                       }
                   }else{
                       if (HasPrize[id][1] > 0){
                           new name[32]
                           get_user_name(id,name,32)
                           set_user_godmode(id,0)
                           set_user_rendering(id,kRenderFxNone,255,255,25
   5, kRenderNormal,16)
                           set_hudmessage(200,255,200,   0.03,  0.62,  2,
   0.02, 2.0, 0.01, 0.1, 1)
                           show_hudmessage(0,  "%s  sobered up and kicked
   his dirty habit.",name)
                           HasPrize[id][0] = 0
                           HasPrize[id][1] = 0
                       }
                   }
               }
           }
       }
       return PLUGIN_CONTINUE
   }
   explode(vec1[3],id){
      // blast circles
      message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1)
      write_byte( 21 )
      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_short( white )
      write_byte( 0 ) // startframe
      write_byte( 0 ) // framerate
      write_byte( 3 ) // life 2
      write_byte( 20 ) // width 16
      write_byte( 0 ) // noise
      write_byte( 188 ) // r
      write_byte( 220 ) // g
      write_byte( 255 ) // b
      write_byte( 255 ) //brightness
      write_byte( 0 ) // speed
      message_end()

      //Explosion2
      message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
      write_byte( 12 )
      write_coord(vec1[0])
      write_coord(vec1[1])
      write_coord(vec1[2])
      write_byte( 188 ) // byte (scale in 0.1's) 188
      write_byte( 10 ) // byte (framerate)
      message_end()
      //TE_Explosion
      message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1)
      write_byte( 3 )
      write_coord(vec1[0])
      write_coord(vec1[1])
      write_coord(vec1[2])
      write_short( fire )
      write_byte( 65 ) // byte (scale in 0.1's) 188
      write_byte( 10 ) // byte (framerate)
      write_byte( 0 ) // byte flags
      message_end()
      //TE_KILLPLAYERATTACHMENTS
      message_begin(MSG_BROADCAST,SVC_TEMPENTITY,{0,0,0},id)
      write_byte( 125 ) // will expire all TENTS attached to a player.
      write_byte( id ) // byte (entity index of player)
      message_end()
      //Smoke
      message_begin( MSG_BROADCAST,SVC_TEMPENTITY,vec1)
      write_byte( 5 ) // 5
      write_coord(vec1[0])
      write_coord(vec1[1])
      write_coord(vec1[2])
      write_short( smoke )
      write_byte( 50 )  // 2
      write_byte( 10 )  // 10
      message_end()
   }
   player_attachment(id){
       new att_life = (TIMEBOMB_TIME * 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  (  7  )  // ( attachment origin.z = player origin.z +
   vertical offset )
       write_short ( c4bomb ) // model index
       write_short ( att_life )     // (life * 10 )
       message_end()
   }
   // chickengun
   public mod_spawn(id){
       new csid[1]
       csid[0] = id
       set_task(0.3,"make_mod",1316,csid,1,"a",100)
       return PLUGIN_HANDLED
   }
   public sqrt(num) {
       new div = num
       new result = 1
       while (div > result) { // end when div == result, or just below
           div = (div + result) / 2 // take mean value as new divisor
           result = num / div
       }
       return div
   }
   public make_mod(id[]){
       new vec[3]
       new aimvec[3]
       new velocityvec[3]
       new length
       new speed = 800
       get_user_origin(id[0],vec)
       get_user_origin(id[0],aimvec,2)
       velocityvec[0]=aimvec[0]-vec[0]
       velocityvec[1]=aimvec[1]-vec[1]
       velocityvec[2]=aimvec[2]-vec[2]
       length=sqrt(velocityvec[0]*velocityvec[0]+velocityvec[1]*velocityv
   ec[1]+velocityvec[2]*velocityvec[2])
       velocityvec[0]=velocityvec[0]*speed/length
       velocityvec[1]=velocityvec[1]*speed/length
       velocityvec[2]=velocityvec[2]*speed/length
       // TE_MODEL from HL-SDK common/const.h
       message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
       write_byte(106) // TE_MODEL index
       write_coord(vec[0]) // location coords
       write_coord(vec[1])
       write_coord(vec[2]+20)
       write_coord(velocityvec[0])  //  speed  coords - stupid, but thats
   how its done
       write_coord(velocityvec[1])
       write_coord(velocityvec[2]+100)
       write_angle (0) // yaw
       write_short (chicken) // model
       write_byte (2) // sound
       write_byte (255) // duration
       message_end()
   }
   public lightsaber(id[]){
       if(   (is_user_alive(id[0])   ==   0)  ||  (HasPrize[id[0]][0]  !=
   PRIZE_LSABER) )
           return PLUGIN_CONTINUE
       new vec[3]
       new aimvec[3]
       new lseffvec[3]
       new length
       new speed = 65
       get_user_origin(id[0],vec,1)
       get_user_origin(id[0],aimvec,2)
       lseffvec[0]=aimvec[0]-vec[0]
       lseffvec[1]=aimvec[1]-vec[1]
       lseffvec[2]=aimvec[2]-vec[2]
       length=sqrt(lseffvec[0]*lseffvec[0]+lseffvec[1]*lseffvec[1]+lseffv
   ec[2]*lseffvec[2])
       lseffvec[0]=lseffvec[0]*speed/length
       lseffvec[1]=lseffvec[1]*speed/length
       lseffvec[2]=lseffvec[2]*speed/length
       new vorigin[3]
       new maxpl = get_maxplayers() +1
       new teama[32],teamv[32]
       get_user_team(id[0],teama,31)
       for(new a = 1; a < maxpl; a++) {
           if(is_user_alive(a) != 0){
               get_user_origin(a,vorigin)
               if (get_distance(vec,vorigin)<100){
                   if(a != id[0]){
                       get_user_team(a,teamv,31)
                       if(!equal(teama,teamv,2)){
                           if(id[1] != 0){
                               user_kill(a,1)
                               client_print(a,print_chat,"[AMX] The power
   of the force has killed you.")
                           }
                       }
                       else if(id[1] == 2){
                           user_kill(a,1)
                           client_print(a,print_chat,"[AMX]  The power of
   the force has killed you.")
                       }
                   }
               }
           }
       }
       // beam effect between point and entity
       message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
       write_byte ( 1 )     //TE_BEAMENTPOINT 1
       write_short (id[0])     // ent
       write_coord (lseffvec[0]+vec[0])//end position
       write_coord (lseffvec[1]+vec[1])
       write_coord (lseffvec[2]+vec[2]+10)
       write_short (saber)  // sprite
       write_byte (0)       // start frame
       write_byte (15)      // frame rate in 0.1's
       write_byte (1)     // byte (life in 0.1's
       write_byte (20)      // line width in 0.1's
       write_byte (5)      // noise amplitude in 0.01's
       write_byte (0)       // RGB color
       write_byte (255)
       write_byte (0)
       write_byte (255)     // brightness
       write_byte (10)      // scroll speed in 0.1's
       message_end()
       return PLUGIN_CONTINUE
   }
   public smokin_1(id[]){
       new cmd[16],dfov,a,b
       dcounter[id[0]] += 1
       if(     (is_user_alive(id[0]))     &&    (HasPrize[id[0]][0]    ==
   PRIZE_DRINKING) ){
           new vec[3]
           get_user_origin(id[0],vec)
           new y1,x1
           x1 = random_num(-40,40)
           y1 = random_num(-40,40)
           //Smoke
           message_begin( MSG_BROADCAST,SVC_TEMPENTITY)
           write_byte( 5 ) // 5
           write_coord(vec[0]+x1)
           write_coord(vec[1]+y1)
           write_coord(vec[2]+30)
           write_short( smoke )
           write_byte( 30 )  // 10
           write_byte( 10 )  // 10
           message_end()
           dfov = random_num(10,120)
           if(!equal(modname,"tfc"))
               format(cmd,15,"default_fov %d",dfov)
           else
               format(cmd,15,"fov -10")
           client_cmd(id[0],cmd)
           if(moved[id[0]]){
               client_cmd(id[0],"-moveleft;-moveright;-forward;-back")
               moved[id[0]] = 0
           }
           b = random_num(0,9)
           if(b == 1){
               a = random_num(0,3)
               client_cmd(id[0],moves[a])
               moved[id[0]] = 1
               new aimvec[3]
               new velocityvec[3]
               new length
               new speed = 500
               get_user_origin(id[0],aimvec,2)
               velocityvec[0]=aimvec[0]-vec[0]
               velocityvec[1]=aimvec[1]-vec[1]
               velocityvec[2]=aimvec[2]-vec[2]
               length=sqrt(velocityvec[0]*velocityvec[0]+velocityvec[1]*v
   elocityvec[1]+velocityvec[2]*velocityvec[2])
               velocityvec[0]=velocityvec[0]*speed/length
               velocityvec[1]=velocityvec[1]*speed/length
               velocityvec[2]=velocityvec[2]*speed/length
               // TE_MODEL from HL-SDK common/const.h
               message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
               write_byte(106)
               write_coord(vec[0])
               write_coord(vec[1])
               write_coord(vec[2]+20)
               write_coord(velocityvec[0])
               write_coord(velocityvec[1])
               write_coord(velocityvec[2]+100)
               write_angle (0)
               write_short (wbottle)
               write_byte (2)
               write_byte (255)
               message_end()
           }
       }
       if( (dcounter[id[0]] >= DRINKING_TIME*2) || (HasPrize[id[0]][0] !=
   PRIZE_DRINKING) ){
           if(moved[id[0]]){
               client_cmd(id[0],"-moveleft;-moveright;-forward;-back")
           }
           if(!equal(modname,"tfc"))
               client_cmd(id[0],"default_fov 90")
           else
               client_cmd(id[0],"fov 90")
       }
       return PLUGIN_CONTINUE
   }
   public ejl_vault(rw[],key[],value[]){
       new data[192]
       new stxtsize = 0
       new line = 0
       new skip = 0
       new vkey[64]
       new vvalue[128]
       new vaultwrite[192]
       if(equal(rw,"READ")){
           if(file_exists("addons/amx/ejl_vault.ini") == 1){
               copy(vault_value,128,"")
               while((line=read_file("addons/amx/ejl_vault.ini",line,data
   ,192,stxtsize))!=0){
                   parse(data,vkey,64,vvalue,128)
                   if(equal(vkey,key)){
                       copy(vault_value,128,vvalue)
                   }
               }
           }else{
               write_file("addons/amx/ejl_vault.ini",  "****  Plugins use
   to store values -- immune to crashes and map changes ****", 0)
           }
       }
       else if(equal(rw,"WRITE")){
           if(file_exists("addons/amx/ejl_vault.ini") == 1){
               format(vaultwrite,192,"%s %s",key,value)
               while((line=read_file("addons/amx/ejl_vault.ini",line,data
   ,192,stxtsize))!=0){
                   parse(data,vkey,64,vvalue,128)
                   if(skip == 0){
                       if( (equal(data,"")) || (equal(vkey,key)) ){
                           skip = 1
                           write_file("addons/amx/ejl_vault.ini",vaultwri
   te,line-1)
                       }
                   }
                   else if(equal(vkey,key)){
                       write_file("addons/amx/ejl_vault.ini","",line-1)
                   }
               }
               if(skip == 0){
                   write_file("addons/amx/ejl_vault.ini",vaultwrite,-1)
               }
           }
       }
       return PLUGIN_CONTINUE
   }
