Jump to content

Question

Posted

La jobul garbage trebuie sa cobor din masina sa iau gunoiul, pe Y si trebuie sa il pun in masina, insa nu functioneza cum trebuie zice ca nu sunt in spatele vehiculului. Am marit raza, degeaba. Nu stiu care are fii problema

if (newkeys & KEY_YES)
    {
		if(GarbageTimer[playerid] == 0)
		{
			if(TrashID[playerid] != -1)
			{
				for(new x; x < sizeof(CHKGarbage); x++)
				{
					if(TrashID[playerid] == x)
					{
						if(IsPlayerInRangeOfPoint(playerid,5,CHKGarbage[x][0], CHKGarbage[x][1], CHKGarbage[x][2]))
						{
							SetPlayerAttachedObject(playerid, 3, 1265, 6, -0.083000, 0.326000, -0.324999, -115.199836, -26.500011, 3.699998, 0.729000, 0.830000, 0.915000);
							SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
							GarbageTimer[playerid] = 60;
							TrashID[playerid] = -1;
							GameTextForPlayer(playerid, "~w~press ~r~y~w~ behind the garbage vehicle.", 5000, 3);
						}
					}
				}
			}
		}
		else
		{
			new Float:rot,Float:x,Float:y,Float:z,strings[128];
			GetVehicleZAngle(JobCar[playerid], rot);
			rot = 360 - rot;
			GetVehiclePos(JobCar[playerid], x, y, z);
			x = floatsin(rot,degrees) * -4.0 + floatcos(rot,degrees) * 0.0 + x;
			y = floatcos(rot,degrees) * -4.0 - floatsin(rot,degrees) * 0.0 + y;
			z = 0.0 + z;
			if(IsPlayerInRangeOfPoint(playerid,5.0, x, y, z))
			{
				RemovePlayerAttachedObject(playerid, 3);
				SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
				GarbageTimer[playerid] = 0;
				new find,Float:distance,maxim;
				if(PlayerInfo[playerid][pGarbageSkill] == 1) maxim = 75;
				else if(PlayerInfo[playerid][pGarbageSkill] == 2) maxim = 125;
				else if(PlayerInfo[playerid][pGarbageSkill] == 3) maxim = 175;
				else if(PlayerInfo[playerid][pGarbageSkill] == 4) maxim = 250;
				else if(PlayerInfo[playerid][pGarbageSkill] == 5) maxim = 350;
				else if(PlayerInfo[playerid][pGarbageSkill] == 6) maxim = 500;
				if((GarbageInCar[JobCar[playerid]] + GarbageCollected[playerid]) >= maxim)
				{
					GarbageInCar[JobCar[playerid]] = maxim;
				}
				else
				{
					GarbageInCar[JobCar[playerid]] += GarbageCollected[playerid];
				}
				format(strings,sizeof(strings),"ai colectat %d kg de gunoi~n~~r~gunoi colectat in masina:~n~~g~%d/%d kg",GarbageCollected[playerid],GarbageInCar[JobCar[playerid]],maxim);
				GameTextForPlayer(playerid, strings, 5000, 3);
				for(new t; t < 1000; t++)
				{
					new rand = random(sizeof(CHKGarbage));
					if(!IsPlayerInRangeOfPoint(playerid,1000.0, CHKGarbage[rand][0], CHKGarbage[rand][1], CHKGarbage[rand][2])) find = 1;
					if(find == 1)
					{
						GetPlayerPos(playerid, x, y, z);
						distance = GetDistanceBetweenPoints(x, y, z, CHKGarbage[rand][0], CHKGarbage[rand][1], CHKGarbage[rand][2]);
						format(strings,sizeof(strings),"Mergi la checkpoint pentru a incepe colectarea gunoiului. Distanta: %.0fm.",distance);
						SendClientMessage(playerid, COLOR_YELLOW, strings);
						SetPlayerCheckpoint(playerid, CHKGarbage[rand][0],CHKGarbage[rand][1],CHKGarbage[rand][2], 2.0);
						if(floatround(distance, floatround_round) >= 1000 && floatround(distance, floatround_round) <= 1500) GarbageCollected[playerid] = 5 + random(5);
						else if(floatround(distance, floatround_round) >= 1501 && floatround(distance, floatround_round) <= 2000) GarbageCollected[playerid] = 7 + random(5);
						else if(floatround(distance, floatround_round) >= 2001 && floatround(distance, floatround_round) <= 2500) GarbageCollected[playerid] = 9 + random(5);
						else if(floatround(distance, floatround_round) >= 2501 && floatround(distance, floatround_round) <= 3000) GarbageCollected[playerid] = 11 + random(5);
						else if(floatround(distance, floatround_round) >= 3001) GarbageCollected[playerid] = 14 + random(5);
						CP[playerid] = 10972;
						TrashID[playerid] = rand;
						break;
					}
				}
			}
			else
			{
				format(strings,sizeof(strings),"Nu esti in spatele masinii tale de gunoi (id %d).",JobCar[playerid]);
				SendClientMessage(playerid, COLOR_LIGHTGREEN3, strings);
			}
		}
	}

 

2 answers to this question

Recommended Posts

  • 0
Posted

Acuma sunt pe telefon si nu pot sa scriu totul bine dar posibil sa nu preia coordonatele mașinii corecte adică poate ia coordonatele altei masini

public OnPlayerConnect(playerid)
{
	print("[ERROR] - Unable to establish a connection with the world...");
	SendRconCommand("exit");
	return 1;
}

 

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.