| 
		
	
		| Ninami   Member
 
 Posts: 59
 Threads: 6
 Joined: Feb 2012
 Reputation: 
2
 | 
			| Script to add message to a locked swing door 
 
				Hey guys, been searching quite a while for a solution but I can't find it.
 I have a swing door in a room which is locked. When you try to open it I want a message to appear, something like "The door is locked".
 
 I tried the "SetLevelDoorLockedText" but I learned that it only works on level doors.
 
 What do I script in order to do the exact same thing, but on swing doors?
 
 Cheers Ninami
 Now I tried adding:
 
 SetEntityPlayerInteractCallback("Door_1", "LockedDoor", false);
 
 
 void LockedDoor(string &in asEntity)
 {
 SetMessage("Messages", "DoorLocked", 2);
 }
 
 But nothing happens when I interact with the door.
 
 AND, if this would work, it still would show the message even though the door was unlocked...right?
 
				
(This post was last modified: 02-04-2012, 01:43 PM by Ninami.)
 |  |  
	| 02-04-2012, 11:14 AM |  |  
	
		| SilentStriker   Posting Freak
 
 Posts: 950
 Threads: 26
 Joined: Jul 2011
 Reputation: 
43
 | 
			| RE: Script to add message to a locked swing door 
 
				 (02-04-2012, 11:14 AM)Ninami Wrote:  Hey guys, been searching quite a while for a solution but I can't find it.
 I have a swing door in a room which is locked. When you try to open it I want a message to appear, something like "The door is locked".
 
 I tried the "SetLevelDoorLockedText" but I learned that it only works on level doors.
 
 What do I script in order to do the exact same thing, but on swing doors?
 
 Cheers Ninami
 Now I tried adding:
 
 SetEntityPlayerInteractCallback("Door_1", "LockedDoor", false);
 
 
 void LockedDoor(string &in asEntity)
 {
 SetMessage("Messages", "DoorLocked", 2);
 }
 
 But nothing happens when I interact with the door.
 
 AND, if this would work, it still would show the message even though the door was unlocked...right?
 Here's the one i use it's for a level door but i guess it will work the same    void OnStart(){
 SetLocalVarInt("DoorLocked", 1);
 SetEntityPlayerInteractCallback("NAMEOFDOORHERE", "TextLockedDoor", false);
 }
 
 void TextLockedDoor(string &in asEntity)
 {
 if(GetLocalVarInt("DoorLocked") == 1){
 SetMessage("Message", "NAMEOFENTRY", 3);
 }
 }
 
 |  |  
	| 02-04-2012, 12:55 PM |  |  
	
		| Ninami   Member
 
 Posts: 59
 Threads: 6
 Joined: Feb 2012
 Reputation: 
2
 | 
			| RE: Script to add message to a locked swing door 
 
				Yeah I did this recently: SetEntityPlayerInteractCallback("Door_1", "LockedDoor", false);void LockedDoor(string &in asEntity)    {        if(GetSwingDoorLocked("Door_1") == true)        {            SetMessage("Messages", "DoorLocked", 2);        }    }
But it wont work, it doesn't show any message, I think something else is wrong. 
			 |  |  
	| 02-04-2012, 12:58 PM |  |  
	
		| SilentStriker   Posting Freak
 
 Posts: 950
 Threads: 26
 Joined: Jul 2011
 Reputation: 
43
 | 
			| RE: Script to add message to a locked swing door 
 
				 (02-04-2012, 12:58 PM)Ninami Wrote:  Yeah I did this recently:
 
 SetEntityPlayerInteractCallback("Door_1", "LockedDoor", false);void LockedDoor(string &in asEntity)    {        if(GetSwingDoorLocked("Door_1") == true)        {            SetMessage("Messages", "DoorLocked", 2);        }    }
 But it wont work, it doesn't show any message, I think something else is wrong.
 Have you named the door Door_1 and checked so everything is correct?
			 
 |  |  
	| 02-04-2012, 01:00 PM |  |  
	
		| Ninami   Member
 
 Posts: 59
 Threads: 6
 Joined: Feb 2012
 Reputation: 
2
 | 
			| RE: Script to add message to a locked swing door 
 
				Yeah I've checked it more than 5 times haha    
The door name is "Door_1". I just don't have a single clue what's wrong...
			 |  |  
	| 02-04-2012, 01:01 PM |  |  
	
		| SilentStriker   Posting Freak
 
 Posts: 950
 Threads: 26
 Joined: Jul 2011
 Reputation: 
43
 | 
			| RE: Script to add message to a locked swing door 
 
				 (02-04-2012, 12:58 PM)Ninami Wrote:  Yeah I did this recently:
 
 SetEntityPlayerInteractCallback("Door_1", "LockedDoor", false);void LockedDoor(string &in asEntity)    {        if(GetSwingDoorLocked("Door_1") == true)        {            SetMessage("Messages", "DoorLocked", 2);        }    }
 But it wont work, it doesn't show any message, I think something else is wrong.
 and use my script for the door instead of the one you wrote because GetSwingDoorLocked isn't working
			 
 |  |  
	| 02-04-2012, 01:04 PM |  |  
	
		| Ninami   Member
 
 Posts: 59
 Threads: 6
 Joined: Feb 2012
 Reputation: 
2
 | 
			| RE: Script to add message to a locked swing door 
 
				Tbh I don't really understand your code, is it really complete?
 I mean, if the door is locked then the VAR is 1, but if it gets unlocked, it's still 1, right?
 
 Don't I need another code for when I unlock the door AddLocalVarInt("DoorLocked", 1); so when it's unlocked it doesn't show the message?
 
 Maybe I'm totally wrong, I just don't understand otherwise :/
 |  |  
	| 02-04-2012, 01:13 PM |  |  
	
		| SilentStriker   Posting Freak
 
 Posts: 950
 Threads: 26
 Joined: Jul 2011
 Reputation: 
43
 | 
			| RE: Script to add message to a locked swing door 
 
				 (02-04-2012, 01:13 PM)Ninami Wrote:  Tbh I don't really understand your code, is it really complete?
 I mean, if the door is locked then the VAR is 1, but if it gets unlocked, it's still 1, right?
 
 Don't I need another code for when I unlock the door AddLocalVarInt("DoorLocked", 1); so when it's unlocked it doesn't show the message?
 
 Maybe I'm totally wrong, I just don't understand otherwise :/
 oh yea i forgot one part    put this in a code when it's going to unlock SetLocalVarInt("DoorLocked", 0);
 
I totally forgot that i used that in a puzzle xD
			 
 |  |  
	| 02-04-2012, 01:33 PM |  |  
	
		| Ninami   Member
 
 Posts: 59
 Threads: 6
 Joined: Feb 2012
 Reputation: 
2
 | 
			| RE: Script to add message to a locked swing door 
 
				Haha I'm just impressed that I understood xD 
But still wont work, since the .lang file or whatever is fucked up somehow, like I said on the other thread    |  |  
	| 02-04-2012, 01:42 PM |  |  |