Is this right(With the one Team):
for i = 1, World_GetPlayerCount() do
local player = World_GetPlayerAt(i)
--team 0 or 1
if Player_GetTeam(player) == 0 then
local _vehicleAbilities = {
"mechanized_grenadier_group", "supply_truck", "tiger_tank", "mortar_halftrack", "elefant_unlock", "tiger_tank_ace", "stug_short_barrel", "stug_iii_e", "armor_commander",
"mechanized_assault_group", "cmd_kv-8_unlock_mp", "cmd_advanced_t34_85_medium_tank", "cmd_t34_85_medium_tank", "cmd_isu-152", "cmd_is2_heavy_tank", "cmd_kv-1_unlock","kv-2",
}
local SBP_IsVehicle = function(sbp)
--Skip problematic squads (pak creates splats, panzer_iii causes an error due to not existing yet)
local _skip_sbp = {
[1] = {
name = "pak43",
isVehcle = true,
},
[2] = {
name = "panzer_iii",
isVehcle = true,
},
[3] = {
name = "pm-82_41_mortar_squad_mp",
isVehcle = true,
},
[4] = {
name = "hm-120_38_mortar_squad_mp",
isVehcle = true,
},
[5] = {
name = "partisan_squad_granatewerfer_34_81mm_mortar_mp",
isVehcle = true,
},
[6] = {
name = "partisan_squad_pm-82_41_mortar_mp",
isVehcle = true,
},
[7] = {
name = "granatewerfer_34_81mm_mortar_mp",
isVehcle = true,
},
}
local isVehcle = false
local pos = World_Pos(-512, -512, -512)
local skipSBP = false
for key, _sbp in ipairs(_skip_sbp) do
if string.find(BP_GetName(sbp), _sbp.name) then
isVehcle = _sbp.isVehcle
skipSBP = true
end
end
if not skipSBP then
local squad = Squad_CreateAndSpawnToward(sbp, World_GetPlayerAt(1), 1, pos, pos)
local entity = Squad_EntityAt(squad, 0)
if Entity_IsOfType(entity, "vehicle") and not Entity_IsOfType(entity, "team_weapon") then
isVehcle = true
else
isVehcle = false
end
Squad_Destroy(squad)
end
return isVehcle
end
for key, race in pairs(SBP) do
for key, sbp in pairs(race) do
if SBP_IsVehicle(sbp) then
for i = 1, World_GetPlayerCount() do
Player_SetSquadProductionAvailability(World_GetPlayerAt(i), sbp, ITEM_REMOVED)
end
end
end
end
for key, abp in ipairs(_vehicleAbilities) do
for i = 1, World_GetPlayerCount() do
Player_SetAbilityAvailability(World_GetPlayerAt(i), BP_GetAbilityBlueprint(abp), ITEM_REMOVED)
end
end
end
end
or this:
for i = 1, World_GetPlayerCount() do
local player = World_GetPlayerAt(i)
--team 0 or 1
if Player_GetTeam(player) == 0 then
-- disable vehicles
end
end
local _vehicleAbilities = {
"mechanized_grenadier_group", "supply_truck", "tiger_tank", "mortar_halftrack", "elefant_unlock", "tiger_tank_ace", "stug_short_barrel", "stug_iii_e", "armor_commander",
"mechanized_assault_group", "cmd_kv-8_unlock_mp", "cmd_advanced_t34_85_medium_tank", "cmd_t34_85_medium_tank", "cmd_isu-152", "cmd_is2_heavy_tank", "cmd_kv-1_unlock","kv-2",
}
local SBP_IsVehicle = function(sbp)
--Skip problematic squads (pak creates splats, panzer_iii causes an error due to not existing yet)
local _skip_sbp = {
[1] = {
name = "pak43",
isVehcle = true,
},
[2] = {
name = "panzer_iii",
isVehcle = true,
},
[3] = {
name = "pm-82_41_mortar_squad_mp",
isVehcle = true,
},
[4] = {
name = "hm-120_38_mortar_squad_mp",
isVehcle = true,
},
[5] = {
name = "partisan_squad_granatewerfer_34_81mm_mortar_mp",
isVehcle = true,
},
[6] = {
name = "partisan_squad_pm-82_41_mortar_mp",
isVehcle = true,
},
[7] = {
name = "granatewerfer_34_81mm_mortar_mp",
isVehcle = true,
},
}
local isVehcle = false
local pos = World_Pos(-512, -512, -512)
local skipSBP = false
for key, _sbp in ipairs(_skip_sbp) do
if string.find(BP_GetName(sbp), _sbp.name) then
isVehcle = _sbp.isVehcle
skipSBP = true
end
end
if not skipSBP then
local squad = Squad_CreateAndSpawnToward(sbp, World_GetPlayerAt(1), 1, pos, pos)
local entity = Squad_EntityAt(squad, 0)
if Entity_IsOfType(entity, "vehicle") and not Entity_IsOfType(entity, "team_weapon") then
isVehcle = true
else
isVehcle = false
end
Squad_Destroy(squad)
end
return isVehcle
end
for key, race in pairs(SBP) do
for key, sbp in pairs(race) do
if SBP_IsVehicle(sbp) then
for i = 1, World_GetPlayerCount() do
Player_SetSquadProductionAvailability(World_GetPlayerAt(i), sbp, ITEM_REMOVED)
end
end
end
end
for key, abp in ipairs(_vehicleAbilities) do
for i = 1, World_GetPlayerCount() do
Player_SetAbilityAvailability(World_GetPlayerAt(i), BP_GetAbilityBlueprint(abp), ITEM_REMOVED)
end
end
end
Or did I misunderstood it again....