Schonma Danke
Und hier Tada der Command
if(strcmp(cmd, "/ban", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] != 1) { return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "FEHLER: /ban [playerid] [grund]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (Spieler[playerid][pAdmin] >= 2)
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
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, "FEHLER: /ban [playerid] [grund]");
return 1;
}
if(Spieler[giveplayerid][pAdmin] > Spieler[playerid][pAdmin])
{
SendClientMessage(playerid, COLOR_GRAD2, "Du kannst diesen Spieler nicht bannen, da er ein höheres Adminlevel hat als du!");
return 1;
}
new year, month,day;
getdate(year, month, day);
format(string, sizeof(string), "AdmCmd: %s wurde von %s gebannt, Grund: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
BanLog(string);
format(string, sizeof(string), "AdmCmd: %s wurde von %s gebannt, Grund: %s", giveplayer, sendername, (result));
SendClientMessageToAll(COLOR_LIGHTRED, string);
/*new VonName[MAX_PLAYERS];
new Weil[MAX_PLAYERS];
VonName[giveplayerid] = sendername;
Weil[giveplayerid] = (result);
format(Spieler[giveplayerid][pBannedVon],MAX_PLAYER_NAME,sendername);
format(Spieler[giveplayerid][pBannedWeil],128,result);*/
new pname[64];
new accFormat[64];
GetPlayerName(playerid,pname,sizeof pname);
format(accFormat,sizeof accFormat,"/Accounts/%s.GameData",pname);
dini_Set(accFormat,"BannedVon",sendername);
dini_Set(accFormat"BannedWeil",(result));
Spieler[giveplayerid][pBanned] = 1;
Ban(giveplayerid);
return 1;
}
}//not connected
}
else
{
format(string, sizeof(string), " %d ist kein aktiver Spieler.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}