SA-MP Forums Archive
How to open barrier like this? - 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)
+--- Thread: How to open barrier like this? (/showthread.php?tid=640217)



How to open barrier like this? - Flaviu900 - 29.08.2017

How I can open barrier like this?




Re: How to open barrier like this? - Kane - 29.08.2017

https://sampwiki.blast.hk/wiki/MoveObject

Is that what you're looking for?


Re: How to open barrier like this? - Flaviu900 - 29.08.2017

Quote:
Originally Posted by Arthur Kane
Посмотреть сообщение
https://sampwiki.blast.hk/wiki/MoveObject

Is that what you're looking for?
Thanks for fast answer..
I try that but don't working.. I put like this:
MoveObject(pdgate1,1544.6992188,-1623.8994141,13.0000000,0.005,0.0000000,8.0000000, 265.9982300);

It's same..


Re: How to open barrier like this? - Kane - 29.08.2017

How doesn't it work? What happens?

(If you're using dynamic objects, use MoveDynamicObject.)


Re: How to open barrier like this? - Flaviu900 - 29.08.2017

Quote:
Originally Posted by Arthur Kane
Посмотреть сообщение
How doesn't it work? What happens?

(If you're using dynamic objects, use MoveDynamicObject.)
I'm just using this FilterScript, and when i write "/po" barrier open very very fast, not in motion..

Код:
// This is the Gates System with aumomatic Gates
// This filterscript is made by >>>(((   Joksa   )))<<<

#include <a_samp>

new lspdg;
new pdgate1;

forward GateClose(playerid);

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Gates System by Joksa >>>Is Loaded<<<");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print(" Gates System by Joksa >>>Is Loaded<<<");
	print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
pdgate1 = CreateObject(968,1544.6992188,-1623.8994141,13.0000000,0.0000000,88.0000000,265.9982300); // The gate is the PD garage
return 1;
}

public OnGameModeExit()
{
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/po", cmdtext, true, 10) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 15,1544.5923,-1627.1566,13.382)) // The gate is the PD garage
{
if(lspdg == 1) { SendClientMessage(playerid, 0xFF000000, "** The door is already open!"); return 1; }
MoveObject(pdgate1,1544.6992188,-1623.8994141,13.0000000,25.0,0.0000000,8.0000000,265.9982300);
SendClientMessage(playerid, 0xFF000000,"The door to the garage open, after 7 seconds it will automatically be lowered.");
SetTimer("GateClose", 7000, 0);
}
return 1;
}
return 0;
}

public GateClose(playerid)
{
      MoveObject(pdgate1, 1544.6992188,-1623.8994141,13.0000000,25.0,0.0000000,88.0000000,265.9982300); // The gate is the PD garage
      PlayerPlaySound(playerid, 1153, 1589.053344,-1638.123168,14.122960);
      lspdg = 0;
      return 1;
}



Re: How to open barrier like this? - Vince - 29.08.2017

The object needs to actually move position (not just rotation) for MoveObject to work correctly. So increase the Z-position by 0.01 or so when opening and decrease by 0.01 when closing.


Re: How to open barrier like this? - Flaviu900 - 29.08.2017

Quote:
Originally Posted by Vince
Посмотреть сообщение
The object needs to actually move position (not just rotation) for MoveObject to work correctly. So increase the Z-position by 0.01 or so when opening and decrease by 0.01 when closing.
It's a barrier, it's just going up and down, not moving :-/


Re: How to open barrier like this? - Hansrutger - 29.08.2017

Yes but try what Vince said and you will see what happens.


Re: How to open barrier like this? - Kane - 29.08.2017

He's not telling you to actually move it.



Read the first part.

(Hansrutger was faster, woops.)


Re: How to open barrier like this? - Flaviu900 - 29.08.2017

It's working!
Thank you all very much!
+rep