source-sdk-2013 icon indicating copy to clipboard operation
source-sdk-2013 copied to clipboard

(VScript) Server crash on attempt to fetch prop_vehicle_driveable datamaps

Open ocet247 opened this issue 9 months ago • 2 comments

Server crashes once you try to use a NetProps.GetTable with second parameter being the DataMap(1) on a prop_vehicle_driveable The following script replicates it:

local vehicle = Entities.CreateByClassname("prop_vehicle_driveable");
NetProps.GetTable(vehicle, 1, {}); 

Or this one works as well

local vehicle = SpawnEntityFromTable("prop_vehicle_driveable", {
	vehiclescript = "scripts/vehicles/airboat.txt",
	model = "models/buggy.mdl"
});
NetProps.GetTable(vehicle, 1, {}); 

ocet247 avatar Jun 15 '25 18:06 ocet247

It also affects bot_proxy

ocet247 avatar Jun 15 '25 18:06 ocet247

To add on to this, the crash seems to be specifically tied to the string-based datamap keyvalues.

As it crashes specifically when

g_pScriptVM->SetValue( hTable, pszPropName, (propString == NULL_STRING) ? "" : STRING(propString) );

is called in StoreDataPropValue.

From further testing, it seems that when I add the following code before that line the crash stops altogether. With the side effect of the netprops being read as "ERROR VALUE" until NetProps.GetPropString is called before NetProps.GetTable(vehicle, 1, {}); is called.

PropInfo_t propInfo = GetEntityPropInfo( pBaseEntity, pszPropName, iElement );
if ( !propInfo.m_IsPropValid )
{
	g_pScriptVM->SetValue( hTable, pszPropName, "ERROR VALUE" );
	break;
}

main-thing avatar Jun 18 '25 06:06 main-thing