houseE = {} placex,placey,placez,placeay = {},{},{},{} local testing = 1 function place_houses_init(e) placehouses() end function place_houses_main(e) if testing == 1 then if g_KeyPressE == 1 then if pressE == 0 then pressE = 1 placehouses() end else pressE = 0 end end end function placehouses() local place_taken = {} local max_places = 0 for a,b in pairs (houseE) do max_places = max_places + 1 place_taken[max_places] = 0 --PromptDuration("place_taken ["..a.."] = 0",2000) end --PromptDuration("placing houses..",2000) for a,b in pairs (houseE) do local place = 0 local tries = 0 repeat tries = tries + 1 place = math.random(1,max_places) until place_taken[place] == 0 or tries > 99 if tries < 100 then local tp = 0 for c,d in pairs (houseE) do tp = tp + 1 if tp == place then CollisionOff(a) SetPosition(a,placex[c],placey[c],placez[c]) SetRotation(a,0,placeay[c],0) CollisionOn(a) place_taken[place] = 1 break end end end end end