Jump to content
  • 0

Ajutor comanda /ban


urban90

Question

2 answers to this question

Recommended Posts

if(strcmp(cmd, "/ban", true) == 0)

{

    if(IsPlayerConnected(playerid))

    {

    tmp = strtok(cmdtext, idx);

if(!strlen(tmp))

{

SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ban [playerid/PartOfName] [reason]");

return 1;

}

giveplayerid = ReturnUser(tmp);

if (PlayerInfo[playerid][pAdmin] >= 3)

{

    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, "USAGE: /ban [playerid/PartOfName] [reason]");

return 1;

}

new year, month,day;

getdate(year, month, day);

format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);

format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", giveplayer, sendername, (result));

SendClientMessageToAll(COLOR_LIGHTRED, string);

PlayerInfo[giveplayerid][pAdmin] = PlayerInfo[giveplayerid][pLevel];

PlayerInfo[giveplayerid][pLevel] = -999;

BanLog(string);

Ban(giveplayerid);

return 1;

}

}//not connected

}

else

{

format(string, sizeof(string), "  %d is not an active player.", giveplayerid);

SendClientMessage(playerid, COLOR_GRAD1, string);

}

}

return 1;

}

16189165.gifrastamaunbydeejaylobo1.gifsmileysw0181.gif

xmsok6ay41.gif

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.