Admin Pro 1.22

Started by wcSki, January 22, 2006, 07:50:39 PM

Previous topic - Next topic

wcSki

I have did what was outlined about and for some reason I can not get the script to run and swap out the pistols...

   

   I looked again in the weapons limiter.txt file and could not see anything about swapping secondary weapons.... I will keep trying and see what happens.

   

   Ski

Elgan {sfx}

hm, ok

   

   well it may not have swapping for pistols, the reason being is that i would have to check if pistols are beign swapped on every single weapon raise, This is because you cant check what weapon the player has in the inventory.

   

   So, i probably only added take away. I should of added give also. So you take away a pistol and give another.

   

   i will add "give" for next update, thought i had added it.sorry, ok, just make a script to give and take like habsey shows. You can make it turn on and off with a new cvar or use AP or a new cvar in AP, you could even make it as a new plugion script.

wcSki

Ok I made this 1st pistol_swap.scr

   

   

   main:
   while(1)
   {
   if (local.pistol_exhange = 1)
   {
   end
   }
   else if (local.pistol_exhange != 1)
   {
   local.pistol_exhange = 1
   take "models/weapons/colt45.tik"
   take "models/weapons/p38.tik" //make sure to change this cant remember the correct .tik file
   namegive "models/weapons/silencedpistol.tik" //make sure to change this cant remember the correct .tik file name
   }
   wait 1
   }
   end

   

   and then at the end of DMprecache I added this

   

   

   cache models/vehicles/jeep_30cal.tik
   if(getcvar(g_pistol_swap) == "1")
   {
   exec global/pistol_swap.scr
   }
   end
   

   

   Placed both of these files into a new pk3 named zzzzzz_pistol_swap.pk3

   

   created a global folder and placed DMprecache.scr and pistol_swap.scr

   

   placed into server main folder... restarted server and pistols do not swap when I enter the command line. I tried:

   

   rcon g_pistol_swap 1

   rcon g_pistol_swap "1"

   rcon set g_pistol_swap 1

   rcon set g_pistol_swap "1"

   

   none of them worked. What am I doing wrong??

   Ski

Elgan {sfx}

the loop above, will not check if its already running, it will just check if its running in its own scope, and run. It will check every looping. Also your cvar will only check once, at the exec.

   

   

   main:
   
   if (level.pistol_exhange = 1)
   {
   end  //check once, before the loop.
   }
   
   level.pistol_exhange = 1
   
   while(1)
   {
   
   if(getcvar(g_pistol_swap) == "1")
   {
   take "models/weapons/colt45.tik"
   take "models/weapons/p38.tik" //make sure to change this cant remember the correct .tik file
   namegive "models/weapons/silencedpistol.tik" //make sure to change this cant remember the correct .tik file name
   }
   
   
   wait 1
   }
   end

   

   exec it from dmprecache or similar

wcSki

Man I am feeling really dumb... I used the code you listed above and put it in my pistol_swap.scr file... saved it all again and still will not swap pistols.

   

   How should I be entering the console command??

   

   rcon set g_pistol_swap "1"

   

   is that correct??

   Ski

   

   Edit:

   Oh and when I go into the Admin Pro menu and look at the cvar list.... I do not see g_pistol_swap even listed. I think I maybe to much of a noob at this to put this thing together so it works. :con

   

   edit#2:

   Another question came to mind. Part of the Admin Pro Menu you have the option to punish peeps or warn them they are about to be kicked. kickwarn I think the command is... is there a way to change the text the in window that pops up??

Elgan {sfx}

setting the cvar sud be good, sud then work,.

   

   AP menu will not change, u didnt even add a script to AP

   

   3. yes, but in the script global/ac/command_post/

   

   one of the scripts inside there, forget the name. Cant check atm

wcSki

Well thanks for all the help, but I can not get this to work at all. Is it possible for someone to put this together for me and send me the pk3??

   

   I found the file to edit... thx!

   

   Ski

Elgan {sfx}

try

   

   

   main:
   
   if (level.pistol_exhange = 1)
   {
   end  //check once, before the loop.
   }
   
   level.pistol_exhange = 1
   
   while(1)
   {
   
   if(getcvar(g_pistol_swap) == "1")
   {
   for(local.i = 1;local.i<= $player.size;local.i++)
   {
   local.player = $player[local.i]
   local.player take "models/weapons/colt45.tik"
   local.player take "models/weapons/p38.tik" //make sure to change this cant remember the correct .tik file
   local.player give "models/weapons/silencedpistol.tik" //make sure to change this cant remember the correct .tik file name
   }
   }
   
   
   wait 1
   }
   end

wcSki

Hmmm nope that did not work. I posted on TMT forums as well and unreal demon told me to try this based on the script provided in this thread.

   

   

   Main:
   
      if (level.pistol_exhange)
         end
   
      level.pistol_exhange = 1
   
      while (1)
      {
         local.pistol_swap_cvar = getcvar("g_pistol_swap")
         if(local.pistol_swap_cvar == "1")
         {
            for(local.i = 1; local.i <= $player.size; local.i ++)
            {
               if !($player[local.i].pistol_swapped)
               {
                  $player[local.i].pistol_swapped = 1
                  $player[local.i] take "models/weapons/colt45.tik"
                  $player[local.i] take "models/weapons/p38.tik"
                  $player[local.i] give "models/weapons/silencedpistol.tik"
                  $player[local.i] thread check_for_death
               }
               wait .5
            }
         }
         wait 1
      }
   
   end
   
   check_for_death:
   
      while(isAlive self)
         waitframe
   
      $player[local.i].pistol_swapped = 0
   
   end
   

   

   

   I did that... but still was not able to get it to run so I thought maybe it was the way I am executing it in DMprecache... so I placed this line in the mohdm1 map script

   

   

   

   level waittill spawn
   exec global/pistol_swap.scr
   

   

   I do not know if that is the right place to put it or not... but I then created a maps/DM folder in my pk3 and placed the script for the map in there and loaded up a local server to test it out using the last pistol_swap.scr above that unreal demon provided. Not the on all the time one.

   

   when I 1st loaded the map I had standard pistol... then I put into console

   

   set g_pistol_swap 1

   <pressed enter>

   

   and then checked to see if I had a silenced pistol and I did!

   

   BUT  

   When I changed from Allies to Axis... It went back to standard pistol and I could not get it to give me a silenced pistol with out 1st setting it back to 0

   

   set g_pistol_swap 0

   restart

   set g_pistol_swap 1

   

   and then back to 1. AND whenever I restarted the map it went back to standard pistols and I had to do the samething as above to turn it back on.

   

   hey! at least I had a silenced pistol for some of the time

   

   So for some reason putting what I have in DMprecache is not working... how else can I turn this off and on??? and make it stay on during map restarts and map changes from one to another?? any ideas??

   

   I am very new to this and just wanted to say thanks to you both for all the help!

   

   Ski

habsey

use the 1 elgan gave u above should work and if it doesnt repost and ill add some team casing to it..
1[sky] Man[/sky]
1 Job
[pink]1[/pink][yellow] Vision[/yellow]

wcSki

I tried elgans script above and it still did not work. This is what I have so far.

   

   This is the pistol_swap.scr I have that works somewhat :(

   

   

   //// Pistol Swap Script Made Possible By Unreal_Demon, Elgan, Habsey and others
   //// Tested and put together By :^BONES^: Ski
   //// Thanks to Unreal_Demon, Elgan, Habsey for all their help!
   
   Main:
   
      if (level.pistol_exhange)
         end
   
      level.pistol_exhange = 1
   
      while (1)
      {
         local.pistol_swap_cvar = getcvar("pistol_swap")
         if(local.pistol_swap_cvar == "1")
         {
            for(local.i = 1; local.i <= $player.size; local.i ++)
            {
               if ( !($player[local.i].pistol_swapped) && ($player[local.i].dmteam != "spectator") )
               {
                  $player[local.i].pistol_swapped = 1
   
                  if($player[local.i].dmteam == "allies")
                     $player[local.i] take "models/weapons/colt45.tik"
                  if($player[local.i].dmteam == "axis")
                     $player[local.i] take "models/weapons/p38.tik"
   
                  $player[local.i] give "models/weapons/silencedpistol.tik"
                  $player[local.i] thread check_for_death
               }
               wait .5
            }
         }
         wait 1
      }
   
   end
   
   check_for_death:
   
      local.team = self.dmteam
   
      while(1)
      {
         if( (self.dmteam != local.team) || (self.health <= 0) )
         {
            $player[local.i].pistol_swapped = 0
            end
         }
         wait 1
      }
   
   end
   

   

   I excute it by putting this code in the map file

   

   

   level waittill spawn
   exec global/pistol_swap.scr
   

   

   It will only excute if you set pistol_swap to 1=ON in rcon console.

   

   

   With everything like above I have the script swapping out standard pistol's to the silenced pistol MOST of the time.

   

   The problem I am having is when someone is in spectate... when they spawn from spectate the pistols do not swap... as soon as the die and respawn the pistol starts swapping. Not sure what to do so they swap when coming out of spectate. Any idea looking at the script above what I could try??

   

   Thanks!

   Ski

habsey

k here it is ... tested works great dont see a problem in it,

   

   //// Pistol Swap Script Made Possible By Unreal_Demon, Elgan, Habsey and others
   //// Tested and put together By :^BONES^: Ski
   //// Thanks to Unreal_Demon, Elgan, Habsey for all their help!
   
   Main:
   
      if (level.pistol_exhange)
         end
   
      level.pistol_exhange = 1
   
      while (1)
      {
         local.pistol_swap_cvar = getcvar("pistol_swap")
         if(local.pistol_swap_cvar == "1")
         {
            for(local.i = 1; local.i <= $player.size; local.i ++)
            {
               if ( !($player[local.i].pistol_swapped))
               {
                  $player[local.i].pistol_swapped = 1
   
                  if($player[local.i].dmteam == "allies")
                  {
                     $player[local.i] take "models/weapons/colt45.tik"
                     $player[local.i] give "models/weapons/silencedpistol.tik"
                     $player[local.i] thread check_for_death
                  }
                  if($player[local.i].dmteam == "axis")
                  {
                     $player[local.i] take "models/weapons/p38.tik"
                     $player[local.i] give "models/weapons/silencedpistol.tik"
                     $player[local.i] thread check_for_death
                  }
                  else if($player[local.i].dmteam == "spectator")
                  {
                     goto main
                  }
               }
               wait .5
            }
         }
         wait 1
      }
   
   end
   
   check_for_death:
   
      local.team = self.dmteam
   
      while(1)
      {
         if( (self.dmteam != local.team) || (self.health <= 0) )
         {
            $player[local.i].pistol_swapped = 0
            end
         }
         wait 1
      }
   
   end
   
1[sky] Man[/sky]
1 Job
[pink]1[/pink][yellow] Vision[/yellow]

wcSki

Thanks Habsey

   

   I tried the script above, it did not fix the problem... if you spawn and get killed you respawn with a silence pistol... but if you go into spectate and then rejoin the battle you spawn with the standard pistols for each team. I guess I am kind of stuck at this point. Not sure what to do.

   

   Maybe elgan can put this ability into admin pro... hint hint :)

   

   really tho you all have been great!! Thank you so much!

   Ski

habsey

well im off to hockey now ill take a look at it when i get bak ill get it too work if someone doesnt beat me to it well peace
1[sky] Man[/sky]
1 Job
[pink]1[/pink][yellow] Vision[/yellow]

wcSki

I think I have just about used up my help on this one... nobody seems to have an idea of what could be wrong so I think you will have time :)

   

   Ski