Jump to content
Autentificarea cu Google și Facebook nu mai este disponibilă. ×

Question

Posted

Descrierea problemei: Doresc să stiu cum pot face, sa nu poti da park intr-o anumită zonă
Liniile de cod / sursa / script-ul(obligatoriu): aceasta este comanda park 

CMD:park(playerid, params[])
{
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
	if(PlayerInfo[playerid][pPcarkey] == 0 && PlayerInfo[playerid][pmotokey] == 0 && PlayerInfo[playerid][phelikey] == 0 && PlayerInfo[playerid][pprcarkey] == 0 && PlayerInfo[playerid][pprcarkey2] == 0 && PlayerInfo[playerid][pPPluscarkey] == 0 && PlayerInfo[playerid][pPPluscarkey2] == 0) return SendClientMessage(playerid,COLOR_WHITE,"{FFB870}You do not have a vehicle.");
	if(personalcar[playerid] == 0) return SCM(playerid,COLOR_WHITE,"{FFB870}You don't have spawned car.");
	new engine,lights,alarm,doors,bonnet,boot,objective;
	new Float:x,Float:y,Float:z,Float:a,getcarid;
	getcarid = GetPlayerVehicleID(playerid);
	new interiorr = GetPlayerInterior(playerid),
		virtuall = GetPlayerVirtualWorld(playerid);
	GetVehiclePos(getcarid, x, y, z);
	GetVehicleZAngle(getcarid, a);
	if(GetPlayerVehicleID(playerid) == personalcar[playerid])
	{
		if(IsPlayerInVehicle(playerid,personalcar[playerid]))
		{
	    	new Float:health2;
			GetVehicleHealth(getcarid, health2);
			if(health2 < 500.0) return SCM(playerid,COLOR_WHITE,"{FFB870}Please repair your car.");
			if(getcarid == personalcar[playerid])
			{
				CarInfo[OwnedVeh(getcarid)][cLocationx] = x;
				CarInfo[OwnedVeh(getcarid)][cLocationy] = y;
				CarInfo[OwnedVeh(getcarid)][cLocationz] = z;
				CarInfo[OwnedVeh(getcarid)][cAngle] = a;
				DestroyVehicle(personalcar[playerid]);
				new created = OwnedVeh(getcarid);
				OwnedVeh(getcarid) = 0;
	 			new car = CreateVehicle(CarInfo[created][cModel],CarInfo[created][cLocationx],CarInfo[created][cLocationy],CarInfo[created][cLocationz]+1.0,CarInfo[created][cAngle],CarInfo[created][cColorOne],CarInfo[created][cColorTwo],500000);
                OwnedVeh(car) = created;
				personalcar[playerid] = car;
				PutPlayerInVehicleEx(playerid,car,0);
				new carplate[25];
				format(carplate, sizeof(carplate), "%s",CarInfo[OwnedVeh(car)][cLicense]);
			    SetVehicleNumberPlate(car, carplate);
	      		SetVehicleHealth(car, health2);
	      		LinkVehicleToInterior(car, interiorr);
	      		SetVehicleVirtualWorld(car, virtuall);
	      		vehEngine[car] = 0;
		    	GetVehicleParamsEx(car,engine,lights,alarm,doors,bonnet,boot,objective);
		      	SetVehicleParamsEx(car,VEHICLE_PARAMS_OFF,lights,alarm,CarInfo[PlayerInfo[playerid][pPcarkey]][cLock],bonnet,boot,objective);
			    SetPVarInt(playerid, "Engine", 0);
				vUpdate(OwnedVeh(car),cLocationxx);
				vUpdate(OwnedVeh(car),cLocationyx);
				vUpdate(OwnedVeh(car),cLocationzx);
				vUpdate(OwnedVeh(car),cAnglex);
				ModVehicle(car);
				SendClientMessage(playerid, COLOR_WHITE, "Ai parcat masina cu succes!");
				Update(playerid, pPcarkeyx);
				Update(playerid, pmotokeyx);
				Update(playerid, pprcarkey2x);
				Update(playerid, pPPluscarkeyx);
				Update(playerid, pPPluscarkey2x);
				Update(playerid, pprcarkeyx);
				return 1;
			}
		}
	}
	return 1;
}

Imagini / Video (optional): Nu am
Ce am incercat sa fac: Nu am idee cum sa fac sa nu poti da park intr-o zonă, care să fie pusă de tine
Alte detalii:Multumesc

xux.ro/bugged.ro

1 answer to this question

Recommended Posts

  • 0
Posted

Am sa iti arat un model sugestiv:

faci un array cu 2 dimensiuni gen:

new ParcareInterzisa[ ][4] =

{

{Pozitia X, Pozitia Y, Pozitia Z, raza de la player la locul interzis},

{la fel ca pozitia de sus }

};

si cand dai /park pui o verificare de genu

new rand = sizeof(ParcareInterzisa);

If(IsPlayerInRangeOfPoint(playerid, PozitieInterzisa[rand][3] - raza de la player la pozitie, PozitieInterzisa[rand][0], PozitieInterzisa[rand][1], PozitieInterzisa[rand][2]))

return SendClientMessage(playerid, -1, "Esti in locul nepermis de parcare!");

 

E singura metoda care mi-a venit in cap...Incearc-o

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.