generated from ClaudiuHKS/AdvancedQuakeSounds
-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathreset_score_command.sp
165 lines (137 loc) · 4.97 KB
/
reset_score_command.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
/**
* MAIN REQUIREMENTS
*/
#include <sourcemod>
#include <sdktools>
#include <cstrike>
/**
* CUSTOM DEFINITIONS
*/
#define _PREP_OFFS_(%0,%1,%2) if (%1 < 1) %1 = _Get_Offs_(%0, %2)
/**
* CUSTOM INFORMATION
*/
public Plugin myinfo =
{
name = "Reset Score Command",
author = "CARAMEL® HACK",
description = "Provides Commands To Reset The Score",
version = __DATE__,
url = "https://hattrick.go.ro/",
};
/**
* CUSTOM PRIVATE FUNCTIONS
*/
static int _Get_Offs_(int nEntity, const char[] szProp)
{
static const char szTables[][] =
{
"CBaseEntity", "CBaseCSEntity",
"CBasePlayer", "CBaseCSPlayer",
"CBaseGrenade", "CBaseCSGrenade",
"CBaseGrenadeProjectile", "CBaseCSGrenadeProjectile",
"CBasePlayerResource", "CBaseCSPlayerResource",
"CBaseViewModel", "CBaseCSViewModel",
"CBaseC4", "CBaseCSC4",
"CBaseAnimating", "CBaseCSAnimating",
"CBaseCombatCharacter", "CBaseCSCombatCharacter",
"CBaseCombatWeapon", "CBaseCSCombatWeapon",
"CBaseWeaponWorldModel", "CBaseCSWeaponWorldModel",
"CBaseRagdoll", "CBaseCSRagdoll",
"CEntity", "CSEntity", "CCSEntity",
"CPlayer", "CSPlayer", "CCSPlayer",
"CGrenade", "CSGrenade", "CCSGrenade",
"CGrenadeProjectile", "CSGrenadeProjectile", "CCSGrenadeProjectile",
"CPlayerResource", "CSPlayerResource", "CCSPlayerResource",
"CViewModel", "CSViewModel", "CCSViewModel",
"CC4", "CSC4", "CCSC4",
"CAnimating", "CSAnimating", "CCSAnimating",
"CCombatCharacter", "CSCombatCharacter", "CCSCombatCharacter",
"CCombatWeapon", "CSCombatWeapon", "CCSCombatWeapon",
"CWeaponWorldModel", "CSWeaponWorldModel", "CCSWeaponWorldModel",
"CRagdoll", "CSRagdoll", "CCSRagdoll",
};
static int nOffs = 0, nTable = 0;
if ((nOffs = FindDataMapInfo(nEntity, szProp)) > 0)
{
return nOffs;
}
for (nTable = 0; nTable < sizeof (szTables); nTable++)
{
if ((nOffs = FindSendPropInfo(szTables[nTable], szProp)) > 0)
{
return nOffs;
}
}
return nOffs;
}
/**
* CUSTOM PUBLIC FORWARDS
*/
public void OnClientSayCommand_Post(int nEntity, const char[] szCmd, const char[] szArgs)
{
if (!IsClientConnected(nEntity) || !IsClientInGame(nEntity))
{
return;
}
if
(
strcmp(szArgs, "rs", false) == 0
||
strcmp(szArgs, "reset", false) == 0
||
strcmp(szArgs, "restart", false) == 0
||
strcmp(szArgs, "rscore", false) == 0
||
strcmp(szArgs, "resetscore", false) == 0
||
strcmp(szArgs, "restartscore", false) == 0
||
strcmp(szArgs, "!rs", false) == 0
||
strcmp(szArgs, "!reset", false) == 0
||
strcmp(szArgs, "!restart", false) == 0
||
strcmp(szArgs, "!rscore", false) == 0
||
strcmp(szArgs, "!resetscore", false) == 0
||
strcmp(szArgs, "!restartscore", false) == 0
||
strcmp(szArgs, "/rs", false) == 0
||
strcmp(szArgs, "/reset", false) == 0
||
strcmp(szArgs, "/restart", false) == 0
||
strcmp(szArgs, "/rscore", false) == 0
||
strcmp(szArgs, "/resetscore", false) == 0
||
strcmp(szArgs, "/restartscore", false) == 0
)
{
CreateTimer(0.000001, _Timer_Zero_Score_, GetClientUserId(nEntity), TIMER_FLAG_NO_MAPCHANGE);
}
}
/**
* CUSTOM PUBLIC HANDLERS
*/
public Action _Timer_Zero_Score_(Handle hTimer, any nId)
{
static int m_iDeaths = 0, m_iFrags = 0, nEntity = 0;
if ((nEntity = GetClientOfUserId(nId)) > 0 && IsClientConnected(nEntity) && IsClientInGame(nEntity))
{
_PREP_OFFS_(nEntity, m_iDeaths, "m_iDeaths");
_PREP_OFFS_(nEntity, m_iFrags, "m_iFrags");
SetEntData(nEntity, m_iDeaths, 0);
SetEntData(nEntity, m_iFrags, 0);
CS_SetMVPCount(nEntity, 0);
CS_SetClientContributionScore(nEntity, 0);
CS_SetClientAssists(nEntity, 0);
PrintToChat(nEntity, " \x01Done.");
}
return Plugin_Continue;
}