Toggle commands
#1

Hey.
I'm in the middle of my script making,and i was wondering...
Is it possible to toggle commands?
For example if i type /Elevator once it goes upstairs on and then i type /Elevator again and it gets downstairs..
Reply
#2

Top of script:
pawn Код:
new bool:IsElevatorUp=true;
(if its up, when gamemode starts. Else just turn the true into false)

Elevator command:
pawn Код:
//.......
{
if(IsElevatorUp==false)
{
//....MoveObjectUp.... lol XD
IsElevatorUp=true;
}
else
{
//....MoveObjectDown :P
IsElevatorUp=false;
}
}
Is it like you want it?!

#edit#: fixed

Cheers.
Reply
#3

Actually, the variable declaration (new bool:IsElevatorUp=true) has to be done at the top of the script, outside any callback, and the return mustn't be written.
Reply
#4

Quote:
Originally Posted by DeathOnaStick
Top of script:
pawn Код:
new bool:IsElevatorUp=true;
(if its up, when gamemode starts. Else just turn the true into false)

Elevator command:
pawn Код:
//.......
{
if(IsElevatorUp==false)
{
//....MoveObjectUp.... lol XD
IsElevatorUp=true;
}
else
{
//....MoveObjectDown :P
IsElevatorUp=false;
}
}
Is it like you want it?!

#edit#: fixed

Cheers.
Thanks for helping
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)