summaryrefslogtreecommitdiffstats
path: root/src/esp.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/esp.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/esp.cpp b/src/esp.cpp
index 1631df1..d32a8bc 100644
--- a/src/esp.cpp
+++ b/src/esp.cpp
@@ -187,6 +187,26 @@ bool esp_is_viewmodel_index(int idx) {
187 return model && (strstr(model, "/v_") || strstr(model, "\\v_")); 187 return model && (strstr(model, "/v_") || strstr(model, "\\v_"));
188} 188}
189 189
190// 0 = hostile, 1 = neutral, 2 = friendly, -1 = not an NPC.
191static bool npc_is_friendly(int idx, const char *model, int local_idx,
192 bool &neutral);
193int esp_npc_relation(int idx) {
194 if (!esp_is_npc_index(idx))
195 return -1;
196 int local = engine_get_local_player();
197 if (local <= 0)
198 return 0;
199 void *ent = entitylist_get(idx);
200 const char *model = ent ? entity_model_name(ent) : nullptr;
201 bool neutral = false;
202 bool friendly = npc_is_friendly(idx, model, local, neutral);
203 if (neutral)
204 return 1;
205 if (friendly)
206 return 2;
207 return 0;
208}
209
190static bool model_is_friendly(const char *m) { 210static bool model_is_friendly(const char *m) {
191 static const char *patterns[] = { 211 static const char *patterns[] = {
192 "citizen", "humans/", "male_", "female_", "barney", "alyx", 212 "citizen", "humans/", "male_", "female_", "barney", "alyx",