Door Opening

I’m trying to make a door open when the player has a certain weapon but I have to slash the door npc when I get the weapon.
Door-

if(hasweapon(-key1)){ hide; }
Weapon-

if(playertouchsme){ toweapons -key1; }

[QUOTE=Mewt;109452]
I’m trying to make a door open when the player has a certain weapon but I have to slash the door npc when I get the weapon.
Door-

if(hasweapon(-key1)){ hide; }
Weapon-

if(playertouchsme){ toweapons -key1; }
[/QUOTE]

Yes, this is because you’re not specifying an event as such to initialise the check. The only reason the door opens when you slash is because of how gs1 is ran by the client. It’ll also open if you enter the level with the weapon already on your player.

To fix this, simply add the playertouchsme event.

if (playertouchsme){
  if (hasweapon(-key1)){
    hidelocal;//hide the door only for the player touching, not for everyone
  }
  else {
    message *locked*;
  }
  sleep 1;
  message ;
  showlocal;
}

As a bonus, you’ll notice I added showlocal and hidelocal, you should make use of these if you intend on having multiple players in the one level as then such commands are strictly clientside(only your client/player) meaning they won’t affect other players/clients.

ohhh I see thanks alot man!

Why do you always share codes with errors in them, Tricxta?

[QUOTE=Spooon;109455]Why do you always share codes with errors in them, Tricxta?[/QUOTE]
I think he just forgot to put in the bracket.

Half of the doors on my server don’t work and will never work

[QUOTE=Mewt;109456]I think he just forgot to put in the bracket.[/QUOTE]

Yes, you’re correct. Sorry.

Merged doublepost_______________

[QUOTE=Spooon;109455]Why do you always share codes with errors in them, Tricxta?[/QUOTE]

I forget to double check what I’ve written. So a lot of things skip my attention.

[QUOTE=Mewt;109456]I think he just forgot to put in the bracket.[/QUOTE]

Glad to see you didn’t just use his code without looking at it.

[QUOTE=dylan;109457]Half of the doors on my server don’t work and will never work[/QUOTE]

There’s no need for this, I shall fix the problem in a highly agile responsive Microsoft inspired way.

Broken doors is a valid server theme. Much like throwable chairs.

[QUOTE=VariousWeapon;109460]There’s no need for this, I shall fix the problem in a highly agile responsive Microsoft inspired way.[/QUOTE]

Please post results.