Staff Hud-Fixed

Here’s the supposed fix for the staff hud. I rescripted almost everything saving a few fragments.
The only real difference in performance is I added a conflict feature so it’ll not allow use of conflicting tools at the same time.
This being clickjail and clickdrag.

The main weapon, this will only be provided to staff:

// NPC made by tricxta
if (playerenters){
  if (!isweapon)toweapons -staffHud;
  setstring this.img,riley_alexadmintoolgui-edit.gif;//image used
  setarray this.on,6;//array of options toggled
  this.conflict = {3,5};//options that conflict with each other
  if (strequals(#s(client.staffguild), ))
    setstring client.staffguild,Admin;
  //Define this. Put the name of the guild you want set when you set your staff tag. If the guild is named "Admin" put Admin.

  this.bootsSpeed = {0,10};//min,max

  timeout = 0.05;
}

if (mousedown && isweapon){
  if (mousescreenx in |this.placeC[0]+11,this.placeC[0]+249| && mousescreeny in |this.placeC[1]+19,this.placeC[1]+57|){
    for (this.i = 0; this.i < 6; this.i++){
      if (this.i == 1 && this.on[0] == 1){//boot speed
        for (this.b = 0; this.b < 2; this.b++){
          this.checkC = {this.placeC[0]+52+this.b*17,this.placeC[1]+39};
          if (mousescreenx in |this.checkC[0],this.checkC[0]+16| && mousescreeny in |this.checkC[1],this.checkC[1]+16|)
            this.bootSpeed = max(this.bootsSpeed[0],min(this.bootsSpeed[1],this.bootSpeed-vecy(this.b*2)));
        }
      }
      else {
        this.checkX = this.placeC[0]+11+this.i*41-(this.i > 1)*5;
        if (mousescreenx in |this.checkX,this.checkX+38|){
          this.on[this.i] = (this.on[this.i]+1)%2;
          if (this.i in this.conflict && this.on[this.i] == 1){//turn off all other tools that conflict
            for (this.t = 0; this.t < arraylen(this.conflict);this.t++){
              if (this.i == this.conflict[this.t])continue;
              this.on[this.conflict[this.t]] = 0;
            }
          }

          if (this.i == 4)admin();

        }
      }
    }
    timeout = 0.05;
  }
  else{
    if (this.on[3] == 1)//jailer
      getTarget();
    setshootparams clickJail,#a(this.target);
    shoot -10,-10,0.05,0.05,0.05,0.05,,,,,;
  }
}

if (timeout && isweapon){
  this.placeC = {0,screenheight-89};

  showimg 300,#s(this.img),this.placeC[0],this.placeC[1];
  changeimgpart 300,0,89,260,77;
  changeimgvis 300,4;

  //dragging
  if (leftmousebutton && this.on[5] == 1){
    if (!lmb){
      getTarget();
      set lmb;
    }
    moveTarget();
  }
  else {
    unset lmb;
    this.target = -1;
  }

  for (this.i = 0; this.i < 6; this.i++){
    if (this.i == 1){//boot options
      if (this.on[0] == 0){hideimgs 301,303; hideimg 305;}
      else {
        showtext 305,this.placeC[0]+69,this.placeC[1]+29,arial,cb,#v(this.bootSpeed);
        changeimgzoom 305,0.5;
        changeimgvis 305,5;

        for (this.b = 0; this.b < 2; this.b++){
          if (this.bootSpeed == this.bootsSpeed[1-this.b]){
            showimg 301+this.b,#s(this.img),this.placeC[0]+52+this.b*17,this.placeC[1]+39;
            changeimgpart 301+this.b,52+this.b*17,65,17,20;
            changeimgvis 301+this.b,5;
          }
          else hideimg 301+this.b;
        }
      }
    }
    else if (this.on[this.i] == 0)
      hideimg 304+this.i;

    else {
      this.placeX = this.placeC[0]+11+this.i*41-(this.i > 1)*5;
      showimg 304+this.i,#s(this.img),this.placeX,this.placeC[1]+19;
      changeimgpart 304+this.i,11+this.i*41-(this.i>1)*5,46,39,40;
      changeimgvis 304+this.i,5;

      if (this.i == 0)boots();
      else if (this.i == 2)stealth();
    }
  }

  timeout = 0.05;
}

function boots(){
  for (this.k = 0; this.k < 4; this.k++){
    if (keydown(this.k)){
      playerx += vecx(this.k)*this.bootSpeed;
      playery += vecy(this.k)*this.bootSpeed;
    }
  }
}

function stealth(){
  hideplayer .05;
  setani stealth,;
  putleaps 1,playerx+.5,playery+.5;
}

function admin(){
  if (this.on[4] == 1){
    playerap = 100;
    triggeraction 0,0,gr.setguild,#s(client.staffguild),#a;
  }
  else {
      playerap = 60;
      setplayerprop #c,setnick #e(0,indexof(#s(client.staffguild),#n),#n);
      sleep 0.1;
      setplayerprop #c, ;
  }
}

function getTarget(){
  this.target = -1;
  for (this.j=0;this.j<playerscount;this.j++) {
    if (abs(players[this.j].x+3-mousex) in |0,3| && abs(players[this.j].y+3-mousey) in |0,3|) {
      this.target = this.j;
      this.j = playerscount;
    }
  }
}

function moveTarget() {
  if (this.target < 0) return;
  this.dx += mousex-this.omousex;
  this.dy += mousey-this.omousey;
  setshootparams clickDrag,#a(this.target),#v(this.dx),#v(this.dy);
  shoot -10,-10,0.05,0.05,0.05,0.05,,,,,;
  this.omousex = mousex;
  this.omousey = mousey;
}

And the supporting weapon which will allow you to drag players and jail them. You give this to everyone.

if (playerenters){
  if (!isweapon)toweapons -toolSupport;
  setstring this.jailLevel,jail.nw,30,30;
}

if (actionprojectile || actionprojectile2) {
  if (strequals(#p(2),clickDrag) && strequals(#p(3),#a)) {
    freezeplayer 0.3;
    setani idle,;
    playerx = strtofloat(#p(4));
    playery = strtofloat(#p(5));
  }
  else if (strequals(#p(2),clickJail) && strequals(#p(3),#a)){
    setlevel2 #I(this.jailLevel,0),strtofloat(#I(this.jailLevel,1)),strtofloat(#I(this.jailLevel,2));
  }
}

Let the pw abuse commence!

how would i add it to my server?

Copy paste both code fragments into 2 separate npcs(one for each). Then save and enter that level while on your server. After that it’ll appear in your attributes where you can copy the name of the weapon and put it in other peoples accounts.

i did that and i went into the rc and went to my weapons and saw it was in there but the gui or pic of it is not showing up for me so do i need to add the pic to my server or it should just be in there?

yes, download the picture of these forums, I don’t know if it retains its gif file form, the forums might be evil. After that, place it in your world/images/ folder, restart your client if you’re logged on and you should be able to see it.

Any link to the missing image?

It’s an attachment o_0

Then I must be dumb I can’t find it

sigh

Ok I thought this was a preview of the final product and that multiple gifs were needed.

However I’m trying this on my server and it won’t seem to appear in my inventory.[COLOR=“Silver”]

---------- Post added 2013-04-28 at 12:20 AM ---------- Previous post was 2013-04-27 at 11:10 PM ----------

[/COLOR]Thx for the link

Sorry for the dumb questions.

Your Staff Hud is really awesome!
Good job!!!

-_-

Quick suggestion if you ever plan on working on improving this:
Adding a button to update levels.

Thx again!

For that to happen means I’d have to update the skin. Which means I’d need to redraw the entire skin, RileyFiery is quite touchy about his work and will not allow any continuation of it. I don’t have the time or motivation to add a button for such lazyness.:munch:

Is there a saw to remove the wierd bush sounds and the leaves when I go in stealth? Also in stealth it shows the player’s name, can this be fixed?

I noticed on Bomber Arena it hides player’s names during a round.

Staff Hud-Fixed

To remove the bush sounds just double tap the NPC and remove the line of code that brings it up, nothing too difficult.

You shouldn’t remove the leaves, keep in mind that other players don’t see them and they are there so that you know where you are on the map and not just invisible.

I’m not sure about the name. You’ll have to ask tricx about that.

I wanted to change the leap and add something so it doesn’t leap so often but I didn’t have permission to the weapon folder… I should be able to do that now but I don’t know about the name.

To hide a player’s name, you can either set your nickname to a single invisible character using alt codes or you can disable nicknames display all together and write your own support it.

I’d say just go for the invisible character method using the alt code 0160

Bomber Arena disabled the display of nicknames.

enablefeatures allfeatures - 0x200;

So, does this disable nicknames?
If not do you have access to the bomber arena scripts?

Yes and yes.