I haven't tested this yet, but I think this should do the trick
RegisterOutputEvent("FxDTSbrick", "BotDropItem", "DataBlock ItemData", false);
RegisterOutputEvent("Player", "BotDropItem", "DataBlock ItemData", false);
function FxDTSbrick::BotDropItem(%brick, %item)
{
if(isObject(%bot = %brick.vehicle) && %bot.getClassName) $= "AIplayer")
{
%drop = new item()
{
datablock = %item;
canPickup = true;
rotate = true;
};
%drop.position = %bot.getPosition);
}
}
function Player::BotDropItem(%bot, %item)
{
if(isObject(%bot) && %bot.getClassName() $= "AIplayer")
{
%drop = new item()
{
datablock = %item;
canPickup = true;
rotate = true;
};
%drop.position = %bot.getPosition();
}
}
edit: What the heck, it says getClassName() isn't a function! I'm going to try to do %bot.getClassName() instead.
double edit: Ok, it works now, but if you pick up the item while you are in a minigame, it will say "item is not in minigame."
Is this acceptable or should I fix this?
Latest edit: added rotate. Will add random thing in just a bit.