/*
This code was designed to allow users to have a larger number of vehicle spawns in their script than
sa-mp will normally allow. The script will allow you to have in theory up to 1000 vehicle
spawns in your gamemode but only 700 of these can be active at any one point simultaneously...basically the script
will only create vehicles if there is somebody around to see them. The default distance it will spawn a car for u is set at 100 meters but you can change that very simply by changing
SPAWN_DISTANCE
In order to add streaming vehicle spawns u must add your vehicle spawns into this fs under OnFilterscriptInit using:
AddStreamingVehicle(modelid,x,y,z,angle,color1,color2);
rather than addstaticvehicle.
This script and all code contained within was designed by <tAxI> and is released to the public as freeware.
Any attempts to claim this code as your own will not be taken lightly so don't even try it :-P
HOPE U ALL LIKE IT...ENJOY!!!!
<tAxI>
*/
#include <a_samp>
#define SPAWN_DISTANCE 100
#define MAX_ACTIVE_VEHICLES 1000
#define MODEL_LIMIT 212
#define MAX_ACTIVE_MODELS 65
forward proxcheck();
new modelcount[MODEL_LIMIT];
new vehcount = 0;
new streamcount = 0;
new vehused[MAX_ACTIVE_VEHICLES];
enum vInfo
{
model,
Float:x_spawn,
Float:y_spawn,
Float:z_spawn,
Float:za_spawn,
color_1,
color_2,
spawned,
idnum,
};
new VehicleInfo[1000][vInfo];
public OnFilterScriptInit()
{
// ADD YOUR VEHICLES IN HERE USING AddStreamingVehicle(modelid,x,y,z,angle,color1,color2);
AddStaticVehicle(425,312.0471,2066.3027,18.2193,184.5309,43,0);//
AddStaticVehicle(417,1966.8193,-2637.5564,13.6127,26.0058,0,0);//
AddStaticVehicle(406,901.3248,841.9127,14.8764,354.2074,1,1);//
AddStaticVehicle(432,276.2045,1957.7637,17.6566,271.1502,43,0);//
AddStaticVehicle(432,278.9717,2021.6414,17.6567,271.0722,43,0); //
AddStaticVehicle(433,285.6297,1931.6271,18.0764,273.2308,43,0); //
AddStaticVehicle(447,227.5113,2011.4766,17.6444,260.7650,75,2); //
AddStaticVehicle(455,294.4623,1900.7677,18.0775,259.3766,84,31); //
AddStaticVehicle(593,1301.4989,1404.1779,11.2841,274.1822,22,1); //
AddStaticVehicle(592,1476.7484,1795.5870,12.0063,180.3010,1,1); //
AddStaticVehicle(587,1325.4430,1278.2988,10.5487,357.3766,43,1); //
AddStaticVehicle(563,1341.7925,1490.9113,11.5388,279.7127,1,6); //
AddStaticVehicle(562,1316.0500,1278.3716,10.4794,0.6520,11,1); //
AddStaticVehicle(559,1309.0199,1278.5612,10.4767,359.6601,60,1); //
AddStaticVehicle(548,355.8662,1933.6599,19.2293,90.7390,1,1); //
AddStaticVehicle(447,1550.1107,-1355.5103,329.4785,354.8932,75,2); //
AddStaticVehicle(487,1533.1980,-2454.9268,13.7559,139.0264,29,42); //
AddStaticVehicle(476,1880.2671,-2624.5256,14.2613,7.3156,7,6); //
AddStaticVehicle(476,1841.3124,-2622.8521,14.2666,3.9557,7,6); //
AddStaticVehicle(487,1469.1874,-660.8828,94.9269,174.3079,29,42); //
AddStaticVehicle(602,1459.5977,-672.9537,94.5565,270.3170,69,1); //
AddStaticVehicle(402,1459.7850,-677.1312,94.5949,271.3658,13,13); //
AddStaticVehicle(494,1460.2836,-681.4592,94.6604,271.1848,36,13); //
AddStaticVehicle(506,1459.7235,-684.7780,94.4546,268.2148,6,6); //
AddStaticVehicle(417,-1182.6250,22.7861,14.2345,42.3992,0,0); //
AddStaticVehicle(417,-1224.9152,-8.8570,14.2032,41.0922,0,0); //
AddStaticVehicle(476,-1368.5308,-477.6551,14.8849,207.7888,1,6); //
AddStaticVehicle(476,-1449.9143,-518.7295,14.8863,205.9380,1,6); //
AddStaticVehicle(519,-1310.0516,-248.3463,15.0676,314.6583,1,1); //
AddStaticVehicle(470,-1335.8743,457.8990,7.1800,359.9965,43,0); //
AddStaticVehicle(470,-1347.8719,459.3749,7.1808,360.0000,43,0); //
AddStaticVehicle(470,-1340.4440,458.4810,7.1780,356.4070,43,0); //
AddStaticVehicle(425,-1449.0144,502.2148,18.8464,267.8859,43,0); //
AddStaticVehicle(520,-1263.9192,498.8093,19.3716,90.5882,0,0); //
AddStaticVehicle(520,-1293.3619,498.0452,18.9582,97.1403,0,0); //
// ---------------------------------------------------------------------------------------
SetTimer("proxcheck",1000,1);
new string[256];
print(" ");
print(" ");
print("tAxI's Dynamic Vehicle Streamer v0.1");
print(" ");
print("-----------------------------------------------------------------");
print(" ");
format(string,sizeof(string),"tAxI's Dynamic Vehicle Streamer has detected %d Vehicle Spawns...",vehcount);
printf(string);
print(" ");
format(string,sizeof(string),"Only %d spawns may be activated at any one time simultaneously...",MAX_ACTIVE_VEHICLES);
printf(string);
print(" ");
print("tAxI's Dynamic Vehicle Streamer is now running...ENJOY!!!");
print(" ");
print("-----------------------------------------------------------------");
print(" ");
print(" ");
print(" ");
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
SetTimerEx("DeactivateStreamedVehicle",6000,0,"x",vehicleid);
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
vehused[vehicleid] = 1;
return 1;
}
public proxcheck()
{
for(new i = 1;i<vehcount;i++) {
if(VehicleInfo[i][spawned] == 0) {
if(IsPlayerClose(i,SPAWN_DISTANCE) == 1) {
if(streamcount <= MAX_ACTIVE_VEHICLES) {
if(modelcount[VehicleInfo[i][model]] < MAX_ACTIVE_MODELS) {
VehicleInfo[i][idnum] = CreateVehicle(VehicleInfo[i][model], VehicleInfo[i][x_spawn], VehicleInfo[i][y_spawn], VehicleInfo[i][z_spawn], VehicleInfo[i][za_spawn], VehicleInfo[i][color_1], VehicleInfo[i][color_2],11000);
VehicleInfo[i][spawned] = 1;
modelcount[VehicleInfo[i][model]]++;
streamcount++;
}
}
}
}
else {
if(vehused[VehicleInfo[i][idnum]] == 0) {
if(IsPlayerClose(i,SPAWN_DISTANCE) == 0) {
DestroyVehicle(VehicleInfo[i][idnum]);
VehicleInfo[i][spawned] = 0;
modelcount[VehicleInfo[i][model]]--;
streamcount--;
}
}
}
}
}
stock AddStreamingVehicle(modelid,Float:x,Float:y,Float:z,Float:a,col1,col2)
{
vehcount++;
VehicleInfo[vehcount][model] = modelid;
VehicleInfo[vehcount][x_spawn] = x;
VehicleInfo[vehcount][y_spawn] = y;
VehicleInfo[vehcount][z_spawn] = z;
VehicleInfo[vehcount][za_spawn] = a;
VehicleInfo[vehcount][color_1] = col1;
VehicleInfo[vehcount][color_2] = col2;
return 1;
}
stock DeactivateStreamedVehicle(vehicleid)
{
vehused[vehicleid] = 0;
return 1;
}
stock IsPlayerClose(streamid, Float:MAX)
{
for(new i = 0;i<MAX_PLAYERS;i++) {
new Float:PPos[3];
GetPlayerPos(i, PPos[0], PPos[1], PPos[2]);
if (PPos[0] >= floatsub(VehicleInfo[streamid][x_spawn], MAX) && PPos[0] <= floatadd(VehicleInfo[streamid][x_spawn], MAX)
&& PPos[1] >= floatsub(VehicleInfo[streamid][y_spawn], MAX) && PPos[1] <= floatadd(VehicleInfo[streamid][y_spawn], MAX)
&& PPos[2] >= floatsub(VehicleInfo[streamid][z_spawn], MAX) && PPos[2] <= floatadd(VehicleInfo[streamid][z_spawn], MAX))
{
return 1;
}
}
return 0;
}
RegEdit, а не хотя тот что ты и говорил!