Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma semicolon 1
- #define DEBUG
- #define PLUGIN_AUTHOR "DeathChaos25"
- #define PLUGIN_VERSION "1.00"
- static PreviousAnimation[MAXPLAYERS + 1] = -1;
- static CloneModel[MAXPLAYERS + 1] = 0;
- new PropOff_nSequence;
- #include <sourcemod>
- #include <sdktools>
- #include <sdkhooks>
- public Plugin myinfo =
- {
- name = "[L4D2] Clone",
- author = PLUGIN_AUTHOR,
- description = "",
- version = PLUGIN_VERSION,
- url = ""
- };
- public void OnPluginStart()
- {
- PropOff_nSequence = FindSendPropInfo("CTerrorPlayer", "m_nSequence");
- RegConsoleCmd("sm_view", ViewAngles);
- RegConsoleCmd("sm_ang", ChangeAngles);
- RegConsoleCmd("sm_pos", ChangePosition);
- }
- public void OnGameFrame()
- {
- for (new client = 1; client <= MaxClients; client++)
- {
- if (IsSurvivor(client) && !IsFakeClient(client) && IsPlayerAlive(client))
- {
- new sequence = GetEntData(client, PropOff_nSequence);
- if (CloneModel[client] <= 0 || !IsValidEntity(CloneModel[client]))
- {
- decl Float:vAngles[3];
- decl Float:vOrigin[3];
- GetClientAbsOrigin(client, vOrigin);
- GetClientAbsAngles(client, vAngles);
- decl String:playerModel[128];
- GetEntPropString(client, Prop_Data, "m_ModelName", playerModel, sizeof(playerModel));
- new clone = CreateEntityByName("prop_dynamic_override");
- SetEntityModel(clone, playerModel);
- SetEntProp(clone, Prop_Data, "m_CollisionGroup", 2);
- decl String:sTemp[16];
- Format(sTemp, sizeof(sTemp), "target%d", client);
- DispatchKeyValue(client, "targetname", sTemp);
- SetVariantString(sTemp);
- AcceptEntityInput(clone, "SetParent", clone, clone, 0);
- SetVariantString("bleedout"); //pistol legL
- AcceptEntityInput(clone, "SetParentAttachment");
- //TeleportEntity(clone, vOrigin, vAngles, NULL_VECTOR);
- SetEntPropFloat(clone, Prop_Send, "m_flPlaybackRate", GetEntPropFloat(client, Prop_Send, "m_flPlaybackRate"));
- SetEntData(clone, PropOff_nSequence, sequence);
- //SetEntProp(client, Prop_Send, "m_bDrawViewmodel", 0);
- //SetEntityRenderMode(client, RENDER_NONE);
- CloneModel[client] = clone;
- //ang -80 0 -90
- //pos -10 -40 -20
- new Float:pos[3], Float:ang[3];
- ang[0] = -80.0;
- ang[1] = 0.0;
- ang[2] = -90.0;
- pos[0] = -10.0;
- pos[1] = -40.0;
- pos[2] = -20.0;
- TeleportEntity(CloneModel[client], pos, ang, NULL_VECTOR);
- }
- //float CCSPlayer::GetPlayerMaxSpeed()
- if (!PreviousAnimation[client])
- {
- PreviousAnimation[client] = sequence;
- }
- else if (PreviousAnimation[client] != sequence && PreviousAnimation[client] > 0)
- {
- new Float:angs[3];
- GetEntPropVector(client, Prop_Send, "m_angRotation", angs);
- SetEntPropFloat(CloneModel[client], Prop_Send, "m_flPlaybackRate", GetEntPropFloat(client, Prop_Send, "m_flPlaybackRate"));
- SetEntData(CloneModel[client], PropOff_nSequence, sequence);
- for (new i = 0; i < 92; i += 4)
- {
- new prop = FindSendPropInfo("CTerrorPlayer", "m_flPoseParameter");
- new prop2 = FindSendPropInfo("CDynamicProp", "m_flPoseParameter");
- new value = GetEntData(client, prop + (i));
- SetEntData(CloneModel[client], prop2 + (i), value);
- }
- SetEntPropFloat(CloneModel[client], Prop_Send, "m_flCycle", GetEntPropFloat(client, Prop_Send, "m_flCycle"));
- }
- }
- }
- }
- stock bool:IsSurvivor(client)
- {
- return client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2;
- }
- SetVector(Float:target[3], Float:x, Float:y, Float:z)
- {
- target[0] = x;
- target[1] = y;
- target[2] = z;
- }
- public Action:ViewAngles(client, args)
- {
- new Float:angles[3];
- GetEntPropVector(CloneModel[client], Prop_Send, "m_vecAngles", angles);
- PrintToChatAll("%f %f %f", angles[0], angles[1], angles[2]);
- }
- public Action:ChangeAngles(client, args)
- {
- new String:buffer[32];
- new Float:x, Float:y, Float:z, Float:ang[3];
- GetCmdArg(1, buffer, sizeof(buffer));
- x = StringToFloat(buffer);
- GetCmdArg(2, buffer, sizeof(buffer));
- y = StringToFloat(buffer);
- GetCmdArg(3, buffer, sizeof(buffer));
- z = StringToFloat(buffer);
- SetVector(ang, x, y, z);
- if (CloneModel[client] > 0 && IsValidEntS(CloneModel[client], "prop_dynamic_override"))
- {
- TeleportEntity(CloneModel[client], NULL_VECTOR, ang, NULL_VECTOR);
- }
- }
- public Action:ChangePosition(client, args)
- {
- new String:buffer[32];
- new Float:x, Float:y, Float:z, Float:ang[3];
- GetCmdArg(1, buffer, sizeof(buffer));
- x = StringToFloat(buffer);
- GetCmdArg(2, buffer, sizeof(buffer));
- y = StringToFloat(buffer);
- GetCmdArg(3, buffer, sizeof(buffer));
- z = StringToFloat(buffer);
- SetVector(ang, x, y, z);
- if (CloneModel[client] > 0 && IsValidEntS(CloneModel[client], "prop_dynamic_override"))
- {
- TeleportEntity(CloneModel[client], ang, NULL_VECTOR, NULL_VECTOR);
- }
- }
- IsValidEntS(ent, String:classname[64])
- {
- if (IsValidEnt(ent))
- {
- decl String:name[64];
- GetEdictClassname(ent, name, 64);
- if (StrEqual(classname, name))
- {
- return true;
- }
- }
- return false;
- }
- IsValidEnt(ent)
- {
- if (ent > 0 && IsValidEdict(ent) && IsValidEntity(ent))
- {
- return true;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement