MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / CheckBaseHandle

Function CheckBaseHandle

extensions/structs/natives.cpp:66–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66int CheckBaseHandle(CBaseHandle &hndl)
67{
68 if (!hndl.IsValid())
69 {
70 return -1;
71 }
72
73 int index = hndl.GetEntryIndex();
74
75 edict_t *pStoredEdict;
76 CBaseEntity *pStoredEntity;
77
78 pStoredEdict = GetEntity(index, &pStoredEntity);
79
80 if (pStoredEdict == NULL || pStoredEntity == NULL)
81 {
82 return -1;
83 }
84
85 IServerEntity *pSE = pStoredEdict->GetIServerEntity();
86
87 if (pSE == NULL)
88 {
89 return -1;
90 }
91
92 if (pSE->GetRefEHandle() != hndl)
93 {
94 return -1;
95 }
96
97 return index;
98}
99
100//native GetStructInt(Handle:struct, const String:member[]);
101static cell_t GetStructInt(IPluginContext *pContext, const cell_t *params)

Callers 1

GetStructEntFunction · 0.70

Calls 2

GetEntityFunction · 0.70
IsValidMethod · 0.45

Tested by

no test coverage detected