Hi, everyone. I could use some help from you.
As what the title says, that's what I have trouble with. I have this neat piece of code here to create clones.
PHP Code:
void TamperModel(int client, bool apply)
{
if (apply)
{
float realOrigin[3], realAngles[3];
GetEntPropVector(client, Prop_Send, "m_vecOrigin", realOrigin);
GetClientEyeAngles(client, realAngles);
realAngles[0] += 90.0;
char currentModel[PLATFORM_MAX_PATH];
GetEntPropString(client, Prop_Data, "m_ModelName", currentModel, sizeof(currentModel));
int fakeModel = CreateEntityByName("prop_dynamic_override");
SetEntityModel(fakeModel, currentModel);
TeleportEntity(fakeModel, realOrigin, realAngles, NULL_VECTOR);
DispatchSpawn(fakeModel);
SetEntityRenderMode(fakeModel, RENDER_NORMAL);
SetEntityRenderColor(fakeModel, 255, 255, 255, 255);
SetEntProp(fakeModel, Prop_Send, "m_CollisionGroup", 0);
SetEntProp(fakeModel, Prop_Send, "m_nSolidType", 6);
SetEntPropFloat(fakeModel, Prop_Send, "m_fadeMinDist", 10000.0);
SetEntPropFloat(fakeModel, Prop_Send, "m_fadeMaxDist", 20000.0);
modelFake[client] = fakeModel;
SetEntityMoveType(client, MOVETYPE_WALK); //real player still doesn't walk afterwards
SDKHook(client, SDKHook_SetTransmit, BugModel);
CreateTimer(0.1, ProcessFakeModel, client, TIMER_REPEAT);
}
else
{
SDKUnhook(client, SDKHook_SetTransmit, BugModel);
if (IsValidEnt(modelFake[client]))
{
AcceptEntityInput(modelFake[client], "Kill");
modelFake[client] = 0;
}
}
}
public Action ProcessFakeModel(Handle timer, any client)
{
if (!IsValidEnt(modelFake[client]))
{
return Plugin_Stop;
}
int currentSequence = GetEntProp(client, Prop_Send, "m_nSequence");
float currentOrigin[3], currentAngles[3];
GetEntPropVector(client, Prop_Send, "m_vecOrigin", currentOrigin);
GetClientEyeAngles(client, currentAngles);
currentAngles[0] += 90.0;
SetEntProp(modelFake[client], Prop_Send, "m_nSequence", currentSequence);
TeleportEntity(modelFake[client], currentOrigin, currentAngles, NULL_VECTOR);
return Plugin_Continue;
}
public Action BugModel(int entity, int client)
{
return Plugin_Handled;
}
As you can see, it follows the real player's sequence while making the real player hidden but the problem is already stated there, the real player acts as if it was climbing on a ladder, teleporting to where the clone was after removing it.