Beaverboys |
05-25-2015 02:34 |
How to control fake client movement?
I've created a bot using CreateFakeClient and I'm writing code inside of OnGameFrame to try to control it. The code is based largely on an AMXX plugin and I don't know what to replace EngFunc_RunPlayerMove with.
PHP Code:
public OnGameFrame() { static id, buttons, IsUserClose, msec, Float:floatvar[3], Float:targ_origin[3], Float:v_length; global_get(glb_frametime, v_length); msec = RoundFloat(v_length * 1000.0);
for (id = 1; id <= IsBot[31]; id++) if (PumpFake[id] > 0) PumpFake[id] += 4; else if (IsBot[id]) if (IsPlayerAlive(id)) { GetEntPropVector(id, Prop_Send, "m_vecOrigin", floatvar); targ_origin = TargetOrigin[id], targ_origin[2] = floatvar[2]; IsUserClose = (GetVectorDistance(floatvar, targ_origin) > 30.0) ? 0 : 1, buttons = 0;
if (!IsUserClose) { targ_origin[0] -= floatvar[0], targ_origin[1] -= floatvar[1], targ_origin[2] -= floatvar[2]; v_length = GetVectorLength(targ_origin); targ_origin[0] /= v_length, targ_origin[1] /= v_length, targ_origin[2] /= v_length; GetVectorAngles(targ_origin, floatvar); floatvar[0] *= -1; if (floatvar[1] > 180.0) floatvar[1] -= 360; else if (floatvar[1] < -180.0) floatvar[1] += 360; else if (floatvar[1] == 180.0 || floatvar[1] == -180.0) floatvar[1] = -179.999999;
SetEntPropVector(id, Prop_Data, "m_angEyeAngles", floatvar); floatvar[0] /= -3.0; SetEntPropVector(id, Prop_Data, "m_vecAngles", floatvar); } else if (Snapstat != 0 || TeamWithBall == (GetClientTeam(id) - 1)) buttons = (Snapstat == 0 && (id == TCenter || id == CTCenter)) ? IN_DUCK : IN_ATTACK;
engfunc(EngFunc_RunPlayerMove, id, floatvar, (!IsUserClose && Snapstat != 2 && !(Kicking && !Snapstat) && GameActive) ? 400.0 : 0.0, 0.0, 0.0, buttons, 0, msec); } }
I also need to figure out what to replace "global_get(glb_frametime, v_length)" with.
|