Text für Team

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
  • enum P_TEAM { SWAT, SUSPECTS };
    new P_TEAM:pTeam[MAX_PLAYERS];
    /* ... */
    if(text[0] == '!')
    {
    SendTeamMessage(text, pTeam[playerid]);
    return 0;
    }
    /* ... */
    stock SendTeamMessage(arg1[], P_TEAM:arg2)
    {
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(pTeam[i] == arg2)
    SendClientMessage(i, 0xFF6900AA, arg1);
    }
    }

  • Bei mir kommt:
    E:\Programme\Rockstar Games\Grand Theft Auto San Andreas\Server\filterscripts\text.pwn(36) : error 010: invalid function or declaration
    E:\Programme\Rockstar Games\Grand Theft Auto San Andreas\Server\filterscripts\text.pwn(39) : error 010: invalid function or declaration
    E:\Programme\Rockstar Games\Grand Theft Auto San Andreas\Server\filterscripts\text.pwn(42) : error 025: function heading differs from prototype

  • Code
    E:\Programme\Rockstar Games\Grand Theft Auto San Andreas\Server\filterscripts\text.pwn(42) : error 025: function heading differs from prototype


    Wenn das steht hast du eine Variable schon so genannt.
    Achja und die if schleife gehört n atürlich in OnPlayerText Callback ;)

  • Ok..
    Aber iwi kann ich des ned^^
    #include <a_samp>


    // This is a comment
    // uncomment the line below if you want to write a filterscript
    //#define FILTERSCRIPT


    #if defined FILTERSCRIPT


    public OnFilterScriptInit()
    {
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
    }


    public OnFilterScriptExit()
    {
    return 1;
    }


    #else


    main()
    {
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
    }


    #endif



    public OnPlayerText(playerid, text[])
    {
    if(text[0] == '!')
    {
    SendTeamMessage(text, pTeam[playerid]);
    return 0;
    }
    /* ... */
    stock SendTeamMessage(arg1[], P_TEAM:arg2)
    {
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(pTeam[i] == arg2)
    SendClientMessage(i, 0xFF6900AA, arg1);
    }
    }
    }


    Sry aber ich bin noch Anfänger im scripten^^

  • Du hast die beiden neuen sachen vergessen, die das new beinhalten.


    #include <a_samp>


    // This is a comment
    // uncomment the line below if you want to write a filterscript
    //#define FILTERSCRIPT


    #if defined FILTERSCRIPT


    enum P_TEAM { SWAT, SUSPECTS }; //Das hier
    new P_TEAM:pTeam[MAX_PLAYERS]; // Und das hier



    public OnFilterScriptInit()
    {
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
    }


    public OnFilterScriptExit()
    {
    return 1;
    }


    #else


    main()
    {
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
    }


    #endif



    public OnPlayerText(playerid, text[])
    {
    if(text[0] == '!')
    {
    SendTeamMessage(text, pTeam[playerid]);
    return 0;
    }


    stock SendTeamMessage(arg1[], P_TEAM:arg2)
    {
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(pTeam[i] == arg2)
    SendClientMessage(i, 0xFF6900AA, arg1);
    }
    }
    }


    Aber wenn ich bei mir jetzt ! test mache kommt da in Orange der Text, aber jeder kann ihn lesen, und die Teams hab ich schon geändert, die hier stehen : enum P_TEAM { DEALER, KELLNER2, SKYDIVE };

  • #include <a_samp>



    enum P_TEAM { SWAT, SUSPECTS }; //Das hier
    new P_TEAM:pTeam[MAX_PLAYERS]; // Und das hier



    public OnFilterScriptInit()
    {
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
    }


    public OnFilterScriptExit()
    {
    return 1;
    }


    public OnPlayerConnect(playerid)
    {
    /* Hier wird per Zufall ein Spieler Team ausgewählt! */
    new _rand = random(2);
    if(_rand == 0)
    pTeam[playerid] = SWAT;
    else if(_rand == 1)
    pTeam[playerid] = SUSPECTS;
    }


    public OnPlayerText(playerid, text[])
    {
    if(text[0] == '!')
    {
    SendTeamMessage(text, pTeam[playerid]);
    return 0;
    }
    }


    public OnPlayerCommandText(playerid, cmdtext[])
    {
    if(!strcmp("/swat", cmdtext))
    {
    SendClientMessage(playerid, 0xFF0000AA, "Du bist nun SWAT!");
    pTeam[playerid] = SWAT;
    }
    if(!strcmp("/suspect", cmdtext))
    {
    SendClientMessage(playerid, 0xFF0000AA, "Du bist nun böse ;)");
    pTeam[playerid] = SUSPECTS;
    }
    }


    stock SendTeamMessage(arg1[], P_TEAM:arg2)
    {
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(pTeam[i] == arg2)
    SendClientMessage(i, 0xFF6900AA, arg1);
    }
    }

  • Ok thx es kommt nur noch 1 Warnung.
    E:\Programme\Rockstar Games\Grand Theft Auto San Andreas\Server\filterscripts\text.pwn(3 : warning 209: function "OnPlayerText" should return a value
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase

  • Bugfix:
    #include <a_samp>



    enum P_TEAM { SWAT, SUSPECTS }; //Das hier
    new P_TEAM:pTeam[MAX_PLAYERS]; // Und das hier



    public OnFilterScriptInit()
    {
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
    }


    public OnFilterScriptExit()
    {
    return 1;
    }


    public OnPlayerConnect(playerid)
    {
    /* Hier wird per Zufall ein Spieler Team ausgewählt! */
    new _rand = random(2);
    if(_rand == 0)
    pTeam[playerid] = SWAT;
    else if(_rand == 1)
    pTeam[playerid] = SUSPECTS;
    }


    public OnPlayerText(playerid, text[])
    {
    if(text[0] == '!')
    {
    SendTeamMessage(text, pTeam[playerid]);
    return 0;
    }
    return 1;
    }


    public OnPlayerCommandText(playerid, cmdtext[])
    {
    if(!strcmp("/swat", cmdtext))
    {
    SendClientMessage(playerid, 0xFF0000AA, "Du bist nun SWAT!");
    pTeam[playerid] = SWAT;
    return 1;
    }
    if(!strcmp("/suspect", cmdtext))
    {
    SendClientMessage(playerid, 0xFF0000AA, "Du bist nun böse ;)");
    pTeam[playerid] = SUSPECTS;
    return 1;
    }
    return 0;
    }


    stock SendTeamMessage(arg1[], P_TEAM:arg2)
    {
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(pTeam[i] == arg2)
    SendClientMessage(i, 0xFF6900AA, arg1);
    }
    }