All pastes #761275 Raw Edit

Mine

public text v1 · immutable
·published 2007-11-04 19:21 UTC
rendered paste body
public proxcheck()
{
	for(new i = 1;i<vehcount;i++) {
		if(VehicleInfo[i][spawned] == 0) {
			if(IsPlayerClose(i,SPAWN_DISTANCE)) {
			    if (streamcount <= MAX_ACTIVE_VEHICLES) {
					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)) {
            		DestroyVehicle(VehicleInfo[i][idnum]);
            		VehicleInfo[i][spawned] = 0;
                    modelcount[VehicleInfo[i][model]]--;
					streamcount--;
				}
			}
		}
	}
}

stock IsPlayerClose(streamid, Float:MAX)
{
    for(new i = 0;i<MAX_PLAYERS;i++) {
		new Float:PPos[3];
   		if(IsPlayerConnected(i)) {
    		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 true;
			}
		}
	}
	return false;
}