Jump to content
  • 0

VipBo$$

Question

Am si eu o intrebare.

Cum pot face la comanda cmd:leaders gen daca ai admin 3+ si esti lider sa nu te vezi cand dai /leaders.

 

Comanda aici:

 

CMD:leaders(playerid, params[])
{
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to log in first.");
    SendClientMessage(playerid, COLOR_GREEN, "-------Lideri Online------");
    new string[128],name[30],afktext[10];
    foreach(new i : Player)
    {
        if(PlayerInfo[pLeader] > 0)
        {
            GetPlayerName(i, name, sizeof(name));
            format(string, sizeof(string), "{ff0000}Lider la: {000066}%s: {66ff33}%s {ccff33}[ID: %d] %s", DynamicFactions[PlayerInfo[pMember]][fName], name, i, afktext);
            SendClientMessage(playerid, COLOR_WHITE, string);
        }
    }
    SendClientMessage(playerid, COLOR_GREEN, "----------------------------------");
    return 1;
}

g4JGBJX.gif.31953391ab64171df562293ad37a0875.gif.9d26b39cd3270634d9cf89dcb43fba87.gif

 

 

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 1
CMD:leaders(playerid, params[])
{
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to log in first.");
    SendClientMessage(playerid, COLOR_GREEN, "-------Lideri Online------");
    new string[128],name[30],afktext[10];
    foreach(new i : Player)
    {
        if(PlayerInfo[pLeader] > 0 && i||playerid)
        {
            GetPlayerName(i, name, sizeof(name));
            format(string, sizeof(string), "{ff0000}Lider la: {000066}%s: {66ff33}%s {ccff33}[ID: %d] %s", DynamicFactions[PlayerInfo[pMember]][fName], name, i, afktext);
            SendClientMessage(playerid, COLOR_WHITE, string);
        }
    }
    SendClientMessage(playerid, COLOR_GREEN, "----------------------------------");
    return 1;
}

 

Poftim, cu aceasta comanda nu te poti vedea pe tine la lideri, doar altii te pot vedea. Legat de partea cu admin +3 nu am inteles la ce te referi

Ce am facut? Am adaugat o conditie in plus ca "i" (Playerul cautat) sa nu fie acelasi cu tine (playerid)

Edit: Mi se pare ciudat PlayerInfo-ul tau, adica unde e parametrul id?

Edited by TheBusiness
Link to comment
Share on other sites

  • 1
CMD:leaders(playerid, params[])
{
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to log in first.");
    SendClientMessage(playerid, COLOR_GREEN, "-------Lideri Online------");
    new string[128],name[30],afktext[10];
    foreach(new i : Player)
    {
        if(PlayerInfo[i][pLeader] > 0 && PlayerInfo[i][pAdmin] < 3)
        {
            GetPlayerName(i, name, sizeof(name));
            format(string, sizeof(string), "{ff0000}Lider la: {000066}%s: {66ff33}%s {ccff33}[ID: %d] %s", DynamicFactions[PlayerInfo[i][pMember]][fName], name, i, afktext);
            SendClientMessage(playerid, COLOR_WHITE, string);
        }
    }
    SendClientMessage(playerid, COLOR_GREEN, "----------------------------------");
    return 1;
}

Ok, am facut.

Ce am modificat?

1. Ti-am adaugat conditia ca daca player-ul respectiv are admin 3 sau peste 3 sa nu mai il afiseze, indiferent ca e lider sau nu. (Daca vrei sa nu iti afiseze admin 3, ci doar peste 3 pui PlayerInfo[pAdmin] <= 3 )

2. Ti-am rezolvat problema la PlayerInfo, am adaugat parametrul pentru id pentru ca nu il aveai.

Edited by TheBusiness
Link to comment
Share on other sites

  • 0

Ma refeream la "a nu te vedea", adica alti jucatori sa nu te vada daca dau /leaders, daca ai admin 3+, adica sa fii un fel de manager la factiunea aceea ca admin 3+ si sa nu te vezi la /leaders pentru alti jucatori.

Edited by AlexBo$$

g4JGBJX.gif.31953391ab64171df562293ad37a0875.gif.9d26b39cd3270634d9cf89dcb43fba87.gif

 

 

Link to comment
Share on other sites

  • 0
CMD:leaders(playerid, params[])
{
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to log in first.");
    SendClientMessage(playerid, COLOR_GREEN, "-------Lideri Online------");
    new string[128],name[30],afktext[10];
    foreach(new i : Player)
    {
        if(PlayerInfo[pLeader] > 0 && PlayerInfo[pAdmin] <= 3)
        {
            GetPlayerName(i, name, sizeof(name));
            format(string, sizeof(string), "{ff0000}Lider la: {000066}%s: {66ff33}%s {ccff33}[ID: %d] %s", DynamicFactions[PlayerInfo[pMember]][fName], name, i, afktext);
            SendClientMessage(playerid, COLOR_WHITE, string);
        }
    }
    SendClientMessage(playerid, COLOR_GREEN, "----------------------------------");
    return 1;
}

Acum, dacă jucătorul are nivelul de administrator 3 sau mai mare, nu va mai fi afişat în listă.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.