#1

I am scripting a door for an interior. I have added the object, and added a command, /door. But I want to make it so if the door is closed, the door will open with /door, and if it is open, the door will close with /door.
Reply
#2

pawn Код:
new door;

public OnGameModeInit()
{
door = CreateObject(....)
return 1;
}

public OnPlayerCcommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/opendoor", true) == 0)
{
MoveObject(door, ....)
return 1;
}

return 0;
}
Reply
#3

Quote:
Originally Posted by ViruZZzZ_ChiLLL
pawn Код:
new door;

public OnGameModeInit()
{
door = CreateObject(....)
return 1;
}

public OnPlayerCcommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/opendoor", true) == 0)
{
MoveObject(door, ....)
return 1;
}

return 0;
}
I already have this, but how do I make it so if I type /door and the door is ALREADY OPEN, it will CLOSE. and then if it's ALREADY CLOSED, it will OPEN. Get what I'm saying? I think it will involve:

new DoorOpen = 1;
new DoorOpen = 0;

but I'm not sure how I will use it to put it all together.
Reply
#4

Top of script:

Код:
new DoorOpened;
Put in command:

Код:
if(DoorOpened == 1)
{
close door...
}
if(DoorOpened == 0)
{
open door...
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)