02.01.2011, 05:42
Quote:
Im Requesting 2 commands...
/heal [PLAYERID] /ban [PLAYERID] [REASON] in strcmp.. nor dcmd or others.. |
pawn Код:
if(strcmp("/ban", cmd, true) == 0)
{
if(PlayerInfo[playerid][pAdminLevel] > 0)
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp))
{
return SendClientMessage(playerid,COLOR_LIGHTRED,"USAGE: /ban [id] [reason]");
}
new reason[128];
reason = strrest(cmdtext, idx);
if (!strlen(reason)) SendClientMessage(playerid,COLOR_LIGHTRED,"USAGE: /ban [id] [reason]");
new id = strval(tmp);
new pid = playerid;
if(!IsPlayerConnected(id))
{
return SendClientMessage(playerid,COLOR_GRAY,"AdmCmd: This player is not online!");
}
new globalmsg[100];
new adminid[MAX_PLAYERS], victimid[MAX_PLAYERS];
GetPlayerName(pid, adminid, sizeof(victimid));
GetPlayerName(id, victimid, sizeof(victimid));
format(globalmsg,sizeof(globalmsg),"AdmWarn: Administrator %s has banned player %s [%s]",adminid,victimid, reason);
SendClientMessageToAll(COLOR_LIGHTBLUE,globalmsg);
PlayerInfo[id][pAccountLocked] = 1;
BanEx(id, reason);
return 1;
}
else
{
SendClientMessage(playerid,COLOR_GRAY,"You don't have authorization.");
return 1;
}
}
stock strrest(const string[], index)
{
new length = strlen(string),offset = index,result[128];
while ((index < length) && ((index - offset) < (sizeof(result) - 1)) && (string[index] > '\r'))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}