SA-MP Forums Archive
SAMP Bug? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SAMP Bug? (/showthread.php?tid=652180)



SAMP Bug? - NexyAG - 04.04.2018

Код HTML:
if(KosenjeTrave[playerid] == 1) //Checking is player working
		{
			new Float:tX, Float:tY, Float:tZ;
			for(new i = 0; i < 28; i++)
			{
				if(PokosioTrave[playerid] == 28) //This is what we are incerasing (++;)
				{
					//todo
				}
				else
				{
					GetPlayerObjectPos(playerid, obj_KosacTrava[i][playerid], tX, tY, tZ); //If is player in range of these, he will get it incerased
					if(IsPlayerInRangeOfPoint(playerid, 3.0, tX, tY, tZ))
					{
						DestroyPlayerObject(playerid, obj_KosacTrava[i][playerid]);
						obj_KosacTrava[i][playerid] = 1; //ITs changing object to non-object value so it cannot be again used
						obj_KosacTravaPokosena[i][playerid] = CreatePlayerObject(playerid, 826, tX, tY, tZ, 0.0, 0.0, 0.0); //This is creating new object on old one's place
						PokosioTrave[playerid] += 1; //This is what we are incerasing
						Job(playerid, "Odlicno Vam ide! Preostalo objekata trave: %d.", 28-PokosioTrave[playerid]); //Message
						printf("Igrac sada ima %d trave", PokosioTrave[playerid]); //debug
					}
					else if(!IsPlayerInRangeOfPoint(playerid, 3.0, tX, tY, tZ))
					{
						print("Igrac nije kod objekta"); //Showing is player in range of that object
					}
				}
			}
		}
So basically i need to incerase that value for +1, its working fine on start, but after 4-5 times when player do that action (this is job system) value is incerasing for 2 to 5 (random) and on random place.
Help, look at time stamp, here is InGame msg
https://imgur.com/a/Qewyv
(( This attached object is just random cords, don't look at it xD )


Re: SAMP Bug? - CodeStyle175 - 04.04.2018

Pls write your code in english, its like unversal language for coding.


Re: SAMP Bug? - Dayrion - 04.04.2018

I advice you to don't make multiple arrays for a single system until it's really necessary. Use an enum with a single array.