if(strcmp(cmd, "/kick", true) == 0)
{
if(gAdminOnDuty[playerid] != 1)
{
SendClientMessage(playerid, COLOR_GRAD2, "You must be on duty to use this command!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_USAGE, "USAGE: /kick [playerid] [reason]");
return 1;
}
new playa;
if(IsStringAName(tmp))
{
playa = GetPlayerID(tmp);
}
else
{
playa = strval(tmp);
}
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[144];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_USAGE, "USAGE: /kick [playerid] [reason]");
return 1;
}
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 1 && PlayerInfo[playerid][pRealAdmin] == 1)
{
format(string, sizeof(string), "AdmCmd: %s Kicked you, Reason: %s",sendername,result);
SendClientMessage(playa, COLOR_ADMIN, string);
KickTimer[playa] = SetTimerEx("KickPlayer",5000,true,"d",playa);
Kick(playa);
format(string, sizeof(string), "AdmCmd: %s Kicked %s, Reason: %s",sendername,giveplayer,result);
printf("%s",string);
KickLog(string);
format(string, sizeof(string), "AdmCmd: %s Kicked %s, Reason: %s",sendername,giveplayer,result);
SendClientMessageToAll(COLOR_ADMIN, string);
}
else
{
SendClientMessage(playerid, COLOR_RED, "Invalid admin level, you cannot use this command");
}
return 1;
}
ummm i guess to show the message before kicking...the only way is timer lol...u have 5 seconds timer..? i think one second (1000) will work. and i dont see anything wrong and m also noob at scripting lol
|
KickTimer[playa] = SetTimerEx("KickPlayer",5000,true,"d",playa);
Kick(playa);