SA-MP Forums Archive
[help] Gate Closing - 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] Gate Closing (/showthread.php?tid=121255)



[help] Gate Closing - dclaw - 16.01.2010

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);



Re: [help] Gate Closing - dclaw - 16.01.2010

nobody know how do that?


Re: [help] Gate Closing - pagie1111 - 16.01.2010

Now why are you creating ANOTHER topic?


Re: [help] Gate Closing - dclaw - 16.01.2010

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

ontopic: You now?


Re: [help] Gate Closing - dclaw - 16.01.2010

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,,,


Re: [help] Gate Closing - Klutty - 16.01.2010

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


Re: [help] Gate Closing - dclaw - 16.01.2010

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?


Re: [help] Gate Closing - CuervO - 16.01.2010

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



Re: [help] Gate Closing - dclaw - 16.01.2010

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


Re: [help] Gate Closing - CuervO - 17.01.2010

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;
    }
}