/cheater 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
  • Hallo,


    ich brauche für meinen Server ein Cheater-Command. Das benutzte Filterscript ist lAdmin.


    Ein normales Ban-Command schaut so aus:


    dcmd_ban(playerid,params[]) {
    if(PlayerInfo[playerid][LoggedIn] == 1) {
    if(PlayerInfo[playerid][Level] >= 4) {
    new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /ban [playerid] [reason]");
    if(!strlen(tmp2)) return SendClientMessage(playerid, red, "ERROR: You must give a reason");
    new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
    player1 = strval(tmp);


    if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid && (PlayerInfo[player1][Level] != ServerInfo[MaxAdminLevel]) ) {
    GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname));
    new year,month,day,hour,minuite,second; getdate(year, month, day); gettime(hour,minuite,second);
    CMDMessageToAdmins(playerid,"BAN");
    format(string,sizeof(string),"%s has been banned by Administrator %s [Reason: %s] [Date: %d/%d/%d] [Time: %d:%d]",playername,adminname,params[2],day,month,year,hour,minuite);
    SendClientMessageToAll(grey,string);
    SaveToFile("BanLog",string);
    print(string);
    if(udb_Exists(PlayerName2(player1)) && PlayerInfo[player1][LoggedIn] == 1) dUserSetINT(PlayerName2(player1)).("banned",1);
    format(string,sizeof(string),"banned by Administrator %s. Reason: %s", adminname, params[2] );
    return BanEx(player1, string);
    } else return SendClientMessage(playerid, red, "Player is not connected or is yourself or is the highest level admin");
    } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
    } else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
    }


    Wie schaut dann ein spezielles /cheater cmd aus? Admins über 2 (Adminlevel) sollen /cheater [ID] tippen können, dann wird der Cheater automatisch gebannt mit der Begründung "[PLAYER] has been banned for cheating. No cookie for you"


    Wie macht man das?


    Danke
    Mo3

    Einmal editiert, zuletzt von Mo3 ()

  • dcmd_cheater(playerid, const params[])
    {
    if(PlayerInfo[playerid][LoggedIn] != 1) return SendClientMessage(playerid, 0xFF0000FF, "You have 2 login first!");
    if(PlayerInfo[playerid][Level] < 2) return SendClientMessage(playerid, 0xFF0000FF, "You need at least Admin Level 2 in order 2 use this command!");
    if(!params[0] || params[0] == '\0') return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /cheater [PlayerID]");
    new target = strval(params);
    if(!IsPlayerConnected(target)) return SendClientMessage(playerid, 0xFF0000FF, "User was not found on the Server. Please check if the ID is valid!");
    new name[MAX_PLAYER_NAME], aname[MAX_PLAYER_NAME], str[128];
    GetPlayerName(playerid, aname, sizeof(aname));
    GetPlayerName(target, name, sizeof(name));
    format(str, sizeof(str), "%s has been banned by Administrator %s because of his f*cking noob cheating.", name, aname);
    SendClientMessageToAll(0xFF0000FF, str);
    BanEx(target, "Cheating");
    return true;
    }


    Sollte funktionieren.

  • public OnPlayerCommandText(playerid, cmdtext[])
    {
    dcmd(cheater,7,cmdtext);
    return false;
    }