Hier mal ein neuer Ban Code.
if(strcmp(cmd, "/ban", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SCM(playerid, COLOR_RED, "FEHLER: /ban [playerid] [grund]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (SpielerInfo[playerid][pAdmin] >= 3)
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(IsPlayerNPC(giveplayerid)) return 1;
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))
{
SCM(playerid, COLOR_RED, "FEHLER: /ban [playerid] [grund]");
return 1;
}
if(SpielerInfo[giveplayerid][pAdmin] >= 6)
{
SCM(playerid, COLOR_RED, "Du kannst kein Administrator bannen!");
return 1;
}
BanSpieler(giveplayerid,playerid,(result));
return 1;
}
}//not connected
}
else
{
format(string, sizeof(string), " %d ist kein aktiver Spieler.", giveplayerid);
SCM(playerid, COLOR_GRAD1, string);
}
}
return 1;
}
@wuzelsep96: