SA-MP Forums Archive
Removing objects and their disappearing - 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: Removing objects and their disappearing (/showthread.php?tid=623275)



Removing objects and their disappearing - TheRohlikar - 29.11.2016

Hello again, gentlemen,

I have a problem with some objects. I use "streamer.inc", but...

Look at the code, hopefully, explained below.

Код:
#include <a_samp>
#include <streamer>

#define MAX_CITYHALL_OBJECTS 46

new city_hall[MAX_CITYHALL_OBJECTS];

public OnFilterScriptInit(){
	for(new i=0;i<MAX_PLAYERS;i++){
		RemoveBuildingForPlayer(i, 13026, 2261.421, -71.812, 25.578, 0.250);
		RemoveBuildingForPlayer(i, 781, 2253.773, -79.531, 25.492, 0.250);
		RemoveBuildingForPlayer(i, 12959, 2261.421, -71.812, 25.578, 0.250);
		RemoveBuildingForPlayer(i, 956, 2271.726, -76.460, 25.960, 0.250);
		RemoveBuildingForPlayer(i, 781, 2259.390, -79.414, 25.492, 0.250);
		RemoveBuildingForPlayer(i, 781, 2266.085, -79.414, 25.492, 0.250);
		RemoveBuildingForPlayer(i, 1440, 2274.664, -69.843, 26.078, 0.250);
		RemoveBuildingForPlayer(i, 669, 2248.625, -65.679, 25.812, 0.250);
	}
	city_hall[0] = CreateObject(12959,2261.421,-71.812,25.578,-360.000,-360.000, -360.000);
	SetObjectMaterial(city_hall[0], 0, 14789, "ab_sfgymmain", "gym_floor6", 0x00000000);
	SetObjectMaterial(city_hall[0], 4, 16640, "a51", "plaintarmac1", 0x00000000);
	SetObjectMaterial(city_hall[0], 10, 8419, "vgsbldng1", "cityplansign01_256", 0x00000000);
	city_hall[1] = CreateDynamicObject(19865,2249.010,-75.783,24.600,0.000,0.000,90.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[1], 0, 14789, "ab_sfgymmain", "gym_floor6", 0x00000000);
	city_hall[2] = CreateDynamicObject(19865,2271.405,-65.946,24.600,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[2], 0, 14789, "ab_sfgymmain", "gym_floor6", 0x00000000);
	city_hall[3] = CreateDynamicObject(19866,2283.829,-70.005,25.555,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[3], 0, 14789, "ab_sfgymmain", "gym_floor6", 0x00000000);
	city_hall[4] = CreateDynamicObject(19866,2273.910,-67.600,25.555,0.000,0.000,90.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[4], 0, 14789, "ab_sfgymmain", "gym_floor6", 0x00000000);
	city_hall[5] = CreateDynamicObject(19866,2278.895,-67.600,25.555,0.000,0.000,90.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[5], 0, 14789, "ab_sfgymmain", "gym_floor6", 0x00000000);
	city_hall[6] = CreateDynamicObject(19866,2281.427,-67.601,25.555,0.000,0.000,90.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[6], 0, 14789, "ab_sfgymmain", "gym_floor6", 0x00000000);
	city_hall[7] = CreateDynamicObject(19866,2278.895,-67.600,24.805,0.000,0.000,90.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[7], 0, 14789, "ab_sfgymmain", "gym_floor6", 0x00000000);
	city_hall[8] = CreateDynamicObject(19866,2281.427,-67.601,24.805,0.000,0.000,90.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[8], 0, 14789, "ab_sfgymmain", "gym_floor6", 0x00000000);
	city_hall[9] = CreateDynamicObject(19866,2283.829,-70.005,24.806,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[9], 0, 14789, "ab_sfgymmain", "gym_floor6", 0x00000000);
	city_hall[10] = CreateDynamicObject(19866,2283.829,-74.996,24.806,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[10], 0, 14789, "ab_sfgymmain", "gym_floor6", 0x00000000);
	city_hall[11] = CreateDynamicObject(19866,2283.829,-79.988,24.806,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[11], 0, 14789, "ab_sfgymmain", "gym_floor6", 0x00000000);
	city_hall[12] = CreateDynamicObject(19866,2283.829,-84.986,24.806,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[12], 0, 14789, "ab_sfgymmain", "gym_floor6", 0x00000000);
	city_hall[13] = CreateDynamicObject(19866,2283.829,-74.996,25.555,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[13], 0, 14789, "ab_sfgymmain", "gym_floor6", 0x00000000);
	city_hall[14] = CreateDynamicObject(19866,2283.829,-79.988,25.555,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[14], 0, 14789, "ab_sfgymmain", "gym_floor6", 0x00000000);
	city_hall[15] = CreateDynamicObject(19866,2283.829,-84.986,25.555,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[15], 0, 14789, "ab_sfgymmain", "gym_floor6", 0x00000000);
	city_hall[16] = CreateDynamicObject(19866,2264.928,-82.311,24.823,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[16], 0, 7650, "vgnusedcar", "lightyellow2_32", 0x00000000);
	city_hall[17] = CreateDynamicObject(19866,2262.069,-82.311,24.823,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[17], 0, 7650, "vgnusedcar", "lightyellow2_32", 0x00000000);
	city_hall[18] = CreateDynamicObject(19866,2259.426,-82.311,24.823,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[18], 0, 7650, "vgnusedcar", "lightyellow2_32", 0x00000000);
	city_hall[19] = CreateDynamicObject(19866,2256.597,-82.311,24.823,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[19], 0, 7650, "vgnusedcar", "lightyellow2_32", 0x00000000);
	city_hall[20] = CreateDynamicObject(19866,2253.882,-82.311,24.823,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[20], 0, 7650, "vgnusedcar", "lightyellow2_32", 0x00000000);
	city_hall[21] = CreateDynamicObject(19866,2251.529,-82.311,24.823,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[21], 0, 7650, "vgnusedcar", "lightyellow2_32", 0x00000000);
	city_hall[22] = CreateDynamicObject(19866,2273.910,-67.600,26.304,0.000,0.000,90.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[22], 0, 14789, "ab_sfgymmain", "gym_floor6", 0x00000000);
	city_hall[23] = CreateDynamicObject(19866,2281.427,-67.601,26.302,0.000,0.000,90.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[23], 0, 14789, "ab_sfgymmain", "gym_floor6", 0x00000000);
	city_hall[24] = CreateDynamicObject(19866,2283.829,-70.005,26.301,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[24], 0, 14789, "ab_sfgymmain", "gym_floor6", 0x00000000);
	city_hall[25] = CreateDynamicObject(19866,2283.829,-79.988,26.296,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[25], 0, 14789, "ab_sfgymmain", "gym_floor6", 0x00000000);
	city_hall[26] = CreateDynamicObject(19866,2267.958,-82.311,24.823,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[26], 0, 7650, "vgnusedcar", "lightyellow2_32", 0x00000000);
	city_hall[27] = CreateDynamicObject(19866,2275.526,-70.162,24.839,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[27], 0, 7650, "vgnusedcar", "lightyellow2_32", 0x00000000);
	city_hall[28] = CreateDynamicObject(19866,2278.428,-70.162,24.839,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[28], 0, 7650, "vgnusedcar", "lightyellow2_32", 0x00000000);
	city_hall[29] = CreateDynamicObject(19866,2281.814,-70.162,24.839,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	SetDynamicObjectMaterial(city_hall[29], 0, 7650, "vgnusedcar", "lightyellow2_32", 0x00000000);
	
	city_hall[30] = CreateDynamicObject(673,2253.378,-79.020,25.740,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	city_hall[31] = CreateDynamicObject(673,2265.971,-79.020,25.740,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	city_hall[32] = CreateDynamicObject(673,2259.512,-79.020,25.740,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	city_hall[33] = CreateDynamicObject(1215,2256.083,-79.020,26.303,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	city_hall[34] = CreateDynamicObject(1215,2263.265,-79.020,26.303,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	city_hall[35] = CreateDynamicObject(869,2249.220,-69.793,26.150,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	city_hall[36] = CreateDynamicObject(869,2252.074,-65.560,26.150,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	city_hall[37] = CreateDynamicObject(869,2248.690,-65.887,26.150,0.000,0.000,-89.639,-1,-1,-1,300.000,300.000);
	city_hall[38] = CreateDynamicObject(869,2256.303,-65.445,26.150,0.000,0.000,-15.359,-1,-1,-1,300.000,300.000);
	city_hall[39] = CreateDynamicObject(869,2269.204,-65.442,26.150,0.000,0.000,-15.359,-1,-1,-1,300.000,300.000);
	city_hall[40] = CreateDynamicObject(869,2264.796,-65.404,26.150,0.000,0.000,-15.359,-1,-1,-1,300.000,300.000);
	city_hall[41] = CreateDynamicObject(869,2260.684,-65.409,26.150,0.000,0.000,-15.359,-1,-1,-1,300.000,300.000);
	city_hall[42] = CreateDynamicObject(869,2249.054,-73.872,26.150,0.000,0.000,-190.559,-1,-1,-1,300.000,300.000);
	city_hall[43] = CreateDynamicObject(3657,2272.683,-76.436,26.078,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	city_hall[44] = CreateDynamicObject(1328,2275.134,-76.378,26.077,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	city_hall[45] = CreateDynamicObject(8990,2259.967,-79.030,26.427,0.000,0.000,0.000,-1,-1,-1,300.000,300.000);
	return 1;
}

public OnFilterScriptExit(){
	for(new i=1;i<MAX_CITYHALL_OBJECTS;i++) DestroyDynamicObject(city_hall[i]);
	DestroyObject(city_hall[0]); //park place
	return 1;
}

main(){}
So... I do have this code, it works perfectly, but. When I restart the server (of course with "filterscripts nameofit" in server.cfg), a few objects disappear.

I have no idea why it is so... any ideas ? Maybe problem with include ?


Re: Removing objects and their disappearing - BiosMarcel - 29.11.2016

Is there a MAX_OBJECTS in your scripts / the include? If that's not the case, maybe your server is just too weak?


Re: Removing objects and their disappearing - TheRohlikar - 30.11.2016

Well, it can't be the problem, because when I "reloadfs" by RCON command, it works...
(sorry, I forgot to write this information xD)

It's screwed up only after restart server.
I thought "RemoveBuildingForPlayer" could be a problem... But I don't know why...


Re: Removing objects and their disappearing - Abagail - 30.11.2016

Are you restarting the server using the GMX function?


Re: Removing objects and their disappearing - TheRohlikar - 30.11.2016

Quote:
Originally Posted by Abagail
Посмотреть сообщение
Are you restarting the server using the GMX function?
Yes, I am.

Okay. I just tried to "reloadfs" and it doesn't work. Only sometimes...

(4 times nope, once yep ... and again)

That's honestly stupid.


Re: Removing objects and their disappearing - TheRohlikar - 30.11.2016

Okay. I've tried to change "Dynamic" on normal creating. And it works... so... Problem is with plugin or include.
Or.. it's just too slow.

Thank you for help, guys, appreciate it.