[help] Gate Closing
#1

i got a command for my gate:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp("/opengate", cmdtext, true, 10) == 0)
	MoveObject(gate,-293.828,1507.450,76.070,1.5000); // 1.5000 means how fast it has to open
	return 1;
}
Its working perfect, but i want that he after 7 seconds close,
Some one can make that?
Code for closing:
Код:
MoveObject(gate,-302.628,1507.450,76.070,1.500);
Reply
#2

nobody know how do that?
Reply
#3

Now why are you creating ANOTHER topic?
Reply
#4

Quote:
Originally Posted by {Awaran};
Now why are you creating ANOTHER topic?
offtopic: just, this is about something other,,

ontopic: You now?
Reply
#5

Quote:
Originally Posted by dclaw
i got a command for my gate:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp("/opengate", cmdtext, true, 10) == 0)
	MoveObject(gate,-293.828,1507.450,76.070,1.5000); // 1.5000 means how fast it has to open
	return 1;
}
Its working perfect, but i want that he after 7 seconds close,
Some one can make that?
Code for closing:
Код:
MoveObject(gate,-302.628,1507.450,76.070,1.500);
Finee,,,
Reply
#6

I think you can do it via making a timer, if I'm not totally wrong.
Reply
#7

Quote:
Originally Posted by Klutty
I think you can do it via making a timer, if I'm not totally wrong.
how set a timer?
Reply
#8

You need to Forward the Function closegate, so you can Make the command...

pawn Код:
forward closegate();
Then, You make the Function... You make it to MoveObject the gate to the Original X,Y,Z...
pawn Код:
public closegate()
{
   MoveObject(gate,X,Y,Z, 1.5000);
   return 1;
}

Once, You can make the command... You set the timer... (1000 Milliseconds = 1 Second)
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmd, "/opengate", true) == 0)
    {
        MoveObject(gate,-293.828,1507.450,76.070,1.5000);
        SetTimer("closegate", 7000, false);
        return 1;
    }
}
And... Done...

For More Info Visit the Wiki

Functions Used:

MoveObject
SetTimer
Reply
#9

Quote:
Originally Posted by CueЯvo
You need to Forward the Function closegate, so you can Make the command...

pawn Код:
forward closegate();
Then, You make the Function... You make it to MoveObject the gate to the Original X,Y,Z...
pawn Код:
public closegate()
{
   MoveObject(gate,X,Y,Z, 1.5000);
   return 1;
}

Once, You can make the command... You set the timer... (1000 Milliseconds = 1 Second)
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmd, "/opengate", true) == 0)
    {
        MoveObject(gate,-293.828,1507.450,76.070,1.5000);
        SetTimer("closegate", 7000, false);
        return 1;
    }
}
And... Done...

For More Info Visit the Wiki

Functions Used:

MoveObject
SetTimer
Thank you
Reply
#10

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmd, "/opengate", true) == 0)
    {
        MoveObject(gate,-293.828,1507.450,76.070,1.5000);
        SetTimerEx("closegate", 7000, false, "i", playerid);
        return 1;
    }
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)