10.05.2015, 20:53
I looked at your code and decided to try to take away from it what I could and ended up with this:
However the issue hasn't changed much. The items now spawn in each of their own locations, but they are all the same item and not randomized.
pawn Код:
//all the current items you can get
new ItemSpawns[][2] =
{
{2806, 1}, //meat
{2806, 2}, //steak
{2663, 1}, //cram
{2663, 2}, //mac cheese
{2769, 1}, //iguana
{2769, 2}, //squirrel
{1580, 1}, //stimpak
{1580, 2}, //doc bag
{1575, 1}, //jet
{1575, 2}, //psycho
{1575, 3}, //mentats
{1575, 4}, //buffout
{2647, 1}, //dirty water
{2647, 2}, //pure water
{1484, 1}, //nuka
{1577, 1}, //radaway
{373, 1}, //armor
{333, 1}, //golf club
{334, 1}, //baton
{335, 1}, //combat knife
{336, 1}, //bat
{337, 1}, //shovel
{338, 1}, //pool cue
{339, 1}, //katana
{346, 1}, //colt 45
{348, 1}, //deagle
{349, 1}, //shotgun
{351, 1}, //spaz
{353, 1}, //smg
{356, 1}, //m4
{357, 1}, //rifle
{358, 1}, //sniper
{2358, 1}, //pistol ammo
{2358, 2}, //shotgun ammo
{2358, 3}, //smg ammo
{2358, 4}, //assault rifle ammo
{2358, 5} //rifle ammo
};
pawn Код:
forward LootRespawn();
public LootRespawn()
{
new Items = random(sizeof(ItemSpawns));
new amount = randomEx(1, 10);
for(new i=0; i<MAX_ITEMS; i++)
{
DeleteAllItems(i);
if(ItemSpawns[Items][0] == 333 || ItemSpawns[Items][0] == 334 || ItemSpawns[Items][0] == 335 || ItemSpawns[Items][0] == 336 || ItemSpawns[Items][0] == 337 || ItemSpawns[Items][0] == 338 || ItemSpawns[Items][0] == 339 ||
ItemSpawns[Items][0] == 346 || ItemSpawns[Items][0] == 348 || ItemSpawns[Items][0] == 349 || ItemSpawns[Items][0] == 351 || ItemSpawns[Items][0] == 353 || ItemSpawns[Items][0] == 356 || ItemSpawns[Items][0] == 357 ||
ItemSpawns[Items][0] == 338) amount = 1;
CreateItem(ItemSpawns[Items][0], amount, ItemSpawns[Items][1], 377.64130, 2542.36963, 15.53980, 0, 0);
CreateItem(ItemSpawns[Items][0], amount, ItemSpawns[Items][1], 381.50552, 2542.74146, 15.53976, 0, 0);
CreateItem(ItemSpawns[Items][0], amount, ItemSpawns[Items][1], 381.19205, 2539.23486, 15.54050, 0, 0);
CreateItem(ItemSpawns[Items][0], amount, ItemSpawns[Items][1], 378.27368, 2539.07715, 15.54048, 0, 0);
LoadItemVisual(i);
}
return 1;
}