Ocmd ..

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 Community,


    ich wollte fragen wie ich bei OCMD ein /radio Chat erstelle für Cops (Team 1) ? Hab alles versucht, aber irgendwie kommt nur m*** raus. Hoffe auf Antworten.

  • Also..


    Ein Cop macht /radio und dann kommt bei den anderen Cops halt die Nachricht die er gesendet hat wie z.b. "Beispielname: Alles sicher, over"

  • Ist das sowas? Habe ich aus nim GF bei mir aufm PC einfach mal rausgesucht..


    if(strcmp(cmd, "/radio", true) == 0 || strcmp(cmd, "/r", 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: (/r)adio [radio chat]");
    return 1;
    }
    if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
    {
    if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** Chief %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** Captain %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** Lieutenant %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** Sergeant %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** Officer %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** Cadet %s: %s, over. **", sendername, result); }
    else
    {
    format(string, sizeof(string), "** Cadet %s: %s, over. **", sendername, result);
    }
    SendRadioMessage(1, TEAM_BLUE_COLOR, string);
    printf("%s", string);
    return 1;
    }
    else if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)
    {
    if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** Director %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** Assistant Director in Charge %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** Special Agent in Charge %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** Special Agent %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** Special Agent Trainee %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** Professional Staff %s: %s, over. **", sendername, result); }
    else
    {
    format(string, sizeof(string), "** Intern %s: %s, over. **", sendername, result);
    }
    SendRadioMessage(2, TEAM_BLUE_COLOR, string);
    printf("%s", string);
    return 1;
    }
    else if(PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
    {
    if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** General %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** Lieutenant %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** Captain %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** Major %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** Sergeant %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** Private %s: %s, over. **", sendername, result); }
    else
    {
    format(string, sizeof(string), "** Private %s: %s, over. **", sendername, result);
    }
    SendRadioMessage(3, TEAM_BLUE_COLOR, string);
    printf("%s", string);
    return 1;
    }
    else if(gTeam[playerid] == 1||PlayerInfo[playerid][pMember]==4||PlayerInfo[playerid][pLeader]==4)
    {
    format(string, sizeof(string), "** Paramedic %s: %s, over. **", sendername, result);
    SendRadioMessage(4, TEAM_CYAN_COLOR, string);
    printf("%s", string);
    return 1;
    }
    else
    {
    SendClientMessage(playerid, COLOR_GRAD2, " Du bist kein Cop / F.B.I Agent / Soldat !");
    return 1;
    }
    }
    return 1;
    }

  • Ich brauch das für OCMD. Und ich weiß nicht wie ich es so schreiben kann für OCMD.

  • ocmd:radio(playerid,params[])
    {
    new text[64], string[256], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    if(CopAbfrage != 1)return SendClientMessage(playerid,grau,"Du bist kein Cop!");
    if(sscanf(params,"s",text))return SendClientMessage(playerid,grau,"Benutze: /radio [Text]");
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
    if(CopAbfrage == 1)
    {
    format(string,sizeof(string),"Polizist %s: %s",name,text);
    SendClientMessage(i,radiofarbe,string);
    }
    }
    return 1;
    }