okay i solved it.
before you freeze it, get the entity origin and store it to global float variable like this:
PHP Code:
new Float:g_WorldPosition[3];
public Action:CMD_Freeze(client, args)
{
new ent = Entity_FindByHammerId(89937, "func_physbox");
new Float:iEntOrigin[3];
GetEntPropVector(ent, Prop_Send, "m_vecOrigin", iEntOrigin);
g_WorldPosition[0] = iEntOrigin[0];
g_WorldPosition[1] = iEntOrigin[1];
g_WorldPosition[2] = iEntOrigin[2] + 1.0; //Move it up just a little bit
SetEntityMoveType(ent, MOVETYPE_NONE);
PrintToChatAll("entity freezed");
return Plugin_Handled;
}
when you unfreeze it, use MOVETYPE_VPHYSICS and set the entity origin to what we made before:
PHP Code:
public Action:CMD_UnFreeze(client, args)
{
new ent = Entity_FindByHammerId(89937, "func_physbox");
SetEntityMoveType(ent, MOVETYPE_VPHYSICS);
TeleportEntity(ent, g_WorldPosition, NULL_VECTOR, NULL_VECTOR);
PrintToChatAll("unfreeze");
return Plugin_Handled;
}
i think it was stuck inside the ground before because there was moving ground under it that was not flat.
so it works when i teleport the entity slightly up like this g_WorldPosition[2] = iEntOrigin[2] + 1.0;