Frictional Games Forum (read-only)

Full Version: On, Off Button
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I need a little help. When I push the button, the lamp gets on. But when I push it again it will just stay on, insteadt off. What do I need to add/change?

PHP Code:
void OnStart()
{
SetLocalVarInt("Var1"0);
SetEntityPlayerInteractCallback("button1""func1"false);
}


void func1(string &in asEntity)
{
AddLocalVarInt("Var1"1);
    
SetLampLit("bonfire1"truetrue);
    
PlaySoundAtEntity("""spot.snt""bonfire1"0.5ffalse);

(03-02-2013, 03:57 AM)User01 Wrote: [ -> ]I need a little help. When I push the button, the lamp gets on. But when I push it again it will just stay on, insteadt off. What do I need to add/change?

PHP Code:
void OnStart()
{
SetLocalVarInt("Var1"0);
SetEntityPlayerInteractCallback("button1""func1"false);
}


void func1(string &in asEntity)
{
AddLocalVarInt("Var1"1);
    
SetLampLit("bonfire1"truetrue);
    
PlaySoundAtEntity("""spot.snt""bonfire1"0.5ffalse);


Use this :
PHP Code:
void OnStart()
{
SetEntityPlayerInteractCallback("button1""func1"false);
}


void func1(string &in asEntity)
{
    
SetLampLit("bonfire1"truetrue);
    
PlaySoundAtEntity("""spot.snt""bonfire1"0.5ffalse);
    
SetEntityPlayerInteractCallback("button1""func2"false);
}

void func2(string &in asEntity)
{
    
SetLampLit("bonfire1"falsetrue);
    
PlaySoundAtEntity("""///////YOUR SOUND////////""bonfire1"0.5ffalse);
    
SetEntityPlayerInteractCallback("button1""func1"false);


I changed the script to make it loop(When you press the button, it goes off. When you press it again, it goes on. And so on).
Thank you Heart
Your are very welcomeSmile