Results 1 to 6 of 6

Thread: last Man Standing

  1. #1

    Default last Man Standing

    it says "Works for objective mode only" in the script why is that? What makes it only work in objective mode?
    Code:
    /*
      Script written by OwN-3m-All (http://www.own3mall.com)
      Xfire:  own3mall
      Credits and Modifications:  Modify anything you want, please leave credits at the beginning of this file. 
    */
    
    main:
      // Works for objective mode only
      
      
      if (int(getcvar(g_gametype)) == 4){
      
        // Check and see if the last man standing CVAR is on...
        
        if(int(getcvar(lastManStanding)) == 1){
          thread lastPlayers
        }
      }
    end
    
    lastPlayers:
      waitframe
      wait 5
      while(1){
        // Scans players that are alive every 8 seconds
        wait 1
        waitframe
        local.axisCount = 0
        local.alliesCount = 0
        for (local.i = 1; local.i <= $player.size; local.i++){
            local.player = $player[local.i]
            if(local.player != NULL && isAlive(local.player)){
            
                // Counts axis that are alive
                if (local.player.dmteam == axis){
            		   local.axisCount++
            		   
            		   // Sets player name... will be the only player with a name when he's the last man standing
            		   level.axis_playerName = netname local.player
            	  }
                 
                // Count allies that are alive
                if(local.player.dmteam == allies){
                  local.alliesCount++
                  
                  // Sets player name... will be the only player with a name when he's the last man standing
                  level.allies_playerName = netname local.player                      
                }
            }
        }
        if(local.axisCount == 1){
          thread axisHud  
        }else{
          // Clear the hud
          thread clearAllHuds 209
          thread clearAllHuds 212
        }
        
        if(local.alliesCount == 1){
          thread alliesHud
        }else{
          // Clear the hud
          thread clearAllHuds 210
          thread clearAllHuds 211
        }
        wait 8
      }
      
    end
    
    axisHud:
      // Axis Hud last player notification
      
      huddraw_font 209 "facfont-20"
      huddraw_alpha 209 0.8
      huddraw_color 209 1 0 0
      huddraw_align 209 right center
      local.coordx = -225
      local.coordy = 100
      huddraw_rect 209 local.coordx local.coordy 250 20
      if(level.axis_playerName != NULL && level.axis_playerName != NIL){
        huddraw_string 209 ("Last Axis: " + level.axis_playerName)
      }
      
      huddraw_alpha 212 0.8
      huddraw_align 212 right center
      huddraw_virtualsize 212 0
      local.coordx = -260
      local.coordy = 100
      huddraw_rect 212 local.coordx local.coordy 20 20
      huddraw_shader 212 ("textures/hud/axis")
      
    end
    
    alliesHud:
    
      // Allies Hud last player notification
      
      huddraw_font 210 "facfont-20"
      huddraw_alpha 210 0.8
      huddraw_color 210 0.576471 0.858824 0.439216
      huddraw_align 210 right center
      huddraw_virtualsize 210 0
      local.coordx = -225
      local.coordy = 60
      huddraw_rect 210 local.coordx local.coordy 250 20
      if(level.allies_playerName != NULL && level.allies_playerName != NIL){
        huddraw_string 210 ("Last Ally: " + level.allies_playerName)
      }
      
      // Allies icon
      
      huddraw_alpha 211 0.8
      huddraw_align 211 right center
      huddraw_virtualsize 211 0
      local.coordx = -260
      local.coordy = 60
      huddraw_rect 211 local.coordx local.coordy 20 20
      huddraw_shader 211 ("textures/hud/allies")
    
    end
    
    clearAllHuds local.hudNum:
       if(local.hudNum != NULL && local.hudNum != NIL){
          huddraw_alpha local.hudNum 0
       }
    end

  2. #2

    Default

    Quote Originally Posted by easymeat View Post
    What makes it only work in objective mode?
    because respawn in obj is disabled by default


    maybe it will work in other gamemodes if you add a level.dmrespawning = 0 at the start
    like this

    Code:
    main:
        // Check and see if the last man standing CVAR is on...
        if (int(getcvar("lastManStanding")) == 1) {
            level.dmrespawning = 0;
            thread lastPlayers;
        }
    end;

  3. #3

    Default

    Quote Originally Posted by Zappa View Post
    because respawn in obj is disabled by default
    No, is because the mod only checks for the gametype 4 -> Obj


    if (int(getcvar(g_gametype)) == 4){

    // Check and see if the last man standing CVAR is on...

    if(int(getcvar(lastManStanding)) == 1){
    thread lastPlayers
    }
    }


    @easymeat: To put working on other gametypes just remove the check but doesnt make sense if you run the mod on the FFA.
    Last edited by DoubleKill; April 19th, 2018 at 11:29 AM.

  4. #4

    Default

    Quote Originally Posted by DoubleKill View Post
    No, is because the mod only checks for the gametype 4 -> Obj
    i know, but that's very obvious.
    you have to ask yourself, why did own3mall have to make that check for obj mode?
    to play without respawning, otherwise the mod will not work
    and, how can you disable the respawn in other gamemodes?
    with level.dmrespawning = 0


    so i think the code i posted before will be enough to make it work in every gametype, even FFA

  5. #5
    Developer RyBack's Avatar
    Join Date
    Apr 2014
    Location
    In Front of the screen
    Posts
    1,603

    Default

    Own's mod is more like a statistics mod.
    It only tells who was the last man,
    This is not the same as battle royale mods.

  6. #6

    Default

    so i think the code i posted before will be enough to make it work in every gametype, even FFA
    It does

    Well this is what I have so far, still need to fine tune it but it works, each team has it's own trigger allies is "green" and axis is "red".Everyone starts out with the teams pistol with no ammo, and "self nodamage" then gets taken away after the draw_time is reached and "self takedamage" they are given the Silenced Pistol with 6 shots If player who won has his pistol returned to the pistol he spawned with, and he keeps on fighting until he gets killed and so on till all players have fought.



    There is two scripts that control it all a trade_pistols.scr that only runs if "set gun_fight 1 " in server.cfg and then the gf.scr that runs everything. Only down fall is you can't use colt45 or p38 if mod is on because no ammo. Which for me don't matter I run snipers only on my server.

    gf.scr
    Code:
    main:        
        thread beam
        thread weapon
        thread beam1
        thread weapon1
        
    end
    
    beam:
    
    	local.beam = spawn func_beam "targetname" "door" origin ( -295.13 534.38 388.13 ) endpoint ( -295.13 419.96 388.13 )
    
    	$door color ( 1 0 0 )
    	$door scale 1
    	$door numsegments 1
    	$door activate
    end
    
    weapon:
    
    
      
    	level.dmrespawning = 0 // 1 or 0
    	
    	local.trig = spawn trigger_multiple "targetname" "spot2"
    	local.trig.origin = ( -226.18 490.95 384.13 )
    	local.trig setsize ( -20 -20 10 ) ( 20 20 10 )
    	
    	$spot2 waittill trigger
    	
    	local.barbwire2 = spawn script_model
    	local.barbwire2 model "static/barbwire_long.tik"
    	local.barbwire2.origin = ( -179.16 479.14 324.13 )
    	local.barbwire2.angles = ( 0 0 0 )
    	local.barbwire2 solid
    	local.barbwire2.scale = .5
    
    	local.player = parm.other	
      if ( local.player.dmteam == "axis" && local.player !=NULL)
    	{
        local.draw_time = getcvar draw_time
    	 $spot1 remove
    		wait 5
    		}
    	  self nodamage
        local.player take "models/weapons/p38.tik"
        waitframe
    	  local.player give "models/weapons/silencedpistol.tik"
    	  {
    	   wait local.draw_time	
    	   self takedamage
          }
        local.player use "models/weapons/silencedpistol.tik"	
    	  wait 15
    	if( local.player != NULL && IsAlive(local.player)) 
    	  {
    	local.player take "models/weapons/silencedpistol.tik"
    	wait 0.5 
      local.player give "models/weapons/p38.tik"
      waitframe
      local.player use "models/weapons/p38.tik"
    
    	  }
    end
    
    
    beam1:
    
    	local.beam1 = spawn func_beam "targetname" "beam1" origin ( 743.13 410.21 388.13 ) endpoint ( 743.13 545.20 388.13 )
    
    	$beam1 color ( 0 1 0 )
    	$beam1 scale 1
    	$beam1 numsegments 1
    	$beam1 activate
    end
    
    weapon1:
    
    
    	local.trig1 = spawn trigger_multiple "targetname" "spot1"
    	local.trig1.origin = ( 681.29 456.71 384.13 )
    	local.trig1 setsize ( -20 -20 10 ) ( 20 20 10 )
    	$spot1 waittill trigger
    	
    	local.barbwire1 = spawn script_model
    	local.barbwire1 model "static/barbwire_long.tik"
    	local.barbwire1.origin = ( 633.88 472.95 324.13 )
    	local.barbwire1.angles = ( 0 0 0 )
    	local.barbwire1 solid
    	local.barbwire1.scale = .5
    
    
    	local.player = parm.other	
      if ( local.player.dmteam == "allies" && local.player !=NULL )
    	{
        local.draw_time = getcvar draw_time
        $spot1 remove
    		wait 5
    		}
    	  self nodamage	  
    	  local.player take "models/weapons/colt45.tik"
        waitframe
    	  local.player give "models/weapons/silencedpistol.tik"
    	  {
    	   wait local.draw_time
    	   self takedamage
    	   
          }
        local.player use "models/weapons/silencedpistol.tik"	
    	  wait 15
    	if( local.player != NULL && IsAlive(local.player)) 
    	  {
    	local.player take "models/weapons/silencedpistol.tik"
    	wait 0.5 
    	local.player give "models/weapons/colt45.tik"
    	waitframe
    	local.player use "models/weapons/colt45.tik"
    	  }
    end
    trade_pistol.scr
    Code:
    Main:
    
    
        level.gun_fight = int( getcvar( gun_fight ) )
        if( level.gun_fight == 1 )
        {  
        exec mods/gf.scr
    	  thread p38
    	  thread colt45 			
        }
    end
    
    
    p38:
    	waitframe
    
    	local.n = randomint 99999
    
    	self weaponcommand mainhand targetname ("w" + local.n)
       
    	if ($("w" + local.n))
    
    	{
    
    	local.weap = $("w" + local.n)
    
    	local.weap.targetname = ""
    
    	}
    
    	else
    
    	end
    
    	switch(local.weap.model)
    
    	{
    	
    	case "models/weapons/panzerschreck.tik":
    	case "models/weapons/mp40.tik":
      case "models/weapons/mp44.tik":   
      case "models/weapons/shotgun.tik":
      case "models/weapons/kar98.tik":
      case "models/weapons/kar98sniper.tik":
      case "models/weapons/steilhandgranate.tik":
    
    	self take "models/weapons/panzerschreck.tik"
    	self take "models/weapons/mp40.tik"
      self take "models/weapons/mp44.tik"   
      self take "models/weapons/shotgun.tik"
      self take "models/weapons/kar98.tik"
      self take "models/weapons/kar98sniper.tik"
      self take "models/weapons/steilhandgranate.tik"
    	switch(self.model)
    
    	{
    
    	case "models/player/german_afrika_officer.tik":
    	case "models/player/german_afrika_private.tik":
    	case "models/player/german_elite_gestapo.tik":
    	case "models/player/german_elite_sentry.tik":
    	case "models/player/german_kradshutzen.tik":
    	case "models/player/german_panzer_grenadier.tik":
    	case "models/player/german_panzer_obershutze.tik":
    	case "models/player/german_panzer_shutze.tik":
    	case "models/player/german_panzer_tankcommander.tik":
    	case "models/player/german_scientist.tik":
    	case "models/player/german_waffenss_officer.tik":
    	case "models/player/german_waffenss_shutze.tik":
    	case "models/player/german_wehrmacht_officer.tik":
    	case "models/player/german_wehrmacht_soldier.tik":
    	case "models/player/german_winter1.tik":
    	case "models/player/german_winter2.tik":
    	case "models/player/german_DDay_Colonel.tik":
    	case "models/player/Sc_AX_Ital_Inf.tik":
      case "models/player/Sc_AX_Ital_Inf2.tik":
      case "models/player/IT_AX_Ital_Vol.tik":
      case "models/player/SC_AX_ITAL_PARA.tik":
    
    	waitframe
    
    	self give "models/weapons/p38.tik"
    	waitframe 
    
    	self use "models/weapons/p38.tik"
    
    	break
    
    	default:   
    
    	waitframe
    
    	self give "models/weapons/p38.tik"
    
    	waitframe 
    
    	self use "models/weapons/p38.tik"
    
    	break
    
    	}
    
    	break
    
    	}
    	end
    	
    colt45:
    	waitframe
    
    	local.n = randomint 99999
    
    	self weaponcommand mainhand targetname ("w" + local.n)
       
    	if ($("w" + local.n))
    
    	{
    
    	local.weap = $("w" + local.n)
    
    	local.weap.targetname = ""
    
    	}
    
    	else
    
    	end
    
    	switch(local.weap.model)
    
    	{
          
    
    	case "models/weapons/bazooka.tik":
      case "models/weapons/m1_garand.tik":    
      case "models/weapons/thompsonsmg.tik": 
      case "models/weapons/bar.tik":
      case "models/weapons/shotgun.tik":
      case "models/weapons/springfield.tik":
      case "models/weapons/m2frag_grenade.tik":
    
    	self take "models/weapons/bazooka.tik"
      self take "models/weapons/springfield.tik"
      self take "models/weapons/m1_garand.tik"
    	self take "models/weapons/thompsonsmg.tik"    
      self take "models/weapons/bar.tik"
    	self take "models/weapons/shotgun.tik"
      self take "models/weapons/m2frag_grenade.tik"
    
    	switch(self.model)
    
    	{
    
    	case "models/player/allied_british_6th_airborne_captain.tik":
    	case "models/player/allied_british_6th_airborne_paratrooper.tik":
    	case "models/player/allied_british_tank_corporal.tik":
    	case "models/player/allied_manon.tik":
    	case "models/player/allied_sas.tik":
    	case "models/player/allied_russian_corporal.tik":
    	case "models/player/allied_russian_crazy_boris.tik":
    	case "models/player/allied_russian_recon_scout.tik":
    	case "models/player/allied_russian_recon_soldier.tik":
    	case "models/player/allied_russian_seaman.tik":
    	case "models/player/allied_101st_Captain.tik":
    	case "models/player/allied_101st_Infantry.tik":
    	case "models/player/allied_101st_Scout.tik":
    	case "models/player/allied_501st_PIR_Scout.tik":
    	case "models/player/allied_501st_PIR_Soldier.tik":
    	case "models/player/allied_airborne.tik":	
    	case "models/player/allied_oss.tik":
    	case "models/player/american_army.tik":
    	case "models/player/american_ranger.tik":
    
    	waitframe
    
    	self give "models/weapons/colt45.tik"
    
    	waitframe 
    
    	self use "models/weapons/colt45.tik"
    
    	break
    
    	default:   
    
    	waitframe
    
    	self give "models/weapons/colt45.tik"
    
    	waitframe 
    
    	self use "models/weapons/colt45.tik"
    
    	break
    
    	}
    
    	break
    
    	}
    	end
    Last edited by easymeat; April 20th, 2018 at 07:31 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •