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.
  • Similar Content

    • By GamerulFOX
      Salut ! Nu merge o verificare ! Daca acel player, are acei bani, ii ofera mesajul "Acel jucator nu are suficienti lei pentru a platii amenda" ! Ce am facut gresit ?


      CMD:amenda(playerid, params[])
      {
          new id, amenda, string[256], Float:x, Float:y, Float:z, name[MAX_PLAYER_NAME];
          GetPlayerName(playerid, name, sizeof(name));
          GetPlayerPos(id, x, y, z);
          if(fPolitie[playerid] == 0) return SendClientMessage(playerid, RED, "Nu esti din factiunea 'Politie' !");
          if(sscanf(params, "ud", id, amenda)) return SendClientMessage(playerid, 0xff0000FF, "/amenda <playerid/name> <amount>");
          if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SCM(playerid, 0xff0000FF, "Acel jucator nu este conectat!");
          if(!IsPlayerInRangeOfPoint(playerid, 2.0, x, y ,z)) return SendClientMessage(playerid, 0xff0000FF, "Nu esti langa acel player!");
          if(GetPlayerMoney(id) != amenda) return SendClientMessage(playerid, 0xff0000FF, "Acel jucator nu are suficienti lei pentru a platii amenda!");
          GivePlayerMoney(id, -amenda);
          format(string, sizeof(string), "Ai fost amendat de politistul %s!", name);
          SendClientMessage(id, 0x00aeffFF, string);
          return 1;
      }
    • By GamerulFOX
      CMD:cursataxi(playerid, params[]) {     new id, bani, string[256], string1[256], name[MAX_PLAYER_NAME], name1[MAX_PLAYER_NAME];     GetPlayerName(playerid, name, sizeof(name));     GetPlayerName(id, name1, sizeof(name1));     if(sscanf(params, "ud", id, bani)) return SendClientMessage(playerid, SYNTAX, "/cursataxi <playerid/name> <amount>");     new Float:x, Float:z, Float:y;     GetPlayerPos(id, Float:x, Float:y, Float:z);     if(fTaxi[playerid] == 0) return SendClientMessage(playerid, 0xff0000FF, "Nu esti din factiunea 'Taxi' !");     if(!IsPlayerInVehicle(playerid, cTaxi[0])) return SendClientMessage(playerid, 0xff0000FF, "Nu esti in masina de taxi !");     if(!IsPlayerInVehicle(playerid, cTaxi[1])) return SendClientMessage(playerid, 0xff0000FF, "Nu esti in masina de taxi !");     if(!IsPlayerInVehicle(playerid, cTaxi[2])) return SendClientMessage(playerid, 0xff0000FF, "Nu esti in masina de taxi !");     if(!IsPlayerInRangeOfPoint(playerid, 2.0, x, y, z)) return SendClientMessage(playerid, 0xff0000FF, "Nu esti langa acel player!");     if(GetPlayerMoney(id) < bani) return SendClientMessage(playerid, 0xff0000FF, "Acel player nu are suficienti lei pentru a platii cursa!");     if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SCM(playerid, 0xff0000FF, "Acel jucator nu este conectat!");     format(string, sizeof(string), "Iai oferit o cursa lui %s, pentru %d lei!", name1, bani);     SendClientMessage(playerid, 0x00aeffFF, string);     format(string1, sizeof(string1), "Taximetristul %s ti-a oferit o cursa pe %d lei!", name, bani);     SendClientMessage(playerid, 0x10d4deff, string);     GivePlayerMoney(id, -bani);     GivePlayerMoney(playerid, bani);     return 1; } VREAU SA MENTIONEZ CA AM INCERCAT SI ASA CMD:cursataxi(playerid, params[]) {     new id, bani, string[256], string1[256], name[MAX_PLAYER_NAME], name1[MAX_PLAYER_NAME];     GetPlayerName(playerid, name, sizeof(name));     GetPlayerName(id, name1, sizeof(name1));     if(sscanf(params, "ud", id, bani)) return SendClientMessage(playerid, SYNTAX, "/cursataxi <playerid/name> <amount>");     new Float:x, Float:z, Float:y;     GetPlayerPos(id, Float:x, Float:y, Float:z);     if(fTaxi[playerid] == 0) return SendClientMessage(playerid, 0xff0000FF, "Nu esti din factiunea 'Taxi' !");     if(GetPlayerVehicleID(playerid) != cTaxi[0] || GetPlayerVehicleID(playerid) != cTaxi[1] || GetPlayerVehicleID(playerid) != cTaxi[2]) return SendClientMessage(playerid, 0xff0000FF, "Nu esti in masina de taxi!");     if(!IsPlayerInRangeOfPoint(playerid, 2.0, x, y, z)) return SendClientMessage(playerid, 0xff0000FF, "Nu esti langa acel player!");     if(GetPlayerMoney(id) < bani) return SendClientMessage(playerid, 0xff0000FF, "Acel player nu are suficienti lei pentru a platii cursa!");     if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SCM(playerid, 0xff0000FF, "Acel jucator nu este conectat!");     format(string, sizeof(string), "Iai oferit o cursa lui %s, pentru %d lei!", name1, bani);     SendClientMessage(playerid, 0x00aeffFF, string);     format(string1, sizeof(string1), "Taximetristul %s ti-a oferit o cursa pe %d lei!", name, bani);     SendClientMessage(playerid, 0x10d4deff, string);     GivePlayerMoney(id, -bani);     GivePlayerMoney(playerid, bani);     return 1; }

       
    • By HAndreiH
      Eu pe server am adăugat un System de tutorial și nu îmi apare ce trebuie de făcut si am nevoie de ajutor 
      HAndreiH#2247 
      Dacă se poate ma puteți ajuta 
    • By BNgNeagu
      Vand host ultra-h 20 slot cu port 7777 si cpu extreme cu 5 euro.
      Nu comentati daca nu cumparati!
      Plata se va efectua pe paypal.
      Cadou inca un host de la ultra-h de 5 sloturi gratuit (pentru beta sau pori ce alt ceva).
      Hosturile vor expira in o luna!
    • By HAndreiH
      Nu pot sa cumpar masina din ds si nu stiu ce sa fac sa mearga
      La o posa cu ce imi apare

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • 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.