• Хостинг игровых серверов

    Максимальная производительность для ваших игровых серверов!

    Заказать сейчас

Бесплатное Lang API 1.0.5

Нет прав для скачивания
JSON:
{// OnLangAPIFinished is called when LangAPI is finished processing
private bool _isLangAPIReady;
private void OnLangAPIFinished()
{
  _isLangAPIReady = true;
}

// Added IsReady bool which will return true/false when your plugin is loaded to know if it's ready
// Example usage below.
private void OnServerInitialized()
{
  if (LangAPI != null && LangAPI.IsLoaded)
    _isLangAPIReady = LangAPI.Call<bool>("IsReady");
}

//How to properly check valid displaynames when using custom item displaynames in plugins.
//Example first hook call usage method expects item.DisplayName.english ( returns true or false )
//Example second hook call usage method expects item.shortname, item.DisplayName.english, player.UserIDString
string GetItemDisplayName(string shorname, string displayName, string userID)
{
  if (LangAPI != null && LangAPI.Call<bool>("IsDefaultDisplayName", displayName))
  {
    return LangAPI.Call<string>("GetItemDisplayName", shorname, displayName, userID) ?? displayName;
  }
  return displayName;
}


//Example expects the item.shortname, item.displayName.english, player.UserIDString
//Return type is string
LangAPI.Call<string>("GetItemDisplayName", "rifle.ak", "Assault Rilfe", player.UserIDString)

//Example expects the item.shortname, item.displayDescription.english, player.UserIDString
//Return type is string
LangAPI.Call<string>("GetItemDescription", "rifle.ak", "High damage machine rilfe", player.UserIDString)
 
//Added a new API bool check to detect valid item displaynames.
//Retrun type is bool
LangAPI.Call<bool>("IsDefaultDisplayName", "Assault Rifle")

// IsReady bool will return true/false when your plugin is loaded to know if it's ready
LangAPI.Call<bool>("IsReady")}