/r command

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
  • Guten Abend,


    Ich habe hier ein kleines Problem, wenn ich im Spiel /r und einen text dazu eingebe wird da nichts geschrieben, sondern es kommt nur eine leere zeile im chatt



    ocmd:r(playerid,params[])
    {
    new ftext[128];
    if(sscanf(params, "s", ftext))
    {
    return SendClientMessage(playerid,COLOR_RED,"Benutzung: /radio [Text]");
    }
    if(!IsPlayerInAnyVehicle(playerid))
    {
    SendClientMessage(playerid,COLOR_RED,"Du bist in keinem Wagen mit Funkempfang!");
    return 1;
    }
    if(Player[playerid][Team]==0)
    {
    return SendClientMessage(playerid,COLOR_RED,"Du bist in keiner Fraktion!");
    }
    else
    {
    {
    new leader = Player[playerid][Leader];
    new member = Player[playerid][Team];
    new sendername[MAX_PLAYERS];
    new string[128];
    GetPlayerName(playerid, sendername, sizeof(sendername));
    if(member==2||leader==2)
    {
    if(Player[playerid][Rank]==0) { format(string, sizeof(string), ">> Praktikant %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==1) { format(string, sizeof(string), ">> Zivildienstleistender %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==2) { format(string, sizeof(string), ">> Rettungshelfer %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==3) { format(string, sizeof(string), ">> Rettungssanitäter %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==4) { format(string, sizeof(string), ">> Rettungsassistent %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==5) { format(string, sizeof(string), ">> Auszubildender Arzt %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==6) { format(string, sizeof(string), ">> Ausgebildeter Arzt %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==7) { format(string, sizeof(string), ">> Notarzt %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==8) { format(string, sizeof(string), ">> Notarzt || %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==9) { format(string, sizeof(string), ">> Stellv. Oberarzt %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==10) { format(string, sizeof(string), ">> Oberarzt %s: %s.", sendername, ftext); }
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(Player[i][Team] == 2)
    {
    SendClientMessage(i, COLOR_FCHAT, string);
    }
    }
    }
    }
    else if(member==1||leader==1)
    {
    if(Player[playerid][Rank]==1) { format(string, sizeof(string), ">> Praktikant %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==1) { format(string, sizeof(string), ">> Wachtmeister %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==2) { format(string, sizeof(string), ">> Hauptwachtmeister %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==3) { format(string, sizeof(string), ">> Kommissar %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==4) { format(string, sizeof(string), ">> Hauptkomissar %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==5) { format(string, sizeof(string), ">> Assistent Spectre %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==6) { format(string, sizeof(string), ">> Spectre %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==7) { format(string, sizeof(string), ">> Spectre in Charge %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==8) { format(string, sizeof(string), ">> Supervisory Spectre %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==9) { format(string, sizeof(string), ">> Stellv. Polizeidirektor %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==10) { format(string, sizeof(string), ">> Polizeidirektor %s: %s.", sendername, ftext); }
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(Player[i][Team] == 1)
    {
    SendClientMessage(i, COLOR_FCHAT, string);
    }
    }
    }
    }
    else if(member==1||leader==1)
    {
    if(Player[playerid][Rank]==1) { format(string, sizeof(string), ">> Praktikant %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==1) { format(string, sizeof(string), ">> Wachtmeister %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==2) { format(string, sizeof(string), ">> Hauptwachtmeister %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==3) { format(string, sizeof(string), ">> Kommissar %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==4) { format(string, sizeof(string), ">> Hauptkomissar %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==5) { format(string, sizeof(string), ">> Assistent Spectre %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==6) { format(string, sizeof(string), ">> Spectre %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==7) { format(string, sizeof(string), ">> Spectre in Charge %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==8) { format(string, sizeof(string), ">> Supervisory Spectre %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==9) { format(string, sizeof(string), ">> Stellv. Polizeidirektor %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==10) { format(string, sizeof(string), ">> Polizeidirektor %s: %s.", sendername, ftext); }
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(Player[i][Team] == 1)
    {
    SendClientMessage(i, COLOR_FCHAT, string);
    }
    }
    }
    }else if(member==13||leader==13)
    {
    if(Player[playerid][Rank]==1) { format(string, sizeof(string), ">> Praktikant %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==1) { format(string, sizeof(string), ">> Praktikant %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==2) { format(string, sizeof(string), ">> Bauarbeiter %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==3) { format(string, sizeof(string), ">> Abschlepper %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==4) { format(string, sizeof(string), ">> Baustellen Leiter %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==5) { format(string, sizeof(string), ">> Co Leiter %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==6) { format(string, sizeof(string), ">> Geschäftsleiter %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==7) { format(string, sizeof(string), ">> Geschäftsführer %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==8) { format(string, sizeof(string), ">> Geschäftsführer %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==9) { format(string, sizeof(string), ">> Geschäftsführer %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==10) { format(string, sizeof(string), ">> Geschäftsführer %s: %s.", sendername, ftext); }
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(Player[i][Team] == 13)
    {
    SendClientMessage(i, COLOR_FCHAT, string);
    }
    }
    }
    }
    else if(member==5||leader==5)
    {
    if(Player[playerid][Rank]==1) { format(string, sizeof(string), "** Azubi %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==1) { format(string, sizeof(string), "** Azubi %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==2) { format(string, sizeof(string), "** Fahrer %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==3) { format(string, sizeof(string), "** Bodyguard %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==4) { format(string, sizeof(string), "** Leibwache %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==5) { format(string, sizeof(string), "** Stellv. Präsident %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==6) { format(string, sizeof(string), "** Präsident %s: %s. )) **", sendername, ftext); }
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(Player[i][Team] == 5)
    {
    SendClientMessage(i, COLOR_FCHAT, string);
    }
    }
    }
    }
    else if(member==3||leader==3)
    {
    if(Player[playerid][Rank]==1) { format(string, sizeof(string), "** Azubi %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==1) { format(string, sizeof(string), "** Azubi %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==2) { format(string, sizeof(string), "** Agent %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==3) { format(string, sizeof(string), "** Special Agent %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==4) { format(string, sizeof(string), "** Geheimagent %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==5) { format(string, sizeof(string), "** Co FBI-Direktor %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==6) { format(string, sizeof(string), "** FBI-Direktor %s: %s. )) **", sendername, ftext); }
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(Player[i][Team] == 3)
    {
    SendClientMessage(i, COLOR_FCHAT, string);
    }
    }
    }
    }
    else
    {
    SendClientMessage(playerid,COLOR_RED,"Du gehörst keiner staatlichen Fraktion an!");
    }
    }
    }
    return 1;
    }

  • wie ich finde hattest du unnötige klammern.. obs daran liegt weiss ich nicht :



    ocmd:r(playerid,params[])
    {
    new ftext[128];
    if(sscanf(params,"s",ftext))return SendClientMessage(playerid,COLOR_RED,"Benutzung: /radio [Text]");
    if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,COLOR_RED,"Du bist in keinem Wagen mit Funkempfang!");
    if(Player[playerid][Team]==0)return SendClientMessage(playerid,COLOR_RED,"Du bist in keiner Fraktion!");
    new leader = Player[playerid][Leader];
    new member = Player[playerid][Team];
    new sendername[MAX_PLAYER_NAME];//hier war kleiner fehler
    new string[128];
    GetPlayerName(playerid,sendername,sizeof(sendername));
    if(member==2||leader==2)
    {
    if(Player[playerid][Rank]==0) { format(string, sizeof(string), ">> Praktikant %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==1) { format(string, sizeof(string), ">> Zivildienstleistender %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==2) { format(string, sizeof(string), ">> Rettungshelfer %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==3) { format(string, sizeof(string), ">> Rettungssanitäter %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==4) { format(string, sizeof(string), ">> Rettungsassistent %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==5) { format(string, sizeof(string), ">> Auszubildender Arzt %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==6) { format(string, sizeof(string), ">> Ausgebildeter Arzt %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==7) { format(string, sizeof(string), ">> Notarzt %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==8) { format(string, sizeof(string), ">> Notarzt || %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==9) { format(string, sizeof(string), ">> Stellv. Oberarzt %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==10) { format(string, sizeof(string), ">> Oberarzt %s: %s.", sendername, ftext); }
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(Player[i][Team] == 2)
    {
    SendClientMessage(i, COLOR_FCHAT, string);
    }
    }
    }
    }
    else if(member==1||leader==1)//haste das hier 2x drin?
    {
    if(Player[playerid][Rank]==1) { format(string, sizeof(string), ">> Praktikant %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==1) { format(string, sizeof(string), ">> Wachtmeister %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==2) { format(string, sizeof(string), ">> Hauptwachtmeister %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==3) { format(string, sizeof(string), ">> Kommissar %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==4) { format(string, sizeof(string), ">> Hauptkomissar %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==5) { format(string, sizeof(string), ">> Assistent Spectre %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==6) { format(string, sizeof(string), ">> Spectre %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==7) { format(string, sizeof(string), ">> Spectre in Charge %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==8) { format(string, sizeof(string), ">> Supervisory Spectre %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==9) { format(string, sizeof(string), ">> Stellv. Polizeidirektor %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==10) { format(string, sizeof(string), ">> Polizeidirektor %s: %s.", sendername, ftext); }
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(Player[i][Team] == 1)
    {
    SendClientMessage(i, COLOR_FCHAT, string);
    }
    }
    }
    }
    else if(member==1||leader==1)//?
    {
    if(Player[playerid][Rank]==1) { format(string, sizeof(string), ">> Praktikant %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==1) { format(string, sizeof(string), ">> Wachtmeister %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==2) { format(string, sizeof(string), ">> Hauptwachtmeister %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==3) { format(string, sizeof(string), ">> Kommissar %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==4) { format(string, sizeof(string), ">> Hauptkomissar %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==5) { format(string, sizeof(string), ">> Assistent Spectre %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==6) { format(string, sizeof(string), ">> Spectre %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==7) { format(string, sizeof(string), ">> Spectre in Charge %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==8) { format(string, sizeof(string), ">> Supervisory Spectre %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==9) { format(string, sizeof(string), ">> Stellv. Polizeidirektor %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==10) { format(string, sizeof(string), ">> Polizeidirektor %s: %s.", sendername, ftext); }
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(Player[i][Team] == 1)
    {
    SendClientMessage(i, COLOR_FCHAT, string);
    }
    }
    }
    }else if(member==13||leader==13)
    {
    if(Player[playerid][Rank]==1) { format(string, sizeof(string), ">> Praktikant %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==1) { format(string, sizeof(string), ">> Praktikant %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==2) { format(string, sizeof(string), ">> Bauarbeiter %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==3) { format(string, sizeof(string), ">> Abschlepper %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==4) { format(string, sizeof(string), ">> Baustellen Leiter %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==5) { format(string, sizeof(string), ">> Co Leiter %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==6) { format(string, sizeof(string), ">> Geschäftsleiter %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==7) { format(string, sizeof(string), ">> Geschäftsführer %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==8) { format(string, sizeof(string), ">> Geschäftsführer %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==9) { format(string, sizeof(string), ">> Geschäftsführer %s: %s.", sendername, ftext); }
    else if(Player[playerid][Rank]==10) { format(string, sizeof(string), ">> Geschäftsführer %s: %s.", sendername, ftext); }
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(Player[i][Team] == 13)
    {
    SendClientMessage(i, COLOR_FCHAT, string);
    }
    }
    }
    }
    else if(member==5||leader==5)
    {
    if(Player[playerid][Rank]==1) { format(string, sizeof(string), "** Azubi %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==1) { format(string, sizeof(string), "** Azubi %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==2) { format(string, sizeof(string), "** Fahrer %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==3) { format(string, sizeof(string), "** Bodyguard %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==4) { format(string, sizeof(string), "** Leibwache %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==5) { format(string, sizeof(string), "** Stellv. Präsident %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==6) { format(string, sizeof(string), "** Präsident %s: %s. )) **", sendername, ftext); }
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(Player[i][Team] == 5)
    {
    SendClientMessage(i, COLOR_FCHAT, string);
    }
    }
    }
    }
    else if(member==3||leader==3)
    {
    if(Player[playerid][Rank]==1) { format(string, sizeof(string), "** Azubi %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==1) { format(string, sizeof(string), "** Azubi %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==2) { format(string, sizeof(string), "** Agent %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==3) { format(string, sizeof(string), "** Special Agent %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==4) { format(string, sizeof(string), "** Geheimagent %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==5) { format(string, sizeof(string), "** Co FBI-Direktor %s: %s. )) **", sendername, ftext); }
    else if(Player[playerid][Rank]==6) { format(string, sizeof(string), "** FBI-Direktor %s: %s. )) **", sendername, ftext); }
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(Player[i][Team] == 3)
    {
    SendClientMessage(i, COLOR_FCHAT, string);
    }
    }
    }
    }
    else
    {
    SendClientMessage(playerid,COLOR_RED,"Du gehörst keiner staatlichen Fraktion an!");
    }
    return 1;
    }