Hilfe bei /a /admin

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
  • Wenn du 26 Errors hast, dann hast du einen Klammerfehler drinnen. Und der wurde nicht durch die Änderung im format verursacht.
    if(strcmp(cmd, "/admin", true) == 0 || strcmp(cmd, "/a", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    GetPlayerName(playerid, sendername, sizeof(sendername));
    new length = strlen(cmdtext);
    while ((idx < length) && (cmdtext[idx] <= ' '))
    {
    idx++;
    }
    new offset = idx;
    new result[64];
    while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
    {
    result[idx - offset] = cmdtext[idx];
    idx++;
    }
    result[idx - offset] = EOS;
    if(!strlen(result))
    {
    SendClientMessage(playerid, COLOR_GRAD2, "NUTZE: (/a)dmin [admin chat]");
    return 1;
    }
    format(string, sizeof(string), " %s[%d]: %s", sendername, playerid, result);
    for(new i=0; i<GetMaxPlayers(); i++)
    {
    if(IsPlayerConnected(i))
    {
    SendClientMessage(i,0xE10000FF,string);
    }
    }
    Log("OA-Chat.txt",string);
    }
    return 1;
    }
    Hier nochmal der ganze Befehl mit der Änderung

  • Das ist doch so gemacht, die Adminabfrage weg.
    Aber da du es ja so haben willst, dass der Adminrang bei Admins angezeigt wird, mache es so:


    if(strcmp(cmd, "/admin", true) == 0 || strcmp(cmd, "/a", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    GetPlayerName(playerid, sendername, sizeof(sendername));
    new length = strlen(cmdtext);
    while ((idx < length) && (cmdtext[idx] <= ' '))
    {
    idx++;
    }
    new offset = idx;
    new result[64];
    while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
    {
    result[idx - offset] = cmdtext[idx];
    idx++;
    }
    result[idx - offset] = EOS;
    if(!strlen(result))
    {
    SendClientMessage(playerid, COLOR_GRAD2, "NUTZE: (/a)dmin [admin chat]");
    return 1;
    }
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
    format(string, sizeof(string), "*%d Admin %s[%d]: %s", PlayerInfo[playerid][pAdmin], sendername, playerid, result);
    }
    else if(PlayerInfo[playerid][pSupporter] >= 1)
    {
    format(string, sizeof(string), "*%d Supporter %s[%d]: %s", PlayerInfo[playerid][pSupporter], sendername, playerid, result);
    }
    else if(PlayerInfo[playerid][pSupporter] == 6)
    {
    format(string, sizeof(string), "*%d Admin %s[%d]: %s", PlayerInfo[playerid][pSupporter], sendername, playerid, result);
    }
    format(string, sizeof(string), "%s[%d]: %s", sendername, playerid, result);
    for(new i=0; i<GetMaxPlayers(); i++)
    {
    if(IsPlayerConnected(i))
    {
    SendClientMessage(i,0xE10000FF,string);
    }
    }
    Log("OA-Chat.txt",string);
    return 1;
    }

  • 23 errors ?



    if(strcmp(cmd, "/admin", true) == 0 || strcmp(cmd, "/a", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    GetPlayerName(playerid, sendername, sizeof(sendername));
    new length = strlen(cmdtext);
    while ((idx < length) && (cmdtext[idx] <= ' '))
    {
    idx++;
    }
    new offset = idx;
    new result[64];
    while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
    {
    result[idx - offset] = cmdtext[idx];
    idx++;
    }
    result[idx - offset] = EOS;
    if(!strlen(result))
    {
    SendClientMessage(playerid, COLOR_GRAD2, "NUTZE: (/a)dmin [admin chat]");
    return 1;
    }
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
    format(string, sizeof(string), "*%d Admin %s[%d]: %s", PlayerInfo[playerid][pAdmin], sendername, playerid, result);
    }
    else if(PlayerInfo[playerid][pSupporter] >= 1)
    {
    format(string, sizeof(string), "*%d Supporter %s[%d]: %s", PlayerInfo[playerid][pSupporter], sendername, playerid, result);
    }
    else if(PlayerInfo[playerid][pSupporter] == 6)
    {
    format(string, sizeof(string), "*%d Admin %s[%d]: %s", PlayerInfo[playerid][pSupporter], sendername, playerid, result);
    }
    format(string, sizeof(string), "%s[%d]: %s", sendername, playerid, result);
    for(new i=0; i<GetMaxPlayers(); i++)
    {
    if(IsPlayerConnected(i))
    {
    SendClientMessage(i,0xE10000FF,string);
    }
    }
    Log("OA-Chat.txt",string);
    return 1;
    }

  • Wups Klammer vergessen
    if(strcmp(cmd, "/admin", true) == 0 || strcmp(cmd, "/a", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    GetPlayerName(playerid, sendername, sizeof(sendername));
    new length = strlen(cmdtext);
    while ((idx < length) && (cmdtext[idx] <= ' '))
    {
    idx++;
    }
    new offset = idx;
    new result[64];
    while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
    {
    result[idx - offset] = cmdtext[idx];
    idx++;
    }
    result[idx - offset] = EOS;
    if(!strlen(result))
    {
    SendClientMessage(playerid, COLOR_GRAD2, "NUTZE: (/a)dmin [admin chat]");
    return 1;
    }
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
    format(string, sizeof(string), "*%d Admin %s[%d]: %s", PlayerInfo[playerid][pAdmin], sendername, playerid, result);
    }
    else if(PlayerInfo[playerid][pSupporter] >= 1)
    {
    format(string, sizeof(string), "*%d Supporter %s[%d]: %s", PlayerInfo[playerid][pSupporter], sendername, playerid, result);
    }
    else if(PlayerInfo[playerid][pSupporter] == 6)
    {
    format(string, sizeof(string), "*%d Admin %s[%d]: %s", PlayerInfo[playerid][pSupporter], sendername, playerid, result);
    }
    format(string, sizeof(string), "%s[%d]: %s", sendername, playerid, result);
    for(new i=0; i<GetMaxPlayers(); i++)
    {
    if(IsPlayerConnected(i))
    {
    SendClientMessage(i,0xE10000FF,string);
    }
    }
    Log("OA-Chat.txt",string);
    }
    return 1;
    }