Scripts
um... what?
Thanks given by:
It's just I have my personal opinions about scripts...
Other than helpful server scripts or the nice ones you've posted like RapidFire screenshots, anything regarding weaponry 'weaponswitch' alike since they are not implemented in the original source I consider it unfair toward those who do not have these "make your life easier".
That's it, it's my point of view, useless to come and flame as I won't respond.
Thanks given by:
is there variable that measure your health?
Thanks given by:
Not yet, but it's already implemented for the next version.
Thanks given by:
ugh... now I want next version yet I hate next version
Thanks given by:
@Cleaner: Good to know our opinions are opposed, yet equally strong.

@Bugboy: Stop hatin'. You know you want it.
Thanks given by:
Is it possible to have a script that changes to the pistol after the primary is empty? Or a knife if the pistol is empty?
Thanks given by:
Yes, if it is all bound to a key. Auto-weapon switching without pressing a keybind is not allowed anymore.
Thanks given by:
IMO if you can't keep track of ammo and be able to switch to another weapon at short notice you should just uninstall
Thanks given by:
My concern is switching to a sniper rifle if the knife is empty.
Thanks given by:
(20 Jul 11, 02:25PM)V-Man Wrote: My concern is switching to a sniper rifle if the knife is empty.
equally strong concern XD
btw, when are we gonna be able to use our boots?

V-Man sort this script out will ya... bind key [*] fire/slash/boot

even better bind key [*] fire/slash/headbut/boot/

* Cleaner wonders how comes no one came with a teabaggin script


Thanks given by:
DES|Cleaner, I was going to try, however you canot do actions without their keys getting pressed. The action has to be keybound, so the key can be held down.
Thanks given by:
If AC could tell the keyboard to turn caps lock on/off, it would be more feasible. :D

And no using the headbutt hack!
Actually, headbutt/slash/kick are in the same range, it'd just be a matter of making the weapon model look like you're kicking. Headbutting would definitely be a challenge, though.
Thanks given by:
[Image: oucho.png]
Thanks given by:
[Image: oucho10.jpg]
Thanks given by:
I was wondering if someone could make a script for me, some may know that I had problems with Svearks server mod, and now only I can claim admin due to the password hashing, I wanted some way for other people to get admin, so I thought that, someone could make a script that made it so, when people say into the chat "CLAIMADMIN", it would make me (if I already didn't have admin) claim admin, give them admin, then tell them "PM me the password in this format "!PM Killerxxx setadmin <PASSWORD>" in less then 20 seconds to succesfully claim admin" And if they didn't PM me the pass in time, I would claim admin, kick the player, remove all bans and open the mastermode, even if they didn't change any of it.

Thanks given by:
you would have to mod the server
Thanks given by:
Also, you should rethink if that's really what you want. You better fix the problem instead of giving arbitrary people admin (remember, 20 seconds are more than enough to kick the server empty or possibly do other nasty tricks).
Thanks given by:
10 seconds :P and no I wouldn't have to mod the server, the server is already modded, the !pm Killerxxx part is taken apart of
Thanks given by:
(20 Jul 11, 07:57AM)Bukz Wrote: Yes, if it is all bound to a key. Auto-weapon switching without pressing a keybind is not allowed anymore.

Can you do an if on a keybind? I have no idea how to use CS yet, so here is the idea.

//-// TERRIBLE CODE ENSUES //-//

bind mouse1
[
if primary=1
   if secondary.ammo > 0
      weapon=secondary  
   else
   if total.ammo > 0
      reload
   else
      weapon=melee
]

//-// THE PAIN IS OVER //-//

Would something like that work?

//Edit: Just read 888's script. I assume it would be similar.

//Double Edit: Saw the first post's pistol switch. I'll read from now on.
Thanks given by:
(25 Jul 11, 09:44PM)killerxxx Wrote: 10 seconds :P and no I wouldn't have to mod the server, the server is already modded, the !pm Killerxxx part is taken apart of

more like... 50 milliseconds?
say "CLAIMADMIN"
sleep 50 [
  loop i 20 [ ban $i ]
]
...leveraged. You should really just give them new passwords instead. Also an excellent opportunity to clean house a bit (i.e. only give it to people you still trust).
Thanks given by:
What is the code?
Thanks given by:
Ok, I've been working on this script for a almost a week now. I've had input from my clan mates and some people I trust to be nice. I'd like to see what the community thinks about this script. It's under on going development, but I don't foresee any more major changes. I would like to include the logic of this script in a cfg file but am ignorant as to there use. Feel free to push, prick, prod, dissect and otherwise criticize this script. Thanks.

If for some reason you want to see where this all started visit my clan's website: Crosshair Switcher by Verse

// Crosshair Switcher by Verse version 0.31
// With inspiration from Ronald_Reagan
// This script allows you to set the type and size of each
// weapons' crosshair.
// You can to cusumize the section labled "B I N D S" and the
// section labeled "S E T T I N G S"to fit your needs


//------------------- B I N D S ------------------------
//This script is designed to use these binds.  Customize
//these binds to fit your needs.  To the best of my
//knowledge these binds will not interfere with mapping.
    //MOUSE1 is exicuted on left-click
    bind "MOUSE1" [ mouse1Click ]
    //MOUSE2 is exicuted on right-click
    bind "MOUSE2" [ mouse2Click ]
    //MOUSE3 is exicuted on middle click
    bind "MOUSE3" [ mouse3Click ]
    //MOUSE4 is exicuted by scrolling up on the mouse
    //scroll wheel
    bind "MOUSE4" [ mouse4ScrollUp]
    //MOUSE5 is exicuted by scrolling down on the mouse
    //scroll wheel
    bind "MOUSE5" [ mouse5ScrollDown]
    //The following binds are usually 1, 2, and 4
    //respectivly.  I prefer A, Z and Q as they are more
    //effective for me.
    bind "1" [primaryCustCrosshair]
    bind "2" [secondaryCustCrosshair]
    bind "3" [grenadesCustCrosshair]
    bind "4" [meleeCustCrosshair]



//-------------- S E T T I N G S ----------------
//INSTRUCTIONS FOR SETTING CROSSHAIR SIZE AND TYPE    

// SIZE
// To change a weapon's size you change the number under
// "CROSSHAIR SIZE" in that weapons row.   The range is
// from 0 to 50.
// Note: the sniper is only included to keep the script
// congruent, it fills no purpose and thus the size is 0.

// TYPE
// To change the crosshair type, you put the name of the
// crosshair you would like under under 'CROSSHAIR TYPE' in
// that weapons row.  The file you would like to use must
// be in the crosshairs folder.  A list of the standard
// crosshairs and their discriptions is provided.

// For example
// if you want to change your knife crosshair to
// a circle with a dot in the middle.  You look for
// 'o_dot.png' on the "CROSSHAIR LIST.
// Then you scroll down to "WEAPON SETTINGS".  Once there
// you set "CROSSHAIR SIZE" of your knife to 50 and .


//----------------------- C R O S S H A I R  L I S T ---------------------------
//  CROSSHAIR TYPE    DESCRIPTION
//------------------------------------------------------------------------------
//    cube.png     Vertial and Horizontal X
//    default.png  Same as cube.png but with an empty middle
//    dot.png      White dot
//    dot_wide.png White dot with 'T's at the outer edges
//    o.png        Circle
//    o_dot.png    Circle with a dot
//    o_x.png      Combination of o.png and default.png
//    red_dot.png  Red Dot
//    star.png     A small circular dot with short vertial and horizontal lines
//    wide.png     Dot_wide, without the dot
//    x-dot.png    Default.png with a dot in the middle
//    custom       Anycustom crosshair in the 'crosshairs' folder

//--------------------   W E A P O N  S E T T I N G S     --------------------------------
//               WEAPON             CROSSHAIR SIZE                  CROSSHAIR TYPE
//               NAME                   \/                       |--------------|
//--------------------------------------------------------------------------------------

        Setting_Knife = [ alias size    50;   alias crosshairType   o_x.png     ]
       Setting_Pistol = [ alias size    30;   alias crosshairType   dot_wide.png     ]
     Setting_Carabine = [ alias size    12;   alias crosshairType   dot_wide.png     ]
      Setting_Shotgun = [ alias size    50;   alias crosshairType   o_dot.png     ]
Setting_SubmachineGun = [ alias size    20;   alias crosshairType   dot_wide.png     ]
Setting_AssaultRifle = [ alias size    12;   alias crosshairType   dot_wide.png     ]
      Setting_Grenade = [ alias size    30;   alias crosshairType   dot_wide.png     ]
       Setting_Akimbo = [ alias size    30;   alias crosshairType   dot_wide.png     ]
       Setting_Sniper = [ alias size    00;   alias crosshairType   dot_wide.png     ]



//END OF SETTINGS
//------------------------WARNING-----------------------
// Changing anything below this message could cause this
// script to stop working.
// On the other hand if you want to play with this scipt
// this where the fun stuff starts
//               HAVE FUN!!!
//----------------------END WARNING---------------------



alias setCrosshair [
    //size
    alias size = 15
    alias crosshairType = 0
    //knife        0
    if (= 0 (curweapon)) [Setting_Knife] [
    //pistol    1
    if (= 1 (curweapon)) [Setting_Pistol] [
    //carbine    2
    if (= 2 (curweapon)) [Setting_Carabine] [
    //shotgun    3
    if (= 3 (curweapon)) [Setting_Shotgun] [
    //subM        4
    if (= 4 (curweapon)) [Setting_SubmachineGun] [
    //assaultR    6
    if (= 6 (curweapon)) [Setting_AssaultRifle] [
    //grenade    8
    if (= 8 (curweapon)) [Setting_Grenade] [
    //akimbo    9
    if (= 9 (curweapon)) [Setting_Akimbo] [
    //sniper    5
    if (= 5 (curweapon)) [Setting_Sniper]
    ] ] ] ] ] ] ] ]
    setCrosshairAction $size $crosshairType
]


alias mouse1Click [
    attack    
    resetAfterEvent
]
alias mouse2Click [
    if $editing [
        showmenu editing
    ] [
        altaction
        resetAfterEvent
    ]
]
alias mouse3Click [
    weapon    
    sleepSetCrosshair
]
alias mouse4ScrollUp [
    universaldelta  1
    sleepSetCrosshair
]
alias mouse5ScrollDown [
    universaldelta -1
    sleepSetCrosshair
]
//END BINDS


//DIRECT SELECT
//These allow direct selection of primary weapon, pistol,
//knife, and grenades weapons in game

alias primaryCustCrosshair [
    setWeapon (currentprimary)
    sleepSetCrosshair
]

alias meleeCustCrosshair [
    setWeapon 0
    sleepSetCrosshair
]

alias secondaryCustCrosshair [
    setWeapon 1
    sleepSetCrosshair
]

alias grenadesCustCrosshair [
    setWeapon 8
    resetAfterEvent
]

alias resetAfterEvent [
    alias count 0
    while [ (< $count 2051) ] [
        alias i 0
        sleep $count [
            setCrosshair
        ]
        alias count (+ $count 50)
    ]
]

//This codeblock is used by DIRECT SELECT
alias setWeapon [
    num = $arg1
    
//    Knife    0
    if (= $num 0) [
        melee
    ] [
//    Pist    1
    if (= $num 1) [
        secondary
    ] [
//    Cbine    2
    if (= $num 2) [
        primary
    ] [
//    Shot    3
    if (= $num 3) [
        primary
    ] [
//    subM    4
    if (= $num 4) [
        primary
    ] [
//    snipe    5
    if (= $num 5) [
        primary
    ] [
//    AR        6
    if (= $num 6) [
        primary
    ] [
//    nade    8
    if (= $num 8) [
        grenades
    ] [
//    akimbo    9
    if (= $num 9) [
        secondary
    ] [ ] ] ] ] ] ] ] ] ]
]
//END DIRECT SELECT

//SETCROSSHAIR
//This code block allows you to customize the size and shape
//of every crosshair for every weapon.  See instructions
//below under "Set CrosshairType"

alias sleepSetCrosshair [
    sleep 300 [setCrosshair]
]

alias setCrosshairAction [
    crosshairsize $arg1
    loadcrosshair $arg2
]
//END Crosshair Switcher by Verse
Thanks given by:
Woah! Fancy!
Your next step would be to make a menu for convenient in-game adjustments.
Thanks given by:
Ok then how do you return a value from a menu?
I"ve made some basic menus, but all the variables were static at runtime. Is it possible to dynamically change a variable after ac has started?
Thanks given by:
To change what a menu displays, you can use menuitemvar, menuitemtextinput, or menuitemslider. menuitemcheckbox displays a 1/0 variable in the form of a checked box.

To have a menu change variables in your script, just have the command that changes that variable as the command argument for any menuitem that has it.
Example:
menuitemslider [Crosshair size: ] 0 50 $crosshairsize 5 [] [crosshairsize $arg1]
The docs don't currently document menuitemslider's arguments, but they are this:
menuitemslider (description) (min) (max) (value to set slider to) (change increments) (list of things to display for each step) (command to execute on change)

The "list of things to display for each step" argument can be left blank to simply allow the numerical value to be displayed.

menuitemvar's description field can be based on cubescript evaluations. Its arguments are:
menuitemvar (evaluate and display) (command to execute when selected) (command to execute when hovered over)

menuitemkeyinput can be used to change keybinds in-game:
menuitemkeyinput (description of the command to be bound) (command to be bound)
Example:
menuitemkeyinput [Switch to grenades] [grenadesCustCrosshair]
Thanks given by:
Thanks V-Man, that is exactly what I was looking for.
Oh, will the settings be remembered from session to session? I suppose I will find out ;)
Thanks given by:
Well I've ran into a wall with the menu. This is my first real script and my guess is that I will have to come back to this problem when I understand more. That said, I realized that I don't really understand the menuitemslider.
menuitemslider [Crosshair size: ] 0 50 $crosshairsize 5 [] [crosshairsize $arg1]
The code above worked just fine and I was excited to start using it. But, when I tried to customize it, I failed. I am not sure if CS is unable to what I want it to do, or it's my inexperience that is hindering me.

...
newmenu "Knife"
    menuitemslider [Crosshair size: ] 0 50 [] 1 [] [Setting_Knife_Size 5]
    menuitem "close"    [closemenu "Knife"]

Setting_Knife_Size = [ alias size    $arg1]
Setting_Knife_Type = [ alias crosshairType   x-dot.png]


alias setCrosshair [
    //size
    alias size = 15
    alias crosshairType = 0
    //knife        0
    if (= 0 (curweapon)) [
        Setting_Knife_Size
        Setting_Knife_Type
    ] [
...
As the above code suggests I got down to a point in my trouble shooting where I was simply trying to pass the crosshair size argument as an int and not as a variable. It still would have no affect on the crosshair size.

Thanks given by:
Well, with that code, you don't set crosshairsize anywhere. Did you mean to write
Setting_Knife_Size = [ crosshairsize $arg1]
(although that wouldn't make much sense)
Thanks given by:
Looks like he wants to set an alias to store what the knife crosshairsize would be when knife is selected. Don't worry, Verse, you merely forgot to use the equals sign to define the alias in the menu. Happens to me all the time.
Also remember that you're wanting to set the crosshairsize in that later alias, so use the command "crosshairsize" and have the variable as its argument.

...
newmenu "Knife"
    menuitemslider [Crosshair size: ] 0 50 [] 1 [] [Setting_Knife_Size = $arg1] // Here is where the variable is set, use "=" or "alias"
    menuitem "close"    [closemenu "Knife"]

Setting_Knife_Type = [ alias crosshairType   x-dot.png]

alias setCrosshair [
    //size
    // alias size = 15 Commented out since it's orphaned now (as far as I can tell, perhaps it'll be used later?)
    // alias crosshairType = 0 Commented out because we're just about to define this via the command-style alias
    //knife        0
    if (= 0 (curweapon)) [
        crosshairsize $Setting_Knife_Size // Now we're telling crosshairsize to accept our variable
        Setting_Knife_Type
    ] [
...
Now when setCrosshair is executed, it will detect if the knife is the current weapon and, if so, change the crosshairsize to the variable defined in the menu, then use the command "Setting_Knife_Type" to save an alias called "crosshairType" containing "x-dot.png".

(and on a personal note, IMO having "1" as the step value would make it tedious to get from one end of the crosshairsize spectrum to the other.)
Thanks given by: