I have made a key that works for a door. But when I try to make a key to another another door, I get error. I do not know what I'm doing wrong.
This is the script
////////////////////////////
/ / Run first time starting map
void onStart ()
{
AddUseItemCallback ("", "the_key", "the_door", "KeyOnDoor", true);
}
void KeyOnDoor (string & in asItem, string & in asEntity)
{
SetSwingDoorLocked ("the_door", false, true);
PlaySoundAtEntity ("", "unlock_door", "the_door", 0, true);
RemoveItem ("the_key");
}
////////////////////////////
/ / Run first time starting map
void onStart ()
{
AddUseItemCallback ("", "key_2", "derect", "usedkeyondoor", true);
}
void usedkeyondoor (string & in asItem, string & in asEntity)
{
SetSwingDoorLocked ("derect", false, true);
PlaySoundAtEntity ("", "unlock_door", "derect", 0, true);
RemoveItem ("key_2");
}