Members buggt

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • Hi, Wenn ich einen in mein Clan invite, geht zwar /members bei ihm aber seine online Mitglieder werden nicht angezeigt, jedoch wenn man beim /invite Leaderrechte bekommt, funktioniert das ?(


    Invite Befehl
    ocmd:cinvite(playerid, params[])
    {
    for(new i = 0;i<MAX_PLAYERS;i++)
    {
    if(PlayerInfo[playerid][pclanownid] == 0) return SendClientMessage(playerid,COLOR_WHITE,"{00a085}[INFO] {FFFFFF}You can't use this command.");
    {
    new target;
    if(sscanf(params, "ui", target)) return SendClientMessage(playerid, COLOR_WHITE, "{00A085}[INFO] {FFFFFF}/cinvite [playerid/name]");
    if(target == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_ERRORTEXT, "This player isn't online.");
    new string[125], giveplayerid;
    new playername[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME];
    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
    GetPlayerName(playerid, playername, sizeof(playername));
    format(string, 256, "{00A085}[INFO] {FFFFFF}You have invite %s in your Clan.", giveplayer);
    SendClientMessage(playerid, COLOR_WHITE, string);
    format(string, 256, "{00a085}[INFO] {FFFFFF}%s has invite you in his Clan.", playername);
    SendClientMessage(target, COLOR_WHITE, string);
    PlayerInfo[playerid][pclanmemberid] = PlayerInfo[target][pclanownid];
    }
    }
    return 1;
    }


    Members Befehl
    ocmd:members(playerid)
    {
    new iCounter = 0,
    strRank[30],
    strtmp[128];
    if(PlayerInfo[playerid][pclanownid] == 0 && PlayerInfo[playerid][pclanmemberid] == 0) return SendClientMessage(playerid,COLOR_WHITE,"{00a085}[INFO] {FFFFFF}You aren't in a Clan!");
    SendClientMessage(playerid, COLOR_WHITE, "{00A085}Member Online:");
    ForAllPlayers(i)
    {
    if(!IsPlayerConnected(i)) continue;
    if(PlayerInfo[i][pclanownid] == PlayerInfo[playerid][pclanownid] && PlayerInfo[i][pclanmemberid] == PlayerInfo[playerid][pclanmemberid])
    {
    switch(PlayerInfo[i][pclanownid] == PlayerInfo[playerid][pclanownid] && PlayerInfo[i][pclanmemberid] == PlayerInfo[playerid][pclanmemberid])
    {
    default: strRank = "Member";
    }
    iCounter++;
    format(strtmp, 128, "%s %s (ID: %d)", strRank, GetName(i), i);
    SendClientMessage(playerid, COLOR_WHITE, strtmp);
    }
    }
    return 1;
    }

  • Du hast da mehrere Fehler drin.
    Erstmal zum /cinvite:
    im Sscanf kannst du das i wegnehmen. Das "u" reicht aus um einen Spieler zu erkennen.
    Wieso erstellst du eine giveplayerid, wenn du eh schon target hast?
    Unten weist du dem Spieler der /cinvite macht, die clanownid des targets zu? Sollte wohl eher andersrum sein.


    Dann zum /members
    Die switch-Anweisung ist völlig umsonst, und das String zuweisen funktioniert eigentlich nicht mit =


    Leider weiß ich nicht wofür deine Variablen pclanownid und pclanmemberid stehen. Ist das erste für Leader?
    Dann hab ich hier die Lösung:



    ocmd:cinvite(playerid, params[])
    {
    for(new i = 0;i<MAX_PLAYERS;i++)
    {
    if(PlayerInfo[playerid][pclanownid] == 0) return SendClientMessage(playerid,COLOR_WHITE,"{00a085}[INFO] {FFFFFF}You can't use this command.");
    {
    new target;
    if(sscanf(params, "ui", target)) return SendClientMessage(playerid, COLOR_WHITE, "{00A085}[INFO] {FFFFFF}/cinvite [playerid/name]");
    if(target == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_ERRORTEXT, "This player isn't online.");
    new string[125];
    new playername[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME];
    GetPlayerName(target, giveplayer, sizeof(giveplayer));
    GetPlayerName(playerid, playername, sizeof(playername));
    format(string, 256, "{00A085}[INFO] {FFFFFF}You have invite %s in your Clan.", giveplayer);
    SendClientMessage(playerid, COLOR_WHITE, string);
    format(string, 256, "{00a085}[INFO] {FFFFFF}%s has invite you in his Clan.", playername);
    SendClientMessage(target, COLOR_WHITE, string);
    PlayerInfo[target][pclanmemberid] = PlayerInfo[playerid][pclanownid];
    }
    }
    return 1;
    }



    ocmd:members(playerid)
    {
    new iCounter = 0,
    strRank[30],
    strtmp[128];
    if(PlayerInfo[playerid][pclanownid] == 0 && PlayerInfo[playerid][pclanmemberid] == 0) return SendClientMessage(playerid,COLOR_WHITE,"{00a085}[INFO] {FFFFFF}You aren't in a Clan!");
    SendClientMessage(playerid, COLOR_WHITE, "{00A085}Member Online:");
    ForAllPlayers(i)
    {
    if(!IsPlayerConnected(i)) continue;
    if(PlayerInfo[i][pclanownid] == PlayerInfo[playerid][pclanownid] && PlayerInfo[i][pclanmemberid] == PlayerInfo[playerid][pclanmemberid])
    {
    if(PlayerInfo[i][pclanownid] == PlayerInfo[playerid][pclanmemberid] || PlayerInfo[i][pclanownid] == PlayerInfo[playerid][pclanownid])format(strRank, 29, "Leader");
    else format(strRank, 29, "Member");
    iCounter++; //Hast du sonst nirgends verwendet
    format(strtmp, 128, "%s %s (ID: %d)", strRank, GetName(i), i);
    SendClientMessage(playerid, COLOR_WHITE, strtmp);
    }
    }
    return 1;
    }