28.03.2016, 14:29
Quote:
I know what Zcmd is , but im wondering, where is Sscanf used for?
THe download link for Sscanf is not working at the thread ? |
I have the command "/kick <playerid/partofname> <reason>"
pawn Код:
CMD:kick(playerid, params[]) {
new id, reason;
if(sscanf(params, "us[100]", id, reason)) return SendClientMessage(playerid, -1, "USAGE: /kick <playerid/partofname> <reason>");
}
If the parameters in the command is not entered as shown above, we will then return the syntax-message.
You can with the rest of the command use the parameters we've entered.
pawn Код:
CMD:kick(playerid, params[]) {
new id, reason, name[MAX_PLAYER_NAME];
if(sscanf(params, "us[100]",id, reason)) return SendClientMessage(playerid, -1, "USAGE: /kick <playerid/partofname> <reason>");
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You're not an admin.");
Kick(id);
GetPlayerName(id, name, sizeof(name));
format(string, sizeof(string), "%s has been kicked of the server. Reason: %s", name, reason);
SendClientMessageToAll(-1, string);
return 1;
}