if(strcmp("/kick", cmdtext, true, 5) == 0)
{
if(IsPlayerAdmin(playerid) return SendClientMessage(playerid, 0xFF0000AA, "RCON needed.");
if(!strlen(cmdtext[6])) return SendClientMessage(playerid, 0xFF0000AA, "Use: /kick [playerid]");
new gp = strval(cmdtext[6]);
if(!IsPlayerConnected(gp)) return SendClientMessage(playerid, 0xFF0000AA, "Invalid Playerid");
new pn[24], an[24], str[70];
GetPlayerName(playerid, an, 24); GetPlayerName(gp, pn, 24);
format(str, sizeof(str), "%s kicked by admin %s", pn, an);
SendClientMessageToAll(0xA9A9A9AA, str);
Kick(gp);
return 1;
}
if(strcmp("/kick", cmdtext, true, 5) == 0)
{
if(IsPlayerAdmin(playerid) return SendClientMessage(playerid, 0xFF0000AA, "RCON needed.");
if(!strlen(cmdtext[6])) return SendClientMessage(playerid, 0xFF0000AA, "Use: /kick [playerid][reason]");
new gp = strval(cmdtext[6]);
if(!IsPlayerConnected(gp)) return SendClientMessage(playerid, 0xFF0000AA, "Invalid Playerid");
new pn[24], an[24], str[70], reason;
GetPlayerName(playerid, an, 24); GetPlayerName(gp, pn, 24);
format(str, sizeof(str), "%s kicked by admin %s", pn, an, reason);
SendClientMessageToAll(0xA9A9A9AA, str);
Kick(gp);
return 1;
}
if(!strlen(cmdtext[6])) return SendClientMessage(playerid, 0xFF0000AA, "Use: /kick [playerid][reason]");
you added
pawn Код:
|
format(str, sizeof(str), "%s kicked by admin %s[Reason: %s]", pn, an, reason);
reason = bigstrtok(cmdtext, idx);
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
new cmd[128]; new idx;
cmd = strtok(cmdtext, idx);
if(strcmp("/kick", cmd, true) == 0)
{
if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000AA, "RCON needed.");
idx++; cmd = strtok(cmdtext, idx);
if(!strlen(cmd)) return SendClientMessage(playerid, 0xFF0000AA, "Use: /kick [PLAYERID] [REASON]");
new gp = strval(cmd);
if(!IsPlayerConnected(gp)) return SendClientMessage(playerid, 0xFF0000AA, "Invalid Playerid");
idx++; cmd = strtok(cmdtext, idx);
if(!strlen(cmd)) return SendClientMessage(playerid, 0xFF0000AA, "Use: /kick [playerid] [REASON]");
new reason[128];
while(strlen(cmd)) {
strcat(reason, cmd, sizeof(reason));
strcat(reason, " ", sizeof (reason));
idx++; cmd = strtok(cmdtext, idx);
}
strdel(reason, strlen(reason)-1, strlen(reason));
new pn[24], an[24], str[70];
GetPlayerName(playerid, an, 24); GetPlayerName(gp, pn, 24);
format(str, sizeof(str), "%s kicked by admin %s (reason: %s)", pn, an, reason);
SendClientMessageToAll(0xA9A9A9AA, str);
Kick(gp);
return 1;
}
if(strcmp("/kick", cmdtext, true, 5) == 0)
{
if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000AA, "RCON needed.");
if(!strlen(cmdtext[6])) return SendClientMessage(playerid, 0xFF0000AA, "Use: /kick [playerid][reason]");
new gp = strval(cmdtext[6]);
if(!IsPlayerConnected(gp)) return SendClientMessage(playerid, 0xFF0000AA, "Invalid Playerid");
new pn[24], an[24], str[70], reason[156];
reason = bigstrtok(cmdtext, idx);
GetPlayerName(playerid, an, 24); GetPlayerName(gp, pn, 24);
format(str, sizeof(str), "%s kicked by admin %s[Reason: %s]", pn, an, reason);
SendClientMessageToAll(0xA9A9A9AA, str);
Kick(gp);
return 1;
}
C:\Users\Admin\Desktop\Pawn\gamemodes\new_rp.pwn(503) : warning 219: local variable "str" shadows a variable at a preceding level C:\Users\Admin\Desktop\Pawn\gamemodes\new_rp.pwn(504) : error 017: undefined symbol "bigstrtok" C:\Users\Admin\Desktop\Pawn\gamemodes\new_rp.pwn(504) : error 033: array must be indexed (variable "reason") Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 2 Errors.
if(!strcmp("/kick", cmdtext, true, 5))
{
if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000AA, "RCON needed.");
if(!strlen(cmdtext[6])) return SendClientMessage(playerid, 0xFF0000AA, "Use: /kick [playerid][reason]");
new gp = strval(cmdtext[6]);
if(!IsPlayerConnected(gp)) return SendClientMessage(playerid, 0xFF0000AA, "Invalid Playerid");
new pn[24], an[24], str2[70], reason[128];
reason = strtok(cmdtext, idx);
GetPlayerName(playerid, an, 24); GetPlayerName(gp, pn, 24);
format(str2, sizeof(str2), "%s kicked by admin %s[Reason: %s]", pn, an, reason);
SendClientMessageToAll(0xA9A9A9AA, str2);
Kick(gp);
return 1;
}
CMD:kick(playerid, params[])
{
new PID, Str[70], PlayerName[MAX_PLAYER_NAME], PIDName[MAX_PLAYER_NAME];
if(sscanf(params, "us[50]", PID, params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /Kick < Player ID > < Reason >");
if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, COLOR_RED, "That player is not connected!");
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
GetPlayerName(PID, PIDName, sizeof(PIDName));
format(Str, sizeof(Str), "Admin: %s(%d) has kicked: %s(%d) for: %s", PlayerName, playerid, PIDName, PID, params);
SendClientMessageToAll(COLOR_GREY, Str);
return Kick(PID);
}