Jump to content
  • 0

Ajutor park


Tibixux

Question

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

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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