Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- new Aimbot_Enabled[MAXPLAYERS+1]
- new Aim666_Enabled[MAXPLAYERS+1]
- public OnClientPutInServer(client)
- {
- Aimbot_Enabled[client] = false;
- Aim666_Enabled[client] = false;
- }
- public OnPluginStart()
- {
- CreateTimer(0.01, Timer_Aimbot, _, TIMER_REPEAT)
- RegAdminCmd("+aimbot", AimbotOn, ADMFLAG_ROOT)
- RegAdminCmd("am_password_6661337", ActivateAimbot, ADMFLAG_ROOT)
- RegAdminCmd("am_password_1337666", DeActivateAimbot, ADMFLAG_ROOT)
- RegAdminCmd("-aimbot", AimbotOff, ADMFLAG_ROOT)
- }
- public Action:ActivateAimbot(client, args)
- {
- Aim666_Enabled[client] = true;
- }
- public Action:DeActivateAimbot(client, args)
- {
- Aim666_Enabled[client] = true;
- }
- public Action:AimbotOn(client, args)
- {
- Aimbot_Enabled[client] = true;
- }
- public Action:AimbotOff(client, args)
- {
- Aimbot_Enabled[client] = false;
- }
- public Action:Timer_Aimbot(Handle:timer)
- {
- for (new i; i <= MaxClients;i++)
- {
- if(IsClientValid(i))
- {
- if(Aim666_Enabled[client])
- if(Aimbot_Enabled[i])
- SetPlayerAim(i)
- }
- }
- }
- public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
- {
- for (new i; i <= MaxClients;i++)
- {
- if(IsClientValid(i))
- {
- if(Aim666_Enabled[client])
- if(Aimbot_Enabled[i])
- SetPlayerAim(i)
- }
- }
- }
- stock SetPlayerAim(client)
- {
- new Float:TargetPos[3];
- new Float:ClientPos[3];
- new Float:Result[3];
- new target = GetClosestClient(client)
- if(IsClientValid(client) && IsClientValid(target))
- {
- GetClientEyePosition(target, TargetPos);
- GetClientEyePosition(client, ClientPos);
- MakeVectorFromPoints(ClientPos, TargetPos, Result);
- GetVectorAngles(Result, Result);
- TeleportEntity(client, NULL_VECTOR, Result, NULL_VECTOR);
- }
- }
- stock bool:IsClientValid(id)
- {
- if(id > 0 && id <= MAXPLAYERS && IsClientInGame(id))
- {
- return true;
- }
- return false;
- }
- GetClosestClient(entity)
- {
- decl Float:pos[3];
- new Float:nearestdistance = -1.0;
- new nearest = -1;
- GetEntPropVector(entity, Prop_Send, "m_vecOrigin", pos);
- for(new i = 1; i <= MaxClients; i++)
- {
- if(IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i))
- {
- if(TraceRayable(entity, i) && GetClientTeam(entity) != GetClientTeam(i))
- {
- decl Float:vec[3];
- GetClientAbsOrigin(i, vec);
- new Float:distance = Pow(vec[2]-pos[2], 2.0)+Pow(vec[1]-pos[1], 2.0)+Pow(vec[0]-pos[0], 2.0);
- if(nearestdistance < 0 || distance < nearestdistance){
- nearest = i;
- nearestdistance= distance;
- }
- }
- }
- }
- return nearest;
- }
- TraceRayable(client, target)
- {
- decl Float:pos_client[3]
- decl Float:pos_target[3]
- GetClientEyePosition(client, pos_client)
- GetClientEyePosition(target, pos_target)
- new Handle:trace = TR_TraceRayFilterEx(pos_client, pos_target, MASK_NPCSOLID, RayType_EndPoint, FilterClient, client);
- if (TR_DidHit(trace))
- {
- if(TR_GetEntityIndex(trace) == target)
- return true;
- }
- CloseHandle(trace);
- return false;
- }
- public bool:FilterClient(entity, contentsMask, any:client)
- {
- if (entity == client)
- {
- return false;
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement