Who knows about gate help
#1

I need help on the code gate. Someone help me please . I do the 2 work that it runs to generate error. Below is my code line.
Dowload : https://pastebin.com/B942CRiE
Reply
#2

Код:
Gate1 = CreateDynamicObject(19859, 1294.623168, -1862.670776, 13.796877, 0.000000, 0.000000, 0.000000);
SetTimer("Close", 1000, 1);
Gate2 = CreateDynamicObject(19859, 1297.616333, -1862.673706, 13.796883, 0.000000, 0.000000, 180.000000);
SetTimer("Close", 1000, 1);
And you can't have a function in a function, you can only call those functions in a function.
Reply
#3

Quote:
Originally Posted by zMason
Посмотреть сообщение
Код:
Gate1 = CreateDynamicObject(19859, 1294.623168, -1862.670776, 13.796877, 0.000000, 0.000000, 0.000000);
SetTimer("Close", 1000, 1);
Gate2 = CreateDynamicObject(19859, 1297.616333, -1862.673706, 13.796883, 0.000000, 0.000000, 180.000000);
SetTimer("Close", 1000, 1);
And you can't have a function in a function, you can only call those functions in a function.
Can you help me fix it? Because I just learn slowly so do not understand the principle of it.
Reply
#4

Alright, let's start with creating the gates, preferably create them closed:
Код:
#include <a_samp>
#include <Streamer>
#include <zcmd>

new Gate[2]; // Let's get straight to an array, an array can have multiple layers of data storage, depending on how much you need. In this case we need 2.
new bool:GateStatus[2]; // A bool(ean) can only be true or false, with this boolean we can see if the gate is open or not.

public OnGameModeInit()
{
	Gate[0] = CreateDynamicObject(19859, 1294.623168, -1862.670776, 13.796877, 0.000000, 0.000000, 0.000000); // We create the first gate, notice that the counting always starts from 0
	Gate[1] = CreateDynamicObject(19859, 1297.616333, -1862.673706, 13.796883, 0.000000, 0.000000, 180.000000); // Second gate
	return 1;
}

// Now lets open te gates with a simple command
CMD:gate(playerid)
{
	if(IsPlayerInRangeOfPoint(playerid,2.0,1296.8699,-1862.1085,13.7969))
	{
		if(GateStatus[0] == false) // To see if the gate is closed
		{
			GateStatus[0] = true; // Gate status is set to open
			MoveDynamicObject(Gate[0],1294.0632, -1862.6708, 13.7969,1.0,0.0000, 0.0000, 0.0000);
        }
        else
        {
        	GateStatus[0] = false;
        	MoveDynamicObject(Gate[0], 1294.623168,-1862.670776,13.796877,1.0,0.000000,0.000000,0.000000);
        }
        // The problem with having local variables to see if the gate is open or not is that local variables don't get to keep their value outside 
    }
}
I will let you open and close the second gate yourself, see if you can get it working.
Reply
#5

I want to make it automatically do not always need / gate in I want to enhance for my upcoming map. Please help me also not know about this auto gate. May you help sincerely thank you much.
Reply
#6

I don't have much time for now, hope this tutorial will do for you: https://sampforum.blast.hk/showthread.php?tid=279757

It explains everything about automating a gate
Reply
#7

Quote:
Originally Posted by zMason
Посмотреть сообщение
I don't have much time for now, hope this tutorial will do for you: https://sampforum.blast.hk/showthread.php?tid=279757

It explains everything about automating a gate
May you help or ask someone because I'm new to it so I can not understand it. I need something simple.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)