aus nur "t" ein /t machen...wie?

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
  • moin, ich hab ein Teamchat system, wo aber leider momentan ohne /t funktioniert, wen ich einfach ein / davor mache bekomm ich errors..


    wie macht man aus nur "t" ein "/t" ?


    public OnPlayerText(playerid, text[])
    {
    if (text[0] == 't')
    {
    new playerTeam = gTeam[playerid];
    new string [128];
    new color;
    GetPlayerName(playerid, string, sizeof string);
    format(string,sizeof(string),"Teamchat (t [text]) %s: %s",string,text[1]);
    switch (playerTeam) {
    case TEAM_COP: color = 0xFF0000B2;
    case TEAM_RUSSIA: color = 0xFF0000B2;
    case TEAM_TRIADEN: color = 0xFF0000B2;
    case TEAM_ITAL: color = 0xFF0000B2;
    case TEAM_BIKER: color = 0xFF0000B2;
    case TEAM_GROVE: color = 0xFF0000B2;
    case TEAM_BALLAS: color = 0xFF0000B2;
    case TEAM_AZTECAS: color = 0xFF0000B2;
    case TEAM_RIFA: color = 0xFF0000B2;
    case TEAM_ARMY: color = 0xFF0000B2;
    case TEAM_SANITATER: color = 0xFF0000B2;
    case TEAM_FBI: color = 0xFF0000B2;
    case TEAM_PILOT: color = 0xFF0000B2;
    case TEAM_ZIVI: color =0xFF0000B2;
    }
    for (new i; i < MAX_PLAYERS; i++) {
    if (gTeam[i] == playerTeam) {
    SendClientMessage(i,color,string);
    }
    }
    return 0;
    }
    return 1;
    }

  • Nutz mal pls OnPlayerCommandText
    da kannste auch das "/" verwenden

  • public if (strcmp("/t", cmdtext, true) == 0) { if (text[0] == 't') { new playerTeam = gTeam[playerid]; new string [128]; new color; GetPlayerName(playerid, string, sizeof string); format(string,sizeof(string),"Teamchat (t [text]) %s: %s",string,text[1]); switch (playerTeam) { case TEAM_COP: color = 0xFF0000B2; case TEAM_RUSSIA: color = 0xFF0000B2; case TEAM_TRIADEN: color = 0xFF0000B2; case TEAM_ITAL: color = 0xFF0000B2; case TEAM_BIKER: color = 0xFF0000B2; case TEAM_GROVE: color = 0xFF0000B2; case TEAM_BALLAS: color = 0xFF0000B2; case TEAM_AZTECAS: color = 0xFF0000B2; case TEAM_RIFA: color = 0xFF0000B2; case TEAM_ARMY: color = 0xFF0000B2; case TEAM_SANITATER: color = 0xFF0000B2; case TEAM_FBI: color = 0xFF0000B2; case TEAM_PILOT: color = 0xFF0000B2; case TEAM_ZIVI: color =0xFF0000B2; } for (new i; i < MAX_PLAYERS; i++) { if (gTeam[i] == playerTeam) { SendClientMessage(i,color,string); } } return 0; } return 1; }

    /edit: das unter OnPlayerCommandText

    Phantasie ist wichtiger als Wissen, denn Wissen ist begrenzt.

    Albert Einstein

  • also wen dus so meinst:


    (unter onPlayerCommandText)


    kommen nen paar errors...


    public if (strcmp("/t", cmdtext, true) == 0) { if (text[0] == 't') {
    new playerTeam = gTeam[playerid];
    new string [128];
    new color;
    GetPlayerName(playerid, string, sizeof string);
    format(string,sizeof(string),"Teamchat (t [text]) %s: %s",string,text[1]);
    switch (playerTeam) {
    case TEAM_COP: color = 0xFF0000B2;
    case TEAM_RUSSIA: color = 0xFF0000B2;
    case TEAM_TRIADEN: color = 0xFF0000B2;
    case TEAM_ITAL: color = 0xFF0000B2;
    case TEAM_BIKER: color = 0xFF0000B2;
    case TEAM_GROVE: color = 0xFF0000B2;
    case TEAM_BALLAS: color = 0xFF0000B2;
    case TEAM_AZTECAS: color = 0xFF0000B2;
    case TEAM_RIFA: color = 0xFF0000B2;
    case TEAM_ARMY: color = 0xFF0000B2;
    case TEAM_SANITATER: color = 0xFF0000B2;
    case TEAM_FBI: color = 0xFF0000B2;
    case TEAM_PILOT: color = 0xFF0000B2;
    case TEAM_ZIVI: color =0xFF0000B2;
    for (new i; i < MAX_PLAYERS; i++) {
    if (gTeam[i] == playerTeam) {
    SendClientMessage(i,color,string);
    }
    }
    return 0;
    }
    return 1;
    }


    (239) : warning 219: local variable "string" shadows a variable at a preceding level
    (1007) : warning 219: local variable "string" shadows a variable at a preceding level
    (1332) : error 001: expected token: "-identifier-", but found "if"
    (1336) : error 021: symbol already defined: "GetPlayerName"
    (1338) : error 010: invalid function or declaration //hier fangen die case an...
    (1339) : error 010: invalid function or declaration
    (1340) : error 010: invalid function or declaration
    (1341) : error 010: invalid function or declaration
    (1342) : error 010: invalid function or declaration
    (1343) : error 010: invalid function or declaration
    (1344) : error 010: invalid function or declaration
    (1345) : error 010: invalid function or declaration
    (1346) : error 010: invalid function or declaration
    (1347) : error 010: invalid function or declaration
    (1348) : error 010: invalid function or declaration
    (1349) : error 010: invalid function or declaration
    (1350) : error 010: invalid function or declaration
    (1351) : error 010: invalid function or declaration
    (1352) : error 010: invalid function or declaration
    (1353) : error 010: invalid function or declaration
    (1354) : error 010: invalid function or declaration
    (1358) : error 010: invalid function or declaration
    (1360) : error 010: invalid function or declaration //Hier hören Sie auf
    (1710) : warning 203: symbol is never used: "color"
    (1710) : warning 203: symbol is never used: "playerTeam"
    (1710) : warning 203: symbol is never used: "string"
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


    21 Errors.