Spieler werden nicht gezeigt

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
  • CMD:myfriends(playerid, params[])
    {
    new count = 0;
    new string[1024];
    new iStr[1024] = "Freunde Online:\n";
    foreach(Player, i)
    {
    new USER_FILE[64];
    format(USER_FILE, sizeof(USER_FILE), "SFSUsers/%s.ini", GetPlayerNameEx(playerid));
    if(DOF2_GetInt(USER_FILE, GetPlayerNameEx(i)) == 1)
    {
    strins(iStr, GetPlayerNameIns(i), strlen(iStr));
    count++;
    }


    }
    if(count == 0)
    {
    format(string,1024,"Name: %s Status: {FF0000}Offline\n",iStr);
    }
    else
    {
    format(string,1024,"Name: %s Status: {00FF28}Online\n",iStr);
    }
    ShowPlayerDialog(playerid,FRIENDS,DIALOG_STYLE_LIST,"Freunde",string,"Ok","");
    return 1;
    }
    Wenn ich /myfriends mache, steht da im Dialog:
    Name: Freunde online
    Status: Online/Offline...


    Ich weiß auch woran das liegt. Das "iStr" ist dieses "Freunde online", aber wie schaff ich das, dass die Freunde da dann angezeigt werden?

  • Die werden mit DOF2 gespeichert...Hier z.B. ist der Befehl um die Freunde zu adden.
    CMD:friend(playerid, params[])
    {
    new giveplayerid;
    if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, 0x33AA33AA, "(*) /friend [playerid]");
    if(playerid == giveplayerid) return SendClientMessage(playerid, 0x33AA33AA, "(*) You cannot be friend of yourself.");
    new USER_FILE[64];
    format(USER_FILE, sizeof(USER_FILE), "SFSUsers/%s.ini", GetPlayerNameEx(playerid));
    if(DOF2_GetInt(USER_FILE, GetPlayerNameEx(giveplayerid)) == 1) return SendClientMessage(playerid, 0x33AA33AA, "(*) You already are friend of this player.");
    new iStr[70];
    format(iStr, sizeof(iStr), "(*) You sent an invitation to %s for a friendship.", GetPlayerNameEx(giveplayerid));
    SendClientMessage(playerid, 0x33AA33AA, iStr);
    format(iStr, sizeof(iStr), "%s wants to become your friend.\nDo you accept?", GetPlayerNameEx(playerid));
    ShowPlayerDialog(giveplayerid, AMIGODIALOG, DIALOG_STYLE_MSGBOX, "Want to be my friend?", iStr, "Yes", "No");
    SetPVarInt(giveplayerid, "AmigoRequest", playerid);
    return 1;
    }


    Und dann:
    if(!response)
    {
    SendClientMessage(GetPVarInt(playerid, "AmigoRequest"), 0x33AA33AA, "(*) The invitation has been declined.");
    DeletePVar(playerid, "AmigoRequest");
    SendClientMessage(playerid, 0x33AA33AA, "(*) You declined the invitation.");
    return 1;
    }
    new USER_FILE[64], FRIEND_FILE[64];
    new giveplayerid = GetPVarInt(playerid, "AmigoRequest");
    format(USER_FILE, sizeof(USER_FILE), "SFSUsers/%s.ini", GetPlayerNameEx(playerid));
    DOF2_SetInt(USER_FILE, GetPlayerNameEx(giveplayerid), 1);
    format(FRIEND_FILE, sizeof(FRIEND_FILE), "SFSUsers/%s.ini", GetPlayerNameEx(giveplayerid));
    DOF2_SetInt(FRIEND_FILE, GetPlayerNameEx(playerid), 1);
    DOF2_SaveFile();
    SendClientMessage(giveplayerid, 0x33AA33AA, "(*) The invitation has been accepted.");
    SendClientMessage(playerid, 0x33AA33AA, "(*) You've accepted the invitation.");
    DeletePVar(playerid, "AmigoRequest");
    }