Thank you, but I think im the stupidest person on the world
So I need a bit help with this code...
I wanna make a closed door, wich I have to open with a key.
void OnStart()
{
AddUseItemCallback("", "Schluessel", "Schluesseltuer", "FUNCTION", true);
}
void FUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
RemoveItem(asItem);
SetSwingDoorClosed("door2", true, true);
}
So everything works... Thank god!
Then I wanna make this "breakdown" of this door for a scary moment.
Ive got the script and everythings fine.
So I tried to insert that "breakdown" code in the .hps file.
Im not sure how to insert it, because I get every time an error!
I tried it like this:
void OnStart()
{
AddUseItemCallback("", "Schluessel", "Schluesseltuer", "FUNCTION", true);
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
}
void FUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
RemoveItem(asItem);
SetSwingDoorClosed("door2", true, true);
}
{
void func_slam(string &in asParent, string &in asChild, int alState)
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(5.0f, true);
}
But I always got an error. The programm says:
Could not load script blablabla: (20,5):ERR: Unexpected token {
So I just deleted this "{" But another error:
(22,5) expected , or ;
(23,22) expected identifier
(23,81) expected identifier
(24,21) expected identifier
(26,1) unexpected token }
Then I just tried to copy the 2nd code just behind the 1st with and without braces, but it allways errors...
I just cant understand why it cant work!
Help again? I know Im annoying