brian smith gave me a randomizer script and we tried a few things but it still doesn't work for me. The console doesn't show any errors regarding the script.
$TTList = "";
function Player::addItem(%player,%image,%client)
{
for(%i = 0; %i < %player.getDatablock().maxTools; %i++)
{
%tool = %player.tool[%i];
if(%tool == 0)
{
%player.tool[%i] = %image;
%player.weaponCount++;
messageClient(%client,'MsgItemPickup','',%i,%image);
break;
}
}
}
function initTTList() {
for( %i=0; %i < datablockGroup.getCount(); %i++ ) {
%obj = datablockGroup.getObject( %i );
if( %obj.getClassName() $= "ItemData" ) {
$TTList = trim( $TTList SPC %obj.getID() );
}
}
}
function Player::getRandomWeapon(%player) {
%weapon = getWord( $TTList, getRandom( 0, getWordCount($TTList) - 1 ) );
%player.addItem( %weapon );
}
package TTGiveItem {
function gameConnection::spawnPlayer( %client ) {
%res = parent::spawnPlayer( %client );
if( $TTList $= "" )
initTTList();
if( isObject( %player = %client.player ) )
%player.getRandomWeapon();
return %res;
}
};
if( isPackage( TTGiveItem ) )
deactivatePackage( TTGiveItem );
activatepackage( TTGiveItem );
can you guys find any errors?