angol fórumon találtam.
[pawn]if(strcmp(cmd, \"/kick\", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, \"USAGE: /kick [playerid/PartOfName] [reason]\");
return 1;
}
giveplayerid = ReturnUser(tmp);
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerNameEx(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerNameEx(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: /kick [playerid/PartOfName] [reason]\");
return 1;
}
format(string, sizeof(string), \"AdmCmd: %s was kicked by %s, reason: %s (%d-%d-%d)\", giveplayer, sendername, (result),month,day,year);
format(string, sizeof(string), \"AdmCmd: %s was kicked by %s, reason: %s.\", giveplayer, sendername, (result),month,day,year);
SendClientMessageToAll(COLOR_LIGHTRED, string);
Kick(giveplayerid);
return 1;
}
}
}
else
{
format(string, sizeof(string), \" %d is not an active player.\", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}[/pawn]