Jump to content
  • 0

Problema cu disparitia obiectului


AndrewTG01

Question

Problema intalnita (descriere): Am creeat un job farmer si dupa ce plantez semintele , vreau sa intru cu combina sa culeg graul , dar nu dispare dupa ce intru in el.
Ero(area / rile) / warning-(ul / urile):- 
Liniile de cod / sursa / script-ul(obligatoriu): 
if(CP[playerid]==20)
	{
		Seed1 = CreateDynamicObject(818, -132.26900, 50.45452, 5.22199, 0.0, 0.0, 0.0);
        SetPlayerCheckpoint(playerid, -135.26228, 41.49727, 2.11704,5.0);
        CP[playerid] = 21;
	}
	else if(CP[playerid]==21)
	{
		Seed2 = CreateDynamicObject(818, -135.26228, 41.49727, 5.22199, 0.0, 0.0, 0.0);
        SetPlayerCheckpoint(playerid, -137.90633, 34.21829, 2.11704,5.0);
        CP[playerid] = 22;
	}
	else if(CP[playerid]==22)
	{
		Seed3 = CreateDynamicObject(818, -137.90633, 34.21829, 5.22199, 0.0, 0.0, 0.0);
        SetPlayerCheckpoint(playerid, -141.51561, 24.94322, 2.11704,5.0);
        CP[playerid] = 23;
	}
	else if(CP[playerid]==23)
	{
		Seed4 = CreateDynamicObject(818, -141.51561, 24.94322, 5.22199, 0.0, 0.0, 0.0);
        SetPlayerCheckpoint(playerid, -145.13118, 15.64917, 2.11704,5.0);
        CP[playerid] = 24;
	}
	else if(CP[playerid]==24)
	{
		Seed5 = CreateDynamicObject(818, -145.13118, 15.64917, 5.22199, 0.0, 0.0, 0.0);
        SetPlayerCheckpoint(playerid, -148.65193, 6.45007, 2.11704,5.0);
        CP[playerid] = 25;
	}
	else if(CP[playerid]==25)
	{
		Seed6 = CreateDynamicObject(818, -148.65193, 6.45007, 5.22199, 0.0, 0.0, 0.0);
        SetPlayerCheckpoint(playerid, -158.71780, 10.34922, 2.11704,5.0);
        CP[playerid] = 26;
	}
	else if(CP[playerid]==26)
	{
		Seed7 = CreateDynamicObject(818, -158.71780, 10.34922, 5.22199, 0.0, 0.0, 0.0);
        SetPlayerCheckpoint(playerid, -155.20543, 20.11099, 2.11704,5.0);
        CP[playerid] = 27;
	}
	else if(CP[playerid]==27)
	{
		Seed8 = CreateDynamicObject(818, -155.20543, 20.11099, 5.22199, 0.0, 0.0, 0.0);
        SetPlayerCheckpoint(playerid, -149.03192, 37.49228, 2.11704,5.0);
        CP[playerid] = 28;
	}
	else if(CP[playerid]==28)
	{
		Seed9 = CreateDynamicObject(818, -149.03192, 37.49228, 5.22199, 0.0, 0.0, 0.0);
        SetPlayerCheckpoint(playerid, -146.64072, 44.93688, 2.11704,5.0);
        CP[playerid] = 29;
	}
	else if(CP[playerid]==29)
	{
		Seed10 = CreateDynamicObject(818, -146.64072, 44.93688, 5.22199, 0.0, 0.0, 0.0);
        SetPlayerCheckpoint(playerid, -143.33273, 53.92274, 2.11704,5.0);
        CP[playerid] = 30;
	}
	else if(CP[playerid]==30)
	{
		Seed11 = CreateDynamicObject(818, -143.33273, 53.92274, 5.22199, 0.0, 0.0, 0.0);
        SetPlayerCheckpoint(playerid, -140.12962, 62.76068, 2.11704,5.0);
        CP[playerid] = 31;
	}
	else if(CP[playerid]==31)
	{
		Seed12 = CreateDynamicObject(818, -140.12962, 62.76068, 5.22199, 0.0, 0.0, 0.0);
        SendClientMessage(playerid, COLOR_WHITE, "Plant finished, now go take a combine and collect the wheat.");
        CombineTake[playerid] = 1;
		CP[playerid] = 0;
	}




if(newcar == Combine1 || newcar == Combine2 || newcar == Combine3 || newcar == Combine4)
		{
		    if(CombineTake[playerid] == 1)
		    {
				if(IsPlayerInRangeOfPoint(playerid, 1.0, -132.26900, 50.45452, 2.11704))
				{
					DestroyDynamicObject(Seed1);
				}
				else if(IsPlayerInRangeOfPoint(playerid, 1.0, -135.26228, 41.49727, 2.11704))
				{
					DestroyDynamicObject(Seed2);
				}
				else if(IsPlayerInRangeOfPoint(playerid, 1.0, -137.90633, 34.21829, 2.11704))
				{
					DestroyDynamicObject(Seed3);
				}
				else if(IsPlayerInRangeOfPoint(playerid, 1.0, -141.51561, 24.94322, 2.11704))
				{
					DestroyDynamicObject(Seed4);
				}
				else if(IsPlayerInRangeOfPoint(playerid, 1.0, -145.13118, 15.64917, 2.11704))
				{
					DestroyDynamicObject(Seed5);
				}
				else if(IsPlayerInRangeOfPoint(playerid, 1.0, -148.65193, 6.45007, 2.11704))
				{
					DestroyDynamicObject(Seed6);
				}
				else if(IsPlayerInRangeOfPoint(playerid, 1.0, -158.71780, 10.34922, 2.11704))
				{
					DestroyDynamicObject(Seed7);
				}
				else if(IsPlayerInRangeOfPoint(playerid, 1.0, -155.20543, 20.11099, 2.11704))
				{
					DestroyDynamicObject(Seed8);
				}
				else if(IsPlayerInRangeOfPoint(playerid, 1.0, -152.36862, 28.35958, 2.11704))
				{
					DestroyDynamicObject(Seed9);
				}
				else if(IsPlayerInRangeOfPoint(playerid, 1.0, -149.03192, 37.49228, 2.11704))
				{
					DestroyDynamicObject(Seed10);
				}
				else if(IsPlayerInRangeOfPoint(playerid, 1.0, -146.64072, 44.93688, 2.11704))
				{
					DestroyDynamicObject(Seed11);
				}
				else if(IsPlayerInRangeOfPoint(playerid, 1.0, -143.33273, 53.92274, 2.11704))
				{
					DestroyDynamicObject(Seed12);
				}
		    }
		    else
			{
		        SendClientMessage(playerid,COLOR_GREY,"   You didn't planted seeds !");
		        RemovePlayerFromVehicle(playerid);
		    }
		}

Imagini / Video (optional): - 
Ati incercat sa rezolvati singur?: Da
Link to comment
Share on other sites

13 answers to this question

Recommended Posts

  • 0

De ce nu faci asa

 

New Float:x,:Float:y,Float:z;

GetDynamicObjectPos(seed11,x,y,z);

 

if(IsPlayerInRangeOfPoint(playerid, 3.0,x,y,z)) {

DestroyDynamicObject(Seed11); }

 

Bine, eu te-as sfatui sa pui si

New seed [12];

Sed [1] = createdynamicobject bla bla bla

 

For (new i; i <sizeof (12); i++)

New Float:x,:Float:y,Float:z;

GetDybamicObjectPos(seed[1],x,y,z);

 

if(IsPlayerInRangeOfPoint(playerid, 3.0,x,y,z)) {

DestroyDynamicObject(Seed[1]); }

 

Sau doar incearca sa maresti raza de la 1.0 la 3 pentru ca esti in combina si distanta e mai mare incearca asta si daca nu merge fa cum am zis prima data

 

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0
5 minutes ago, AndrewTG01 said:

nu prea am inteles...

Incearca sa modifici la 

 

if(IsPlayerInRangeOfPoint(playerid, 1.0

Asa

if(IsPlayerInRangeOfPoint(playerid, 3.0

 

La toate pui 3.0 daca tot nu merge inseamna ca acele coordonate sunt gresite, si va trebui sa le iei pe toate la rand sa vezi daca sunt puse in ordinea checkpointurilor

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0

Daca primesti mesjaul asta

SendClientMessage(playerid, COLOR_WHITE, "Plant finished, now go take a combine and collect the wheat.");

Atunci asigurate ca masina in care esti este combine1 2 3 sau 4

Si verifica daca nu cumva distruge alt obiect.

Asta este strict din partea ta, adica este ordinea cpurilor si a coordonatelor pe care trebuie sa le verifici ca sunt puse bine.

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0

Muta-l la onplayerupdate, recomandat ar fi la un timer de o secunda ca sa nu faca lag, dar daca nu stii.... cauta public onplayerupdate si muta acolo codul

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0
10 hours ago, Mister said:

Muta-l la onplayerupdate, recomandat ar fi la un timer de o secunda ca sa nu faca lag, dar daca nu stii.... cauta public onplayerupdate si muta acolo codul

Nu are rost să mute la OnPlauerUpdate, ca publicul ala se updateaza de câteva ori pe secundă, si la vreo 10-20 de playerid care fac acel job o sa pice ca nu face față.

**********************************

Servicii Scripting de calitate:

*********************************

Future Project: ExpertGame

*********************************

Link to comment
Share on other sites

  • 0
5 hours ago, AndrewTG01 said:

deci, ce fac pana la urma?

la ongamemodeinit adaugi asa

SetTimer("Timersecond", 1000,false);

apoi oriunde in gm adaugi asa


 

forward  Timersecond();

public Timersecond()

{

foreach(Player,i)// daca nu ai inlucludeul foreach pui for(new i;i<MAX_PLAYERS;i++)

{

new newcar = GetPlayerVehicleID(i);


if(newcar == Combine1 || newcar == Combine2 || newcar == Combine3 || newcar == Combine4)
		{
		    if(CombineTake[playerid] == 1)
		    {
				if(IsPlayerInRangeOfPoint(playerid, 1.0, -132.26900, 50.45452, 2.11704))
				{
					DestroyDynamicObject(Seed1);
				}
				else if(IsPlayerInRangeOfPoint(playerid, 1.0, -135.26228, 41.49727, 2.11704))
				{
					DestroyDynamicObject(Seed2);
				}
				else if(IsPlayerInRangeOfPoint(playerid, 1.0, -137.90633, 34.21829, 2.11704))
				{
					DestroyDynamicObject(Seed3);
				}
				else if(IsPlayerInRangeOfPoint(playerid, 1.0, -141.51561, 24.94322, 2.11704))
				{
					DestroyDynamicObject(Seed4);
				}
				else if(IsPlayerInRangeOfPoint(playerid, 1.0, -145.13118, 15.64917, 2.11704))
				{
					DestroyDynamicObject(Seed5);
				}
				else if(IsPlayerInRangeOfPoint(playerid, 1.0, -148.65193, 6.45007, 2.11704))
				{
					DestroyDynamicObject(Seed6);
				}
				else if(IsPlayerInRangeOfPoint(playerid, 1.0, -158.71780, 10.34922, 2.11704))
				{
					DestroyDynamicObject(Seed7);
				}
				else if(IsPlayerInRangeOfPoint(playerid, 1.0, -155.20543, 20.11099, 2.11704))
				{
					DestroyDynamicObject(Seed8);
				}
				else if(IsPlayerInRangeOfPoint(playerid, 1.0, -152.36862, 28.35958, 2.11704))
				{
					DestroyDynamicObject(Seed9);
				}
				else if(IsPlayerInRangeOfPoint(playerid, 1.0, -149.03192, 37.49228, 2.11704))
				{
					DestroyDynamicObject(Seed10);
				}
				else if(IsPlayerInRangeOfPoint(playerid, 1.0, -146.64072, 44.93688, 2.11704))
				{
					DestroyDynamicObject(Seed11);
				}
				else if(IsPlayerInRangeOfPoint(playerid, 1.0, -143.33273, 53.92274, 2.11704))
				{
					DestroyDynamicObject(Seed12);
				}
		    }
		    else
			{
		        SendClientMessage(playerid,COLOR_GREY,"   You didn't planted seeds !");
		        RemovePlayerFromVehicle(playerid);
		    }
		}

return 1;
}

 

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0

error 030: compound statement not closed at the end of file (started at line 26154)

de aici incepe eroarea


{
new newcar = GetPlayerVehicleID(i);
        if(newcar == Combine1 || newcar == Combine2 || newcar == Combine3 || newcar == Combine4)
		{
		    if(CombineTake[i] == 1)
		    {
				if(IsPlayerInRangeOfPoint(i, 1.0, -132.26900, 50.45452, 2.11704))
				{
					DestroyDynamicObject(Seed1);
				}
				else if(IsPlayerInRangeOfPoint(i, 1.0, -135.26228, 41.49727, 2.11704))
				{
					DestroyDynamicObject(Seed2);
				}
				else if(IsPlayerInRangeOfPoint(i, 1.0, -137.90633, 34.21829, 2.11704))
				{
					DestroyDynamicObject(Seed3);
				}
				else if(IsPlayerInRangeOfPoint(i, 1.0, -141.51561, 24.94322, 2.11704))
				{
					DestroyDynamicObject(Seed4);
				}
				else if(IsPlayerInRangeOfPoint(i, 1.0, -145.13118, 15.64917, 2.11704))
				{
					DestroyDynamicObject(Seed5);
				}
				else if(IsPlayerInRangeOfPoint(i, 1.0, -148.65193, 6.45007, 2.11704))
				{
					DestroyDynamicObject(Seed6);
				}
				else if(IsPlayerInRangeOfPoint(i, 1.0, -158.71780, 10.34922, 2.11704))
				{
					DestroyDynamicObject(Seed7);
				}
				else if(IsPlayerInRangeOfPoint(i, 1.0, -155.20543, 20.11099, 2.11704))
				{
					DestroyDynamicObject(Seed8);
				}
				else if(IsPlayerInRangeOfPoint(i, 1.0, -152.36862, 28.35958, 2.11704))
				{
					DestroyDynamicObject(Seed9);
				}
				else if(IsPlayerInRangeOfPoint(i, 1.0, -149.03192, 37.49228, 2.11704))
				{
					DestroyDynamicObject(Seed10);
				}
				else if(IsPlayerInRangeOfPoint(i, 1.0, -146.64072, 44.93688, 2.11704))
				{
					DestroyDynamicObject(Seed11);
				}
				else if(IsPlayerInRangeOfPoint(i, 1.0, -143.33273, 53.92274, 2.11704))
				{
					DestroyDynamicObject(Seed12);
				}
		    }
		    else
			{
		        SendClientMessage(i,COLOR_GREY,"   You didn't planted seeds !");
		        RemovePlayerFromVehicle(i);
		    }
		}
        return 1;
}

 

am rezolvat , lipsea o paranteza

tot nu dispar...

Link to comment
Share on other sites

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.