$randweapons
Posted by HellRaz0r
Tuesday, January 09, 2007
Description: Title says it all


;$randweapons Or $randweapons(Num,Num) Or $randweapons(Num)
alias randweapons {  
  var %weapon1 shotgun, %weapon2 = crossbow, %weapon3 = sword, %weapon4 = mac10
  var %weapon5 glock, %weapon6 = paperclip, %weapon7 = stick, %weapon8 = knife
  var %weapon9 deagle, %weapon10 = pencil, %weapon11 = ak47, %weapon12 = brick
  var %weapon13 dagger, %weapon14 = 9mm-pistol, %weapon15 = crowbar

  if ($2) {
    var %total $r($1,$2)
    if (!%weapon [ $+ [ $1 ] ]) || (!%weapon [ $+ [ $2 ] ]) {
      echo -a Error: One or more of the numbers you entered doesnt correspond with any of your weapons.
      halt
    }
  }
  elseif ($1) {
    var %total $1
    if (!%weapon [ $+ [ $1 ] ]) {
      echo -a Error: The number you entered doesnt correspond with any of your weapons.
      halt
    }
  }
  else var %total 5

  var %x 1
  while (%x <= %total) {
    var %num $r(1,10), %weapon = %weapon [ $+ [ %num ] ]
    if %x != 1 && $istok(%weapons,%weapon,32) {
      while (1) {
        var %num $r(1,10), %weapon = %weapon [ $+ [ %num ] ]
        if (!$istok(%weapons,%weapon,32)) {
          var %weapons = %weapons %weapon
          var %skip 1
          break
        }
      }
    }
    if (!%skip) var %weapons = %weapons %weapon
    else unset %skip
    inc %x
  }

  if (%weapons) return $v1
}
Subject line
Posted by drakky
Tuesday, January 09, 2007 03:23am PST
Lole
Subject line
Posted by drakky
Tuesday, January 09, 2007 03:24am PST
Lole
aright
Posted by squirk
Tuesday, January 09, 2007 02:20pm PST
i dont really see the point of this but just to give a heads up, maybe look into tokens in order to simplify this
Subject line
Posted by HellRaz0r
Tuesday, January 09, 2007 05:18pm PST
Thought about using the token manipulation identifiers to do this but i would still need a loop to remove weapons which have already been chosen so its fine the way it is.

Its not anything special its just something i made when i was bored, got idea when my mate was making a slap script, it could be put to good use tho like in irpg's.
Submit a comment
Oops! You need to login or register before you can post a comment!

ebaum's world