[C++]Custom tag pentru GM

Aici poți găsi sisteme complete, verificate și recomandate de echipa 4Metin.
Avatar utilizator
F. Gabriel
Administrator
Administrator
Mesaje: 507
Membru din: Lun Aug 01, 2022 10:23 am
Localitate: Tecuci
Status: Retras
Multumiri acordate: 18
Multumiri primite: 350
Contact:

[C++]Custom tag pentru GM

Mesaj de F. Gabriel »

Imagine

InstanceBaseEffect.cpp


Caută:

Cod: Selectaţi tot

CPythonTextTail::Instance().AttachLevel(GetVirtualID(), szText, s_kLevelColor);
Adaugă sub:

Cod: Selectaţi tot

if (IsGameMaster())
  {
    const char* name = GetNameString();
    size_t len = strcspn(name, "]");
    char *result = (char *)malloc((len + 1) * sizeof(char)); // Not sure why on client side needs to be like this
    strncpy(result, name, len +1);
    result[len + 1] = '\0';

    const char *tagDictionary[] = { 
      "[GM]", 
      "[SA]", 
      "[GA]",
      "[DEV]"
      };

    //Here you can also change the color of the tag
    const char *nameDictionary[] = {
      "|cffff0000[STAFF]",
      "|cffff0000[EQUIPA]",
      "|cffff0000[STAFF2]",
      "|cffff0000[DEVELOPER]"
      };

    int tagIndex = -1;
    for (int i = 0; i < sizeof(tagDictionary) / sizeof(tagDictionary[0]); ++i) {
      if (strcmp(result, tagDictionary[i]) == 0) {
        tagIndex = i;
        break;
      }
    }

    if (tagIndex != -1){
      sprintf(szText, nameDictionary[tagIndex]);
    }
    else{
      // This is just for if the code cant find any tag, it will default to this one.
      // You can also just delete this whole else statement and it will default to the level text
      sprintf(szText, "|cffff0000[TEST]");
    }
    free(result);

    CPythonTextTail::Instance().AttachLevel(GetVirtualID(), szText, s_kLevelColor);
}
Imagine

Hosting Metin2 by OVINETWORK.RO
Avatar utilizator
picasun
4Metin
4Metin
Mesaje: 30
Membru din: Dum Feb 19, 2023 3:37 pm
Status: Activ
Multumiri acordate: 4
Multumiri primite: 7
Contact:

Re: [C++]Custom tag pentru GM

Mesaj de picasun »

o intrebare totusi cum as putea modifica if (IsGameMaster()) ca sa pot sa dau Tag si jucatorilor normali ca daca comentez linia functioneaza si pe jucatori doar ca, crash la fiecare tp
Avatar utilizator
RazVan
Administrator
Administrator
Mesaje: 973
Membru din: Mie Oct 19, 2022 5:25 pm
Localitate: München
Status: Activ
Multumiri acordate: 12
Multumiri primite: 63
Contact:

Re: [C++]Custom tag pentru GM

Mesaj de RazVan »

picasun scrie: Sâm Feb 15, 2025 1:56 pm o intrebare totusi cum as putea modifica if (IsGameMaster()) ca sa pot sa dau Tag si jucatorilor normali ca daca comentez linia functioneaza si pe jucatori doar ca, crash la fiecare tp
Fa topic la probleme si te vom ajuta !
Imagine
Avatar utilizator
CherSkit
4Metin
4Metin
Mesaje: 9
Membru din: Joi Sep 07, 2023 5:45 pm
Status: Activ
Multumiri acordate: 4
Contact:

Re: [C++]Custom tag pentru GM

Mesaj de CherSkit »

Hát ezt is megnézzük
Scrie răspuns