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

Function smn_PbSetString

core/smn_protobuf.cpp:449–474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

447}
448
449static cell_t smn_PbSetString(IPluginContext *pCtx, const cell_t *params)
450{
451 GET_MSG_FROM_HANDLE_OR_ERR();
452 GET_FIELD_NAME_OR_ERR();
453
454 char *strValue;
455 pCtx->LocalToString(params[3], &strValue);
456
457 int index = params[0] >= 4 ? params[4] : -1;
458 if (index < 0)
459 {
460 if (!msg->SetString(strField, strValue))
461 {
462 return pCtx->ThrowNativeError("Invalid field \"%s\" for message \"%s\"", strField, msg->GetProtobufMessage()->GetTypeName().c_str());
463 }
464 }
465 else
466 {
467 if (!msg->SetRepeatedString(strField, index, strValue))
468 {
469 return pCtx->ThrowNativeError("Invalid field \"%s\"[%d] for message \"%s\"", strField, index, msg->GetProtobufMessage()->GetTypeName().c_str());
470 }
471 }
472
473 return 1;
474}
475
476static cell_t smn_PbSetColor(IPluginContext *pCtx, const cell_t *params)
477{

Callers

nothing calls this directly

Calls 4

GetProtobufMessageMethod · 0.80
SetRepeatedStringMethod · 0.80
SetStringMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected