Problem bei /Makeleader

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
  • Hallo Leute,


    ich habe versucht im GF-Gamemode bei /makeleader statt die Level ID`s die Fraktionsbeschreibungen ein zu fügen, dies funktioniert auch, Compilen funktioniert auch, das Problem liegt Online, denn wenn ich /makeleader [ID] [Frak-ID] benutze kommt nur: Du wurdest von Admin [NAME] zum Leader der Fraktion 0 ernannt.
    Ich hoffe mir kann jemand helfen.



    if(strcmp(cmd, "/makeleader", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makeleader [playerid/PartOfName] [Number(1-11)]");
    return 1;
    }
    new para1;
    new level;
    new ftext [20];
    para1 = ReturnUser(tmp);
    tmp = strtok(cmdtext, idx);
    level = strval(tmp);
    if(level > 11 || level < 0) { SendClientMessage(playerid, COLOR_GREY, " Dont go below number 0, or above number 11!"); return 1; }
    if (PlayerInfo[playerid][pAdmin] >= 1337)
    {
    if(IsPlayerConnected(para1))
    {
    if(para1 != INVALID_PLAYER_ID)
    {
    if(PlayerInfo[para1][pMember] > 0 || PlayerInfo[para1][pFMember] < 255)
    {
    SendClientMessage(playerid, COLOR_GREY, " That player is in a Faction / Family !");
    return 1;
    }
    GetPlayerName(para1, giveplayer, sizeof(giveplayer));
    GetPlayerName(playerid, sendername, sizeof(sendername));
    PlayerInfo[para1][pLeader] = level;
    format(string, sizeof(string), " Du wurdest von Admin %s zum Leader der Fraktion %d ernennt.", sendername, ftext);
    SendClientMessage(para1, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), " Du hast %s zum Leader der Fraktion %d ernannt.", giveplayer, ftext);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    if(level == 0) { PlayerInfo[para1][pChar] = 0; ftext = "Zivilist"; }
    else if(level == 1) { PlayerInfo[para1][pChar] = 288; ftext = "LSPD"; } //Police Force
    else if(level == 2) { PlayerInfo[para1][pChar] = 286; ftext = "FBI"; } //FBI/ATF
    else if(level == 3) { PlayerInfo[para1][pChar] = 287; ftext = "Army"; } //National Guard
    else if(level == 4) { PlayerInfo[para1][pChar] = 228; ftext = "Medic / Feuerwehr"; } //Fire/Ambulance
    else if(level == 5) { PlayerInfo[para1][pChar] = 113; ftext = "La Cosa Nostra"; } //La Cosa Nostra
    else if(level == 6) { PlayerInfo[para1][pChar] = 120; ftext = "Yakuza"; } //Yakuza
    else if(level == 7) { PlayerInfo[para1][pChar] = 147; ftext = "Regierung"; } //Mayor
    else if(level == 8) { PlayerInfo[para1][pChar] = 294; ftext = "Hitmans"; } //Hitmans
    else if(level == 9) { PlayerInfo[para1][pChar] = 227; ftext = "CNN"; } //News Reporters
    else if(level == 10) { PlayerInfo[para1][pChar] = 61; ftext = "Taxi GmBH"; } //Taxi Cab Company
    else if(level == 11) { PlayerInfo[para1][pChar] = 171; ftext = "Fahrschule"; } //Driving/Flying School
    gTeam[para1] = 11;
    PlayerInfo[para1][pTeam] = 11;
    SetPlayerSkin(para1, PlayerInfo[para1][pChar]);
    }
    }//not connected
    }
    else
    {
    SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
    }
    }
    return 1;
    }

  • if(level == 0) { PlayerInfo[para1][pChar] = 0; ftext = "Zivilist"; }
    else if(level == 1) { PlayerInfo[para1][pChar] = 288; ftext = "LSPD"; } //Police Force
    else if(level == 2) { PlayerInfo[para1][pChar] = 286; ftext = "FBI"; } //FBI/ATF
    else if(level == 3) { PlayerInfo[para1][pChar] = 287; ftext = "Army"; } //National Guard
    else if(level == 4) { PlayerInfo[para1][pChar] = 228; ftext = "Medic / Feuerwehr"; } //Fire/Ambulance
    else if(level == 5) { PlayerInfo[para1][pChar] = 113; ftext = "La Cosa Nostra"; } //La Cosa Nostra
    else if(level == 6) { PlayerInfo[para1][pChar] = 120; ftext = "Yakuza"; } //Yakuza
    else if(level == 7) { PlayerInfo[para1][pChar] = 147; ftext = "Regierung"; } //Mayor
    else if(level == 8) { PlayerInfo[para1][pChar] = 294; ftext = "Hitmans"; } //Hitmans
    else if(level == 9) { PlayerInfo[para1][pChar] = 227; ftext = "CNN"; } //News Reporters
    else if(level == 10) { PlayerInfo[para1][pChar] = 61; ftext = "Taxi GmBH"; } //Taxi Cab Company
    else if(level == 11) { PlayerInfo[para1][pChar] = 171; ftext = "Fahrschule"; } //Driving/Flying School

    das über den getplayername(s)

  • Jetzt schaut es bei mir folgendermaßen aus:


    if(strcmp(cmd, "/makeleader", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makeleader [playerid/PartOfName] [Number(1-11)]");
    return 1;
    }
    new para1;
    new level;
    new ftext [20];
    para1 = ReturnUser(tmp);
    tmp = strtok(cmdtext, idx);
    level = strval(tmp);
    if(level > 11 || level < 0) { SendClientMessage(playerid, COLOR_GREY, " Dont go below number 0, or above number 11!"); return 1; }
    if (PlayerInfo[playerid][pAdmin] >= 1337)
    {
    if(IsPlayerConnected(para1))
    {
    if(para1 != INVALID_PLAYER_ID)
    {
    if(PlayerInfo[para1][pMember] > 0 || PlayerInfo[para1][pFMember] < 255)
    {
    SendClientMessage(playerid, COLOR_GREY, " That player is in a Faction / Family !");
    return 1;
    }


    if(level == 0) { PlayerInfo[para1][pChar] = 0; ftext = "Zivilist"; }
    else if(level == 1) { PlayerInfo[para1][pChar] = 288; ftext = "LSPD"; } //Police Force
    else if(level == 2) { PlayerInfo[para1][pChar] = 286; ftext = "FBI"; } //FBI/ATF
    else if(level == 3) { PlayerInfo[para1][pChar] = 287; ftext = "Army"; } //National Guard
    else if(level == 4) { PlayerInfo[para1][pChar] = 228; ftext = "Medic / Feuerwehr"; } //Fire/Ambulance
    else if(level == 5) { PlayerInfo[para1][pChar] = 113; ftext = "La Cosa Nostra"; } //La Cosa Nostra
    else if(level == 6) { PlayerInfo[para1][pChar] = 120; ftext = "Yakuza"; } //Yakuza
    else if(level == 7) { PlayerInfo[para1][pChar] = 147; ftext = "Regierung"; } //Mayor
    else if(level == 8) { PlayerInfo[para1][pChar] = 294; ftext = "Hitmans"; } //Hitmans
    else if(level == 9) { PlayerInfo[para1][pChar] = 227; ftext = "CNN"; } //News Reporters
    else if(level == 10) { PlayerInfo[para1][pChar] = 61; ftext = "Taxi GmBH"; } //Taxi Cab Company
    else if(level == 11) { PlayerInfo[para1][pChar] = 171; ftext = "Fahrschule"; } //Driving/Flying School
    gTeam[para1] = 11;
    PlayerInfo[para1][pTeam] = 11;


    GetPlayerName(para1, giveplayer, sizeof(giveplayer));
    GetPlayerName(playerid, sendername, sizeof(sendername));
    GetPlayerName(level, ftext, sizeof(ftext));
    PlayerInfo[para1][pLeader] = level;
    format(string, sizeof(string), " Du wurdest von Admin %s zum Leader der Fraktion %d ernennt.", sendername, ftext);
    SendClientMessage(para1, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), " Du hast %s zum Leader der Fraktion %d ernannt.", giveplayer, ftext);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);


    SetPlayerSkin(para1, PlayerInfo[para1][pChar]);
    }
    }//not connected
    }
    else
    {
    SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
    }
    }
    return 1;
    }


    und im Script erscheinen jetzt Zahlen wie 70 und 107. Was mache ich da nur falsch.

  • so wie ich das sehe machst du bei
    else if(level == 11) { PlayerInfo[para1][pChar] = 171; ftext = "Fahrschule"; } //Driving/Flying School


    aus ftext nen string un keine zahl
    format(string, sizeof(string), " Du hast %s zum Leader der Fraktion %d ernannt.", giveplayer, ftext);


    hier schreibst du aber dass ftext ne zahl ist
    mach daraus nen string und er zeigt es richtig an
    (soweit ich dass jetzt auf den ersten blick sehe^^