function OnGameEvent_player_builtobject(params) {
if (!hasInitialized) {
return;
}
// note(jae): 2023-08-06
// From ZF Vanilla sourcemod, these are the mapping for "object"
// #define PLAYERBUILTOBJECT_ID_DISPENSER 0
// #define PLAYERBUILTOBJECT_ID_TELENT 1
// #define PLAYERBUILTOBJECT_ID_TELEXIT 2
// #define PLAYERBUILTOBJECT_ID_SENTRY 3
local object = params.object;
local index = params.index;
// 1. Handle dispenser rules.
// Disable dispensers when they begin construction.
// Increase max health to 250 (default level 1 is 150).
if(object == 0) {
local building = EntIndexToHScript(index);
NetProps.SetPropInt(building, "m_iMaxHealth", 250);
// Dispenser *seemingly* gets enabled after it's finished building, so lets
// disable it every second for 15 seconds to ensure it stays disabled
// after build.
//
// This also keeps it disabled after moving it.
for (local delayInSeconds = 0; delayInSeconds < 15; delayInSeconds++) {
EntFireByHandle(building, "Disable", "", delayInSeconds, null, null);
}
}
}
We have a fix sorted for next release: