Thanks again Swollow. After messing around with code for a bit I have figured out a few things.
First off, it's not a good idea to call the indexing function before player datablocks are loaded (or any datablocks, for that matter). This makes calling the index function during code execution a bad idea because it only shows datablocks that have been loaded before the function. I decided to leave out player type objects/armor class because it also returns all playertypes that are parented to the standard player armor (rideable). I'm fine with only wheeled/flying vehicles in this case. It wouldnt be hard to make an exception for the horse uiName
For some reason I cannot call the getClassName() function on a datablock directly because %datablock.className is already a variable? Well that makes sense...
function serverCMDsetNextVehicle(%client,%vehicle)
{
//Cycle through datablocks
%size = datablockGroup.getCount();
for(%i=0;%i<%size;%i++)
{
%d = getDataBlock(%i);
if(%d.rideable $= true && %d.className $= "FlyingVehicleData" || %d.className $= "WheeledVehicleData")
{
echo("" @ %d.uiName@ "");
if(%d.uiName $= %vehicle)
{
echo("" @ %vehicle @ "");
%client.selectedVehicle = %d.getName();
bottomPrint(%client,"Next vehicle set to " @ %vehicle @ " ",2,true);
break;
}
}
}
}
When i echo the ui name it works, but if(%d.uiName $= %vehicle) always returns false unless left empty...but echoing %vehicle right after echoing the ui name returns input....wtf??