forked from DarkGL/Admin-Aim-CS-GO-SourceMod-AimBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
adminaim.sp
149 lines (101 loc) · 3.26 KB
/
adminaim.sp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/* Plugin Template generated by Pawn Studio */
#include <sourcemod>
#include <sdkhooks>
#include <cstrike>
public Plugin:myinfo =
{
name = "Admin Aim",
author = "DarkGL",
description = "Admin Aim",
version = "1.1",
url = "https://darkgl.pl"
}
new bool:aimOn[ MAXPLAYERS ];
ConVar g_cvBlast;
ConVar g_cvKnife;
public OnPluginStart(){
RegAdminCmd("aim", aimMenu , ADMFLAG_BAN , "Admin Aim Menu" );
g_cvBlast = CreateConVar( "admin_aim_blast", "0", "HE/Fire Headshots" );
g_cvKnife = CreateConVar( "admin_aim_knife", "0", "Knife Headshots" );
}
public bool:OnClientConnect(client, String:rejectmsg[], maxlen){
aimOn[ client ] = false;
return true;
}
public OnClientDisconnect( client ){
aimOn[ client ] = false;
SDKUnhook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}
public OnClientPutInServer(client){
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}
public Action:aimMenu( client, args ){
createMenu( client );
return Plugin_Handled;
}
public createMenu( client ){
Menu menuHandle = new Menu( MenuHandler , MENU_ACTIONS_ALL );
menuHandle.SetTitle( "Admin Aim Menu" );
for( new iPlayer = 1 ; iPlayer <= MaxClients ; iPlayer++ ){
if( !IsClientConnected( iPlayer ) ){
continue;
}
new String:szName[ 64 ];
GetClientName( iPlayer , szName , sizeof( szName ) );
new String:szPlayer[ 128 ],
String:szDisplay[ 128 ];
Format( szPlayer , sizeof( szPlayer ) , "%d" , iPlayer );
Format( szDisplay , sizeof( szDisplay ) , "%s: %s" , szName , aimOn[ iPlayer ] ? "On":"Off" );
menuHandle.AddItem( szPlayer , szDisplay );
}
menuHandle.Display( client , MENU_TIME_FOREVER );
}
public MenuHandler( Menu menu, MenuAction action, int param1, int param2){
if (action == MenuAction_Select){
new String: szInfo[32];
GetMenuItem( menu, param2, szInfo, sizeof( szInfo ) - 1 );
new iPlayer = StringToInt( szInfo );
if( !IsClientInGame( iPlayer ) ){
return;
}
aimOn[ iPlayer ] = !aimOn[ iPlayer ];
delete menu;
createMenu( param1 );
}
}
public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &weapon, float damageForce[3], float damagePosition[3], int damagecustom){
if( !IsClientValid( victim ) || !IsClientValid( attacker ) ){
return Plugin_Continue;
}
if( !aimOn[ attacker ] ){
return Plugin_Continue;
}
PrintToServer( "%d" , damagetype );
if( damagetype & DMG_BULLET ){
damagetype |= CS_DMG_HEADSHOT;
damage = float(GetClientHealth(victim) + GetClientArmor(victim));
return Plugin_Changed;
}
if( GetConVarInt( g_cvBlast ) && damagetype & DMG_BLAST ){
damagetype |= CS_DMG_HEADSHOT;
damage = float(GetClientHealth(victim) + GetClientArmor(victim));
return Plugin_Changed;
}
if( GetConVarInt( g_cvBlast ) && damagetype & DMG_BURN ){
damagetype |= CS_DMG_HEADSHOT;
damage = float(GetClientHealth(victim) + GetClientArmor(victim));
return Plugin_Changed;
}
if( GetConVarInt( g_cvKnife ) && damagetype & DMG_SLASH ){
damagetype |= CS_DMG_HEADSHOT;
damage = float(GetClientHealth(victim) + GetClientArmor(victim));
return Plugin_Changed;
}
return Plugin_Continue;
}
stock bool IsClientValid(int client)
{
if(client > 0 && client <= MaxClients && IsClientInGame(client))
return true;
return false;
}