native SetStructEnt(Handle:struct, const String:member[], ent);
| 380 | |
| 381 | //native SetStructEnt(Handle:struct, const String:member[], ent); |
| 382 | static cell_t SetStructEnt(IPluginContext *pContext, const cell_t *params) |
| 383 | { |
| 384 | Handle_t hndl = static_cast<Handle_t>(params[1]); |
| 385 | HandleError err; |
| 386 | HandleSecurity sec; |
| 387 | |
| 388 | sec.pOwner = NULL; |
| 389 | sec.pIdentity = myself->GetIdentity(); |
| 390 | |
| 391 | StructHandle *pHandle; |
| 392 | if ((err = g_pHandleSys->ReadHandle(hndl, g_StructHandle, &sec, (void **)&pHandle)) |
| 393 | != HandleError_None) |
| 394 | { |
| 395 | return pContext->ThrowNativeError("Invalid struct handle %x (error %d)", hndl, err); |
| 396 | } |
| 397 | |
| 398 | char *member; |
| 399 | pContext->LocalToString(params[2], &member); |
| 400 | |
| 401 | CBaseHandle *value; |
| 402 | if (!pHandle->GetEHandle(member, &value)) |
| 403 | { |
| 404 | return pContext->ThrowNativeError("Invalid member, or incorrect data type"); |
| 405 | } |
| 406 | |
| 407 | edict_t *pEdict = GetEdict(params[3]); |
| 408 | |
| 409 | if (pEdict == NULL) |
| 410 | { |
| 411 | return pContext->ThrowNativeError("Invalid entity %i", params[3]); |
| 412 | } |
| 413 | |
| 414 | IServerEntity *pEntOther = pEdict->GetIServerEntity(); |
| 415 | value->Set(pEntOther); |
| 416 | |
| 417 | if (!pHandle->SetEHandle(member, value)) |
| 418 | { |
| 419 | return pContext->ThrowNativeError("Invalid member, or incorrect data type"); |
| 420 | } |
| 421 | |
| 422 | return 1; |
| 423 | } |
| 424 | |
| 425 | static cell_t GetWeaponStruct(IPluginContext *pContext, const cell_t *params) |
| 426 | { |
nothing calls this directly
no test coverage detected