native GetStructEnt(Handle:struct, const String:member[], &ent);
| 351 | |
| 352 | //native GetStructEnt(Handle:struct, const String:member[], &ent); |
| 353 | static cell_t GetStructEnt(IPluginContext *pContext, const cell_t *params) |
| 354 | { |
| 355 | Handle_t hndl = static_cast<Handle_t>(params[1]); |
| 356 | HandleError err; |
| 357 | HandleSecurity sec; |
| 358 | |
| 359 | sec.pOwner = NULL; |
| 360 | sec.pIdentity = myself->GetIdentity(); |
| 361 | |
| 362 | StructHandle *pHandle; |
| 363 | if ((err = g_pHandleSys->ReadHandle(hndl, g_StructHandle, &sec, (void **)&pHandle)) |
| 364 | != HandleError_None) |
| 365 | { |
| 366 | return pContext->ThrowNativeError("Invalid struct handle %x (error %d)", hndl, err); |
| 367 | } |
| 368 | |
| 369 | char *member; |
| 370 | pContext->LocalToString(params[2], &member); |
| 371 | |
| 372 | CBaseHandle *value; |
| 373 | if (!pHandle->GetEHandle(member, &value)) |
| 374 | { |
| 375 | return pContext->ThrowNativeError("Invalid member, or incorrect data type"); |
| 376 | } |
| 377 | |
| 378 | return CheckBaseHandle(*value); |
| 379 | } |
| 380 | |
| 381 | //native SetStructEnt(Handle:struct, const String:member[], ent); |
| 382 | static cell_t SetStructEnt(IPluginContext *pContext, const cell_t *params) |
nothing calls this directly
no test coverage detected