Jump to content
  • 0

Porti automate (nu merg)


amaru

Question

Vroiam sa fac un tutorial "cum sa faci porti automate" si ca sa nu ma fac de cacao am zis sa incerc intai.  ;D

La compilare nu da nicio eroare, warn nimic, dar in joc nu merge.

#define FILTERSCRIPT

#include <a_samp>
#define SCM SendClientMessage
#define COLOR_BLUE 0x2641FEAA
forward inchidebariera(playerid);
forward inchidepoarta(playerid);
forward deschidepoarta(playerid);
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
new bariera;
new poarta;


public OnFilterScriptInit()
{
	bariera = CreateObject(968, 1544.695557, -1630.902100, 13.169105, 0.0000, 268.0403, 270.0000);
	poarta = CreateObject(980, 1588.003174, -1638.080078, 14.826468, 0.0000, 0.0000, 0.0000);
	return 1;
}

public inchidebariera(playerid)
{
	SetObjectRot(bariera, 0.0000, 268.0403, 270.0000);
	return 1;
}

public inchidepoarta(playerid)
{
	MoveObject(poarta, 1588.003174, -1638.080078, 14.826468, 5);
	return 1;
}
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
    if(IsPlayerConnected(playerid))
	{
		new Float:oldposx, Float:oldposy, Float:oldposz;
		new Float:tempposx, Float:tempposy, Float:tempposz;
		GetPlayerPos(playerid, oldposx, oldposy, oldposz);
		tempposx = (oldposx -x);
		tempposy = (oldposy -y);
		tempposz = (oldposz -z);
		//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
		if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
		{
			return 1;
		}
	}
	return 0;
}

public deschidepoarta(playerid)
{
    if (PlayerToPoint(15, playerid,1539.1755,-1627.4850,13.3828))
	{
      		SetObjectRot(bariera,0.0000, 0.0000, 270.0000);
      		SetTimerEx("inchidebariera", 5 * 1000, 0, "i", playerid);
      		SCM(playerid, COLOR_BLUE,"Bariera e deschisa si se va inchide in 5 secunde.");
	}
	else if (PlayerToPoint(15, playerid,1589.053344,-1638.123168,14.122960))
	{
      		MoveObject(poarta,1587.995850, -1638.034668, 9.452288,5);
      		SetTimerEx("inchidepoarta", 5 * 1000, 0, "i", playerid);
      		SCM(playerid, COLOR_BLUE,"Poarta e deschisa si se va inchide in 5 secunde.");
	}
	return 1;
}

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.