Time Sync To Traffic Lights Help
#1

Hello, So im trying to sync my traffic lights to my Gates that Lower and lift on a timer, now im not soo good at maths, nor do i know how to do this, so if anyone could please help me that would be GREAT!
Now this is my timer:
Quote:

new drag1;
new drag2;
new DragPos;

Quote:

public OnGameModeInit()
{
SetTimer("Drag",10*1000,1);
DragPos = 0;
drag1 = CreateObject(970, -172.43, 1409.84, 66.71, 0.00, 0.00, 90.00);
drag2 = CreateObject(970, -172.43, 1404.64, 66.71, 0.00, 0.00, 90.00);

Quote:

}
forward Drag();
public Drag()
{
switch(DragPos)
{
case 0:
{
MoveObject(drag1, -172.43, 1409.84, 65.87 , 5.00);
MoveObject(drag2, -172.43, 1404.64, 65.87 , 5.00);
DragPos ++;
return 1;
}
case 1:
{
MoveObject(drag1, -172.43, 1409.84, 66.71 , 5.00);
MoveObject(drag2, -172.43, 1404.64, 66.71 , 5.00);
DragPos = 0;
return 1;
}
}
return 1;
}

Now The Timer Works Great (thanks to DaRk_RaiN)
So i want the timer to sync to the traffic lights
the traffic lights stay on for about 32 seconds
Red - 20 seconds
Yellow - 2 seconds
Green - 10 seconds
Some Screenshots of what i mean:
http://imgur.com/IxnQFtr&zEvGTYI&pzC4fuS#0
http://imgur.com/IxnQFtr&zEvGTYI&pzC4fuS#1
http://imgur.com/IxnQFtr&zEvGTYI&pzC4fuS#2
I know this is kinda hard, but ANY HELP is Greatly appreciated
Reply
#2

What I would suggest you to do is have 2 timers and a stock function
first timer is for the red and yellow light which will be 22000 miliseconds
and the second timer for the green light will be 10000 miliseconds
and a stock function to close/open gates.

Once the first timer is over open the gate and start the next timer.
once the second timer is over close the gate and start the first timer.


Didnt really understood what you needed so hope this helps
Reply
#3

Quote:
Originally Posted by Edix
Посмотреть сообщение
What I would suggest you to do is have 2 timers and a stock function
first timer is for the red and yellow light which will be 22000 miliseconds
and the second timer for the green light will be 10000 miliseconds
and a stock function to close/open gates.

Once the first timer is over open the gate and start the next timer.
once the second timer is over close the gate and start the first timer.


Didnt really understood what you needed so hope this helps
Dam, didnt think of this, will try it, im new to scripting so i dont know how this is going to turn out
Reply
#4

Hmm im soo confused, i made 2 timers one for Yellow and Red, i set the timer for 2 sec on the yellow, and its just going up and down every 2 sec, reckon anyone could give me some help? like some code?
Reply
#5

Bump, i need help please
Reply
#6

Traffic lights are client sided, which means that they could show different colors for different players, which in turn means that what you're trying to do is near impossible.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)