I'll walk you through the mistakes then post a full revision
Spoiler below!
void OnStart()
{ <-----Extra bracket
( <---Here you used parentheses instead of a bracket
AddUseItemCallback("", "firstdoorkey", "firstdoor", "UsedKeyOnDoor", "true"); <----true should not be declared (in quotation marks)
) <---Here you used parentheses instead of a bracket
void MyFunc(string &in asItem, string &in asEntity) <---This function is MyFunc, but in the callback you used UsedKeyOnDoor
( <---Here you used parentheses instead of a bracket
SetSwingDoorLocked("firstdoor", false, true);
PlaySoundAtEntity("", "unlock_door", "firstdoor", 0, false);
RemoveItem("firstdoorkey");
) <---Here you used parentheses instead of a bracket
Finally, here's a full revision; copy and paste this into your hps file. Make sure to delete any previous contents: