Frage! FS

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
  • Ich wollt mal Fragen ob ich in ein Filterscript einen Befehl rein machen kann, wie:
    if(strcmp(cmd, "/setage", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /setage [playerid/PartOfName] [age]");
    return 1;
    }
    new playa;
    new age;
    playa = ReturnUser(tmp);
    tmp = strtok(cmdtext, idx);
    age = strval(tmp);
    if (PlayerInfo[playerid][pAdmin] >= 3)
    {
    if(IsPlayerConnected(playa))
    {
    if(playa != INVALID_PLAYER_ID)
    {
    PlayerInfo[playa][pAge] = age;
    GetPlayerName(playa, giveplayer, sizeof(giveplayer));
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string, 256, "AdmWarning: %s has set %s's age to %d.", sendername,giveplayer,age);
    ABroadCast(COLOR_YELLOW,string,1);
    }
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
    }
    }
    return 1;
    }


    Es wird niemals so viel gelogen wie vor der Wahl, während des Krieges und nach der Jagd.

    - Otto von Bismarck
    -

  • #include <a_samp>


    #define FILTERSCRIPT


    #if defined FILTERSCRIPT


    #define COLOR_GRAD1 0xB4B5B7FF
    #define COLOR_GRAD2 0xBFC0C2FF


    enum pInfo
    {
    pKey[128],
    pAdmin,
    pReg,
    pCash,
    pKills,
    pDeaths,
    pAge
    };


    new PlayerInfo[MAX_PLAYERS][pInfo];


    public OnFilterScriptInit()
    {
    print("\n--------------------------------------");
    print("");
    print("--------------------------------------\n");
    return 1;
    }
    public OnFilterScriptExit()
    {
    return 1;
    }


    #else
    #endif


    public OnPlayerCommandText(playerid,cmdtext[])
    {
    new tmp[256];
    new cmd[256];
    new idx;
    if(strcmp(cmd, "/setage", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /setage [playerid/PartOfName] [age]");
    return 1;
    }
    new playa;
    new age;
    //playa = ReturnUser(tmp);
    tmp = strtok(cmdtext, idx);
    age = strval(tmp);
    if (PlayerInfo[playerid][pAdmin] >= 3)
    {
    if(IsPlayerConnected(playa))
    {
    if(playa != INVALID_PLAYER_ID)
    {
    new string[128];
    new name[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME];
    PlayerInfo[playa][pAge] = age;
    GetPlayerName(playa, name, sizeof(name));
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string, 256, "AdmWarning: %s has set %s's age to %d.", sendername,name,age);
    ABroadCast(COLOR_YELLOW,string,1);//war bei mir undefiniert ich weiß nicht woher du die funktion hast
    }
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
    }
    }
    return 1;
    }
    return 0;
    }


    strtok(const string[], &index)
    {
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
    index++;
    }


    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
    result[index - offset] = string[index];
    index++;
    }
    result[index - offset] = EOS;
    return result;
    }