Pagina 1 din 1

Custom Tag GM

Scris: Sâm Feb 15, 2025 6:51 pm
de picasun
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) == 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);
}







cum modific mai exact if (IsGameMaster()) ca sa pot da tag si altor jucatori nu doar celor care au GM,multumesc

Re: Custom Tag GM

Scris: Sâm Feb 15, 2025 8:22 pm
de RazVan
Doresti sa adaugi tagu de [GM] in fata numelui si celorlalti jucatori sau emblema ?

Re: Custom Tag GM

Scris: Sâm Feb 15, 2025 8:46 pm
de Loud

Cod: Selectaţi tot

const char* name = GetNameString();
size_t len = strcspn(name, "]");
char *result = (char *)malloc((len + 1) * sizeof(char));
strncpy(result, name, len);
result[len] = '\0';

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

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 if (!IsGameMaster()) {
    sprintf(szText, "|cffffff00[Server2]");
} else {
    sprintf(szText, "|cffff0000[TEST]");
}

free(result);

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

am adaugat functia

Cod: Selectaţi tot

else if (!IsGameMaster()) {
    sprintf(szText, "|cffffff00[Server2]");
Acum toti jucatorii din server ar trebuii sa beneficieze de tagul [Server2]

Re: Custom Tag GM

Scris: Dum Feb 16, 2025 5:07 am
de picasun
buna ideea lui Loud doar ca eu as dori custom adca PVP MVP VIP MISS GFX doar la anumiti playeri si sa le apara de ex Graphic Desiger [GFX]Test
pot sa fac asta daca sterg/coomentez linia if (IsGameMaster()) functioneaza doar ca iau crahuri la fiecare TP acuma sincer la erori nu m-am uitat ,am vazut ca nu merge cum vreau eu am lasat asa cum era

Re: Custom Tag GM

Scris: Dum Feb 16, 2025 7:24 am
de AlgeriaOVI
Daca vrei sa pui tag custom, nu inteleg de ce te complici atat si pare atat de greu, doar intra in Putty , du-te la Players , cauti numele , si modifici numele persoanei X cu ce vrei tu.
De exemplu, cauti numele PooKeR , si modifici in [PVP]PooKeR , dai save, si aia e.

Re: Custom Tag GM

Scris: Dum Feb 16, 2025 8:31 am
de picasun
AlgeriaOVI scrie: Dum Feb 16, 2025 7:24 am Daca vrei sa pui tag custom, nu inteleg de ce te complici atat si pare atat de greu, doar intra in Putty , du-te la Players , cauti numele , si modifici numele persoanei X cu ce vrei tu.
De exemplu, cauti numele PooKeR , si modifici in [PVP]PooKeR , dai save, si aia e.
nus chiar asa prost uita-te la pic sa intelegi ce zic https://prnt.sc/Myj9VnyX8qNB
mai dau un ex Youtuber [YT]Vlad

Re: Custom Tag GM

Scris: Dum Feb 16, 2025 1:41 pm
de RazVan
Daca doresti sa ai si acele tag uri de Pvp, Mvp etc trebuie sa le adaugi in aceasta functie :

Cod: Selectaţi tot

const char *tagDictionary[] = { 
      "[GM]", 
      "[SA]", 
      "[GA]",
      "[DEV]"
      
Aici ca sa iti apara in fata numelui :

Cod: Selectaţi tot

const char *nameDictionary[] = {
      "|cffff0000[STAFF]",
      "|cffff0000[EQUIPA]",
      "|cffff0000[STAFF2]",
      "|cffff0000[DEVELOPER]"
      };
      
Apoi in navicat in gmlist trebuie sa adaugi gradele noi si in cmd.cpp daca doresti sa le adaugi si comenzi dar sa corespunda cu ce ai adaugat in navicat.

Re: Custom Tag GM

Scris: Dum Feb 16, 2025 6:00 pm
de picasun
am sa incerc maine ,multumesc

Re: Custom Tag GM

Scris: Lun Feb 17, 2025 3:15 pm
de Loud
Raspuns primit!
Topic inchis si arhivat!