Help! - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help! (
/showthread.php?tid=149661)
Help! -
TKZ227 - 23.05.2010
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.
Re: Help! -
ViruZZzZ_ChiLLL - 23.05.2010
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;
}
Re: Help! -
TKZ227 - 23.05.2010
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.
Re: Help! -
coole210 - 23.05.2010
Top of script:
Put in command:
Код:
if(DoorOpened == 1)
{
close door...
}
if(DoorOpened == 0)
{
open door...
}