# Use Metadata to Store Additional Information

In this scenario, the player has had the opportunity to write / select their country to be displayed on the Leaderboard.

{% tabs %}
{% tab title="Unity" %}

```csharp
string leaderboardKey = "my_leaderboard";
int score = 1000;
string metadata = "country:" + PlayerPrefs.GetString("PlayerAssignedCountry"); // Replace PlayerPrefs.GetString("PlayerAssignedCountry") with an existing way of getting the configured country for the player in your game

LootLockerSDKManager.SubmitScore("", score, leaderboardKey, metadata, (response) =>
{
    if (!response.success) {
        Debug.Log("Could not submit score!");
        Debug.Log(response.errorData.ToString());
        return;
    } 
     Debug.Log("Successfully submitted score!\n with metadata: " + metadata);
});
```

{% endtab %}

{% tab title="Unreal BP" %}

<figure><img src="/files/il0CXwa27Ujs8evAyP6m" alt=""><figcaption><p><a href="https://blueprintue.com/blueprint/0kaq77rd/">Blueprint example of submitting a score with country as metadata</a></p></figcaption></figure>
{% endtab %}

{% tab title="Unreal CPP" %}
The header file for the SubmitScoreHandler should look like this:

```cpp
#pragma once

#include "CoreMinimal.h"
#include "LootLockerSDKManager.h"

DECLARE_DELEGATE_OneParam(FOnSubmitScoreResponse, FLootLockerSubmitScoreResponse);

class YOURPROJECTNAME_API SubmitScoreHandler
{
public:
	SubmitScoreHandler();
	void SubmitScore(int score);
	~SubmitScoreHandler();
	
private:
	FString metadata;
	FString leaderboardKey;

	void OnSubmitScoreResponse(FLootLockerSubmitScoreResponse Response);

};
```

The cpp file should look something like this:

```cpp
#include "CountrySubmit.h"

CountrySubmit::CountrySubmit()
{

}

void SubmitScoreHandler::SubmitScore()
{
	metadata = "Country:" + FunctionWhichGetsCountry();

	ULootLockerSDKManager::SubmitScore("", 
		leaderboardKey, 
		score, 
		metadata, 
		FOnSubmitScoreResponse::CreateUObject(this, &CountrySubmit::OnSubmitScoreResponse));
}

void SubmitScoreHandler::OnSubmitScoreResponse(FLootLockerSubmitScoreResponse Response)
{
	if (!Response.success) {
		UE_LOG(LogTemp, Log, TEXT("Error: %d"), Response.ErrorData.Message);
		return;
	}

	UE_LOG(LogTemp, Log, TEXT("Score submitted successfully. Rank: %d"), Response.rank);
}

CountrySubmit::~CountrySubmit()
{

}

```

{% endtab %}

{% tab title="Godot" %}

```gdscript

var metadata : String = "country: " + PlayerInformation.GetPlayerAssignedCountry() # Replace PlayerInformation.GetPlayerAssignedCountry() with an existing method that gets the configured country for the player in your game
var leaderboardKey : String = "my_leaderboard"
var score : int = 1000
var response = await LL_Leaderboards.SubmitScore.new(leaderboardKey, score, "", metadata).send()
if(!response.success) :
	# Request failed, handle errors
	pass
else:
	# Request succeeded, use response as applicable in your game logic
	pass
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lootlocker.com/game-systems/leaderboards/how-to/use-metadata-to-store-additional-information.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
