/makeadmin problem, Funktioniert nicht

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
  • }
    if(!strcmp(strget(cmdtext,0),"/makeadmin"))
    {
    if(IsPlayerConnected(playerid))
    {
    new tmp[128];
    new idx;
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, Orange, "Benutze: /makeadmin [ID] [Level]");
    return 1;
    }
    new para1;
    new level;
    new cmd[128];
    para1 = strval(tmp);
    tmp = strtok(cmd, idx);
    level = strval(tmp);
    if(PlayerInfo[playerid][pAdmin] >= 5)
    {
    if(IsPlayerConnected(para1))
    {
    if(para1 != INVALID_PLAYER_ID)
    {
    new GivePlayer[128];
    GetPlayerName(para1, GivePlayer, sizeof(GivePlayer));
    GetPlayerName(playerid, sendername, sizeof(sendername));
    PlayerInfo[para1][pAdmin] = level;
    printf("AdmCmd: %s has promoted %s to a level %d admin.", sendername, GivePlayer, level);
    format(string, sizeof(string), " You have been promoted to a level %d admin by %s", level, sendername);
    SendClientMessage(para1, Orange, string);
    format(string, sizeof(string), " You have promoted %s to a level %d admin.", GivePlayer,level);
    SendClientMessage(playerid, Orange, string);
    }
    }
    }
    else
    {
    SendClientMessage(playerid, Orange, "You are not Admin.");
    }
    }
    return 1;


    Kann mir einer helfen wie ich das mache damit ich /makeadmin benutzen kann wenn ich /makeadmin mache dann macht er ich automatisch auf 0 Admin

    Woltlab Burning Board 3.1.3 Sponsor gesucht ICQ 360808528

  • Ersetzt dein /makeadmin Command mit dem


    if(strcmp(cmd, "/makeadmin", true) == 0)
    {
    if(PlayerInfo[playerid][pAdmin] >= 1339)
    {
    SendClientMessage(playerid,COLOR_GRAD2," Das Vergeben und Entziehen von Adminrechten ist nur für die ServerOwner möglich!");
    return 1;
    }
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_GRAD2, "Benutze: /makeadmin [ID] [Level]");
    return 1;
    }
    new para1 = ReturnUser(tmp);
    tmp = strtok(cmdtext, idx);
    new level = strval(tmp);
    if(IsPlayerConnected(para1))
    {
    if(para1 != INVALID_PLAYER_ID)
    {
    GetPlayerName(para1, giveplayer, sizeof(giveplayer));
    GetPlayerName(playerid, sendername, sizeof(sendername));
    if(PlayerInfo[para1][pAdmin] < level)
    {
    printf("AdmCmd: %s hat %s zu einem Level %d Admin befördert.", sendername, giveplayer, level);
    format(string, sizeof(string), " Du wurdest durch %s zu einem Level %d Admin befördert", sendername, level);
    SendClientMessage(para1, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), " Du hast %s zu einem Level %d Admin befördert.", giveplayer,level);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    format(string, 256, "AdmWarning: %s hat %s zu einem Administrator/Supporter mit Level %d gemacht.",sendername, giveplayer, level);
    ABroadCast(COLOR_RED,string,1);
    }
    else
    {
    printf("AdmCmd: %s hat %s zu einem Level %d Admin degradiert.", sendername, giveplayer, level);
    format(string, sizeof(string), " Du wurdest durch %s zu einem Level %d Admin degradiert", sendername, level);
    SendClientMessage(para1, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), " Du hast %s zu einem Level %d Admin degradiert.", giveplayer,level);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    }
    PlayerInfo[para1][pAdmin] = level;
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_GRAD1, " Du bist nicht befugt diesen Befehl zu nutzen! ");
    }
    return 1;
    }

  • CMD:setlevel(playerid,params[])
    {
    new pID, Level;
    if(PlayerInfo[playerid][pAdmin] < 5)return 0;
    if(sscanf(params, "ud",pID,Level)) return SendClientMessage(playerid,COLOR_RED,"Benutze: /makeadmin [ID][Level]!");
    if (pID == INVALID_PLAYER_ID && IsPlayerNPC(pID))return SendClientMessage(playerid,COLOR_RED,"Der Spieler ist nicht online!");
    if(PlayerInfo[playerid][pAdmin] >= 5)
    {
    new string1[128],levelsetter[20], playername[20];
    GetPlayerName(pID,playername,sizeof playername);
    GetPlayerName(playerid,levelsetter,sizeof(levelsetter));
    Spieler[pID][AdminLevel] = AdminLevel;
    format(string1,sizeof(string1),"%s hat dein Level auf %d gesetzt!",levelsetter, Level);
    SendClientMessage(pID,GREEN, string1);
    }
    return 1;
    }
    Funktioniert 100 Pro ;) Das ist zcmd mit sscanf

  • C:\DOKUME~1\Kadir\Desktop\SERVER~1\GAMEMO~1\TDM.pwn(1588) : error 029: invalid expression, assumed zero
    C:\DOKUME~1\Kadir\Desktop\SERVER~1\GAMEMO~1\TDM.pwn(1588) : error 017: undefined symbol "makeadmin"
    C:\DOKUME~1\Kadir\Desktop\SERVER~1\GAMEMO~1\TDM.pwn(1592) : error 017: undefined symbol "params"
    C:\DOKUME~1\Kadir\Desktop\SERVER~1\GAMEMO~1\TDM.pwn(1592) : error 017: undefined symbol "COLOR_RED"
    C:\DOKUME~1\Kadir\Desktop\SERVER~1\GAMEMO~1\TDM.pwn(1599) : error 017: undefined symbol "Spieler"
    C:\DOKUME~1\Kadir\Desktop\SERVER~1\GAMEMO~1\TDM.pwn(1599) : warning 215: expression has no effect
    C:\DOKUME~1\Kadir\Desktop\SERVER~1\GAMEMO~1\TDM.pwn(1599) : error 001: expected token: ";", but found "]"
    C:\DOKUME~1\Kadir\Desktop\SERVER~1\GAMEMO~1\TDM.pwn(1599) : error 029: invalid expression, assumed zero
    C:\DOKUME~1\Kadir\Desktop\SERVER~1\GAMEMO~1\TDM.pwn(1599) : fatal error 107: too many error messages on one line


    Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    8 Errors.


    Kann mir einer helfen

    Woltlab Burning Board 3.1.3 Sponsor gesucht ICQ 360808528

    Einmal editiert, zuletzt von [EaST]Dragonarts ()


  • if(strcmp(cmd, "/makeadmin", true) == 0)
    {
    new tmp[128], idx;
    tmp = strtok(cmdtext, idx);
    if(!tmp[0])return SendClientMessage(playerid, Orange, "Benutze: /makeadmin [ID] [Level]");
    new pId = ReturnUser(tmp);
    tmp = strtok(cmdtext, idx);
    if(!tmp[0])return SendClientMessage(playerid, Orange, "Benutze: /makeadmin [ID] [Level]");
    new Level = strval(tmp);
    if(PlayerInfo[playerid][pAdmin] < 5)return SendClientMessage(playerid, Orange, "You are not Admin.");
    if(!IsPlayerConnected(pId))return SendClientMessage(playerid, Orange, "The User is Offline.");
    new pName[24], pAName[24];
    PlayerInfo[para1][pAdmin] = Level;
    GetPlayerName(pId, pName, 24); GetPlayerName(playerid, pAName, 24);

    printf("AdmCmd: %s has promoted %s to a level %d admin.", pAName, pName, Level);
    format(string, sizeof(string), " You have been promoted to a level %d admin by %s", Level, pAName);
    SendClientMessage(pId, Orange, string);
    format(string, sizeof(string), " You have promoted %s to a level %d admin.", pName,Level);
    SendClientMessage(playerid, Orange, string);
    return 1;
    }

    RFT

  • C:\DOKUME~1\Kadir\Desktop\SERVER~1\GAMEMO~1\TDM.pwn(1593) : error 017: undefined symbol "ReturnUser"
    C:\DOKUME~1\Kadir\Desktop\SERVER~1\GAMEMO~1\TDM.pwn(1600) : error 017: undefined symbol "para"
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    2 Errors.

    Woltlab Burning Board 3.1.3 Sponsor gesucht ICQ 360808528

  • ganz nach unten



    ReturnUser(text[], playerid = INVALID_PLAYER_ID)
    {
    new pos = 0;
    while (text[pos] < 0x21) // Strip out leading spaces
    {
    if (text[pos] == 0) return INVALID_PLAYER_ID; // No passed text
    pos++;
    }
    new userid = INVALID_PLAYER_ID;
    if (IsNumeric(text[pos])) // Check whole passed string
    {
    // If they have a numeric name you have a problem (although names are checked on id failure)
    userid = strval(text[pos]);
    if (userid >=0 && userid < MAX_PLAYERS)
    {
    if(!IsPlayerConnected(userid))
    {
    /*if (playerid != INVALID_PLAYER_ID)
    {
    SendClientMessage(playerid, 0xFF0000AA, "User not connected");
    }*/
    userid = INVALID_PLAYER_ID;
    }
    else
    {
    return userid; // A player was found
    }
    }
    /*else
    {
    if (playerid != INVALID_PLAYER_ID)
    {
    SendClientMessage(playerid, 0xFF0000AA, "Invalid user ID");
    }
    userid = INVALID_PLAYER_ID;
    }
    return userid;*/
    // Removed for fallthrough code
    }
    // They entered [part of] a name or the id search failed (check names just incase)
    new len = strlen(text[pos]);
    new count = 0;
    new name[MAX_PLAYER_NAME];
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
    if (IsPlayerConnected(i))
    {
    GetPlayerName(i, name, sizeof (name));
    if (strcmp(name, text[pos], true, len) == 0) // Check segment of name
    {
    if (len == strlen(name)) // Exact match
    {
    return i; // Return the exact player on an exact match
    // Otherwise if there are two players:
    // Me and MeYou any time you entered Me it would find both
    // And never be able to return just Me's id
    }
    else // Partial match
    {
    count++;
    userid = i;
    }
    }
    }
    }
    if (count != 1)
    {
    if (playerid != INVALID_PLAYER_ID)
    {
    if (count)
    {
    SendClientMessage(playerid, 0xFF0000AA, "Multiple users found, please narrow earch");
    }
    else
    {
    SendClientMessage(playerid, 0xFF0000AA, "No matching user found");
    }
    }
    userid = INVALID_PLAYER_ID;
    }
    return userid; // INVALID_USER_ID for bad return
    }
    IsNumeric(const string[])
    {
    for (new i = 0, j = strlen(string); i < j; i++)
    {
    if (string[i] > '9' || string[i] < '0') return 0;
    }
    return 1;
    }
    strtok(string[],&idx,seperator = ' ')
    {
    new ret[128], i = 0, len = strlen(string);
    while(string[idx] == seperator && idx < len) idx++;
    while(string[idx] != seperator && idx < len)
    {
    ret[i] = string[idx];
    i++;
    idx++;
    }
    while(string[idx] == seperator && idx < len) idx++;
    return ret;
    }







    if(strcmp(cmd, "/makeadmin", true) == 0)
    {
    new tmp[128], idx;
    tmp = strtok(cmdtext, idx);
    if(!tmp[0])return SendClientMessage(playerid, Orange, "Benutze: /makeadmin [ID] [Level]");
    new pId = ReturnUser(tmp);
    tmp = strtok(cmdtext, idx);
    if(!tmp[0])return SendClientMessage(playerid, Orange, "Benutze: /makeadmin [ID] [Level]");
    new Level = strval(tmp);
    if(PlayerInfo[playerid][pAdmin] < 5)return SendClientMessage(playerid, Orange, "You are not Admin.");
    if(!IsPlayerConnected(pId))return SendClientMessage(playerid, Orange, "The User is Offline.");
    new pName[24], pAName[24];
    PlayerInfo[pId][pAdmin] = Level;
    GetPlayerName(pId, pName, 24); GetPlayerName(playerid, pAName, 24);

    printf("AdmCmd: %s has promoted %s to a level %d admin.", pAName, pName, Level);
    format(string, sizeof(string), " You have been promoted to a level %d admin by %s", Level, pAName);
    SendClientMessage(pId, Orange, string);
    format(string, sizeof(string), " You have promoted %s to a level %d admin.", pName,Level);
    SendClientMessage(playerid, Orange, string);
    return 1;
    }

    RFT

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen

  • ReturnUser(text[], playerid = INVALID_PLAYER_ID)
    {
    new pos = 0;
    while (text[pos] < 0x21) // Strip out leading spaces
    {
    if (text[pos] == 0) return INVALID_PLAYER_ID; // No passed text
    pos++;
    }
    new userid = INVALID_PLAYER_ID;
    if (IsNumeric(text[pos])) // Check whole passed string
    {
    // If they have a numeric name you have a problem (although names are checked on id failure)
    userid = strval(text[pos]);
    if (userid >=0 && userid < MAX_PLAYERS)
    {
    if(!IsPlayerConnected(userid))
    {
    /*if (playerid != INVALID_PLAYER_ID)
    {
    SendClientMessage(playerid, 0xFF0000AA, "User not connected");
    }*/
    userid = INVALID_PLAYER_ID;
    }
    else
    {
    return userid; // A player was found
    }
    }
    /*else
    {
    if (playerid != INVALID_PLAYER_ID)
    {
    SendClientMessage(playerid, 0xFF0000AA, "Invalid user ID");
    }
    userid = INVALID_PLAYER_ID;
    }
    return userid;*/
    // Removed for fallthrough code
    }
    // They entered [part of] a name or the id search failed (check names just incase)
    new len = strlen(text[pos]);
    new count = 0;
    new name[MAX_PLAYER_NAME];
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
    if (IsPlayerConnected(i))
    {
    GetPlayerName(i, name, sizeof (name));
    if (strcmp(name, text[pos], true, len) == 0) // Check segment of name
    {
    if (len == strlen(name)) // Exact match
    {
    return i; // Return the exact player on an exact match
    // Otherwise if there are two players:
    // Me and MeYou any time you entered Me it would find both
    // And never be able to return just Me's id
    }
    else // Partial match
    {
    count++;
    userid = i;
    }
    }
    }
    }
    if (count != 1)
    {
    if (playerid != INVALID_PLAYER_ID)
    {
    if (count)
    {
    SendClientMessage(playerid, 0xFF0000AA, "Multiple users found, please narrow earch");
    }
    else
    {
    SendClientMessage(playerid, 0xFF0000AA, "No matching user found");
    }
    }
    userid = INVALID_PLAYER_ID;
    }
    return userid; // INVALID_USER_ID for bad return
    }
    IsNumeric(const string[])
    {
    for (new i = 0, j = strlen(string); i < j; i++)
    {
    if (string[i] > '9' || string[i] < '0') return 0;
    }
    return 1;
    }
    strtok(string[],&idx,seperator = ' ')
    {
    new ret[128], i = 0, len = strlen(string);
    while(string[idx] == seperator && idx < len) idx++;
    while(string[idx] != seperator && idx < len)
    {
    ret[i] = string[idx];
    i++;
    idx++;
    }
    while(string[idx] == seperator && idx < len) idx++;
    return ret;
    }


    ganz nach unten ins Script wo ist da das problem o.o


    MFG RFT

    RFT

  • C:\DOKUME~1\Kadir\Desktop\SERVER~1\GAMEMO~1\TDM.pwn(3233) : error 025: function heading differs from prototype
    C:\DOKUME~1\Kadir\Desktop\SERVER~1\GAMEMO~1\TDM.pwn(3234) : error 021: symbol already defined: "strtok"
    C:\DOKUME~1\Kadir\Desktop\SERVER~1\GAMEMO~1\TDM.pwn(3244) : error 047: array sizes do not match, or destination array is too small
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    3 Errors.


    jetzt kommt das

    Woltlab Burning Board 3.1.3 Sponsor gesucht ICQ 360808528


  • strtok(string[],&idx,seperator = ' ')
    {
    new ret[128], i = 0, len = strlen(string);
    while(string[idx] == seperator && idx < len) idx++;
    while(string[idx] != seperator && idx < len)
    {
    ret[i] = string[idx];
    i++;
    idx++;
    }
    while(string[idx] == seperator && idx < len) idx++;
    return ret;
    }


    das rauß ist 2 mal drinnen und wenn der Error mit C:\DOKUME~1\Kadir\Desktop\SERVER~1\GAMEMO~1\TDM.pwn(3244) : error 047: array sizes do not match, or destination array is too small dann steht liegts an der Include dann setzte den String tmp auf 256

    RFT

  • Moin,


    entweder liegt es an mir oder ich weiß nicht.
    Sende mal dein Callback falls da sachen drinne sind die andere Leute nix angehen bitte ich dich mirs per PN zuzusenden falls du da nix dagegen hast.
    Das Callback "OnPlayerCommandText" ist gemeint.



    MFG RFT

    RFT