08-03-2012, 05:01 AM
08-03-2012, 05:17 AM
The semicolon indicates that a line of code has ended. Therefore you should put it at the end of a line of code rather than at the start. Speaking of which, quotations are needed around Key_1 for RemoveItem.
08-03-2012, 09:26 AM
like what Chronofox said you have to put the ";" in the end of the line and not in front and you forgot to make some { and } so this should work:
void OnStart()
{
AddUseItemCallback("", "Key_1", "LockedDoor1", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("LockedDoor1", false, true);
RemoveItem("Key_1");
}
and you also need quotations for LockedDoor1 and Key_1 which I included in my code.
I hope this helps
void OnStart()
{
AddUseItemCallback("", "Key_1", "LockedDoor1", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("LockedDoor1", false, true);
RemoveItem("Key_1");
}
and you also need quotations for LockedDoor1 and Key_1 which I included in my code.
I hope this helps
08-03-2012, 10:32 PM
<removed><removed><removed><removed><removed>
08-03-2012, 11:12 PM
Create a key for each door? Or do you mean you need one key to unlock both doors?
08-03-2012, 11:43 PM
<removed><removed><removed><removed>
08-04-2012, 12:35 AM
void OnStart()
{
AddUseItemCallback("", "Key_2", "LockedDoor2", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("LockedDoor2", false, true);
RemoveItem("Key_2");
}
{
AddUseItemCallback("", "Key_2", "LockedDoor2", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("LockedDoor2", false, true);
RemoveItem("Key_2");
}
08-04-2012, 12:49 AM
<removed><removed><removed><removed>
08-04-2012, 12:36 PM
I think you did something worng the last time because this is really just how you do it:
void OnStart()
{
AddUseItemCallback("", "Key_1", "LockedDoor1", "UsedKeyOnDoor", true);
AddUseItemCallback("", "Key_2", "LockedDoor2", "KeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("LockedDoor1", false, true);
RemoveItem("Key_1");
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("LockedDoor2", false, true);
RemoveItem("Key_2");
}
void OnStart()
{
AddUseItemCallback("", "Key_1", "LockedDoor1", "UsedKeyOnDoor", true);
AddUseItemCallback("", "Key_2", "LockedDoor2", "KeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("LockedDoor1", false, true);
RemoveItem("Key_1");
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("LockedDoor2", false, true);
RemoveItem("Key_2");
}