Moveable objects
#1

Anybody know how i would make a door open by pressing f? or enter?
Reply
#2

My example:

Код:
new gDoorLSPD[2];
new gDoorZone[2]; //for LSPD and SFPD
new gDoorStatus[2]; //for LSPD and SFPD

gDoorLSPD[0] = CreateDynamicObject(1495,244.987503, 72.491752, 1002.589904, 0.000000, 0.000000, 0.000000, 30);
	gDoorLSPD[1] = CreateDynamicObject(1495,247.984191, 72.491752, 1002.589904, 0.000000, 0.000000, 180.0, 30);

forward MoveLSPDDoors();
public MoveLSPDDoors()
{
	if(!gDoorStatus[0]) return 1;
	
	MoveDynamicObject(gDoorLSPD[0], 244.987503, 72.491752, 1002.589904, 0.3);
	MoveDynamicObject(gDoorLSPD[1], 247.987503, 72.491752, 1002.589904, 0.3);
	gDoorStatus[0] = 0;
	
	return 1;
}

if(!IsPlayerInAnyVehicle(playerid) && (newkeys & KEY_SECONDARY_ATTACK))
	{
		if(IsPlayerInDynamicArea(playerid, gDoorZone[0]))
		{
			if(!CopKeys[playerid] && !IsPlayerCop(playerid)) return SendClientMessage(playerid, COLOR_GREY, " You no have a keys");
		
			if(IsDynamicObjectMoving(gDoorLSPD[0]) || IsDynamicObjectMoving(gDoorLSPD[1])) return SendClientMessage(playerid, COLOR_GREY, " Doors moving!");
		
			if(!gDoorStatus[0])
			{
				MoveDynamicObject(gDoorLSPD[0], 243.987503, 72.491752, 1002.589904, 0.3);
				MoveDynamicObject(gDoorLSPD[1], 248.987503, 72.491752, 1002.589904, 0.3);
				gDoorStatus[0] = 1;
				SetTimer("MoveLSPDDoors", 10000, 0);
			}
			else
			{
				MoveDynamicObject(gDoorLSPD[0], 244.987503, 72.491752, 1002.589904, 0.3);
				MoveDynamicObject(gDoorLSPD[1], 247.987503, 72.491752, 1002.589904, 0.3);
				gDoorStatus[0] = 0;
			}
		}
	}
Reply
#3

Quote:
Originally Posted by povargek
Посмотреть сообщение
My example:

Код:
new gDoorLSPD[2];
new gDoorZone[2]; //for LSPD and SFPD
new gDoorStatus[2]; //for LSPD and SFPD

gDoorLSPD[0] = CreateDynamicObject(1495,244.987503, 72.491752, 1002.589904, 0.000000, 0.000000, 0.000000, 30);
	gDoorLSPD[1] = CreateDynamicObject(1495,247.984191, 72.491752, 1002.589904, 0.000000, 0.000000, 180.0, 30);

forward MoveLSPDDoors();
public MoveLSPDDoors()
{
	if(!gDoorStatus[0]) return 1;
	
	MoveDynamicObject(gDoorLSPD[0], 244.987503, 72.491752, 1002.589904, 0.3);
	MoveDynamicObject(gDoorLSPD[1], 247.987503, 72.491752, 1002.589904, 0.3);
	gDoorStatus[0] = 0;
	
	return 1;
}

if(!IsPlayerInAnyVehicle(playerid) && (newkeys & KEY_SECONDARY_ATTACK))
	{
		if(IsPlayerInDynamicArea(playerid, gDoorZone[0]))
		{
			if(!CopKeys[playerid] && !IsPlayerCop(playerid)) return SendClientMessage(playerid, COLOR_GREY, " У вас нет ключей");
		
			if(IsDynamicObjectMoving(gDoorLSPD[0]) || IsDynamicObjectMoving(gDoorLSPD[1])) return SendClientMessage(playerid, COLOR_GREY, " Двери еще не закончили движение!");
		
			if(!gDoorStatus[0])
			{
				MoveDynamicObject(gDoorLSPD[0], 243.987503, 72.491752, 1002.589904, 0.3);
				MoveDynamicObject(gDoorLSPD[1], 248.987503, 72.491752, 1002.589904, 0.3);
				gDoorStatus[0] = 1;
				SetTimer("MoveLSPDDoors", 10000, 0);
			}
			else
			{
				MoveDynamicObject(gDoorLSPD[0], 244.987503, 72.491752, 1002.589904, 0.3);
				MoveDynamicObject(gDoorLSPD[1], 247.987503, 72.491752, 1002.589904, 0.3);
				gDoorStatus[0] = 0;
			}
		}
	}
where is your dynamic area
Reply
#4

Quote:
Originally Posted by Saliim
Посмотреть сообщение
where is your dynamic area
Near door

Код:
gDoorZone[0] =  CreateDynamicSphere(244.987503, 72.491752, 1002.589904, 3.0, 30);
	gDoorZone[1] =  CreateDynamicSphere(239.576156, 117.520126, 1002.239562, 3.0, 30);
Reply
#5

Is there a stock for the dynamic moving though cause no matter how i try to set them up its saying invalid function
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)