Quote:
Originally Posted by Kaylux
pawn Код:
COMMAND:kick(playerid, params[]) { new giveplayerid, reason[24], string[125], name[24]; if(IsPlayerAdmin(playerid)) { if(sscanf(params, "is", giveplayerid, reason)) return SendClientMessage(playerid,WHITE,"[ERROR]Usage: /kick [playerid] [reason]"); else if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid,WHITE,"[ERROR] Player Is Not Connected"); else { GetPlayerName(giveplayerid, name, sizeof(name)); format(string, sizeof(string), "<< ADM KICK >> Admin %s kicked %s(%d) | Reason: %s", name, GetPlayerNameEx(giveplayerid), giveplayerid, reason); SendClientMessageToAll(YELLOW, string); Kick(giveplayerid);
} } else return SendClientMessage(playerid, WHITE, "SERVER: Unknown Command"); return 1; }
|
If you are using newest version of 'sscanf' here, you need to add string lenght in sscanf parameters.
pawn Код:
if(sscanf(params, "is[24]", giveplayerid, reason)) return SendClientMessage(playerid,WHITE,"[ERROR]Usage: /kick [playerid] [reason]");
If you don't do this, it will print warning to server console.
Even if this isn't much of a problem, you could still edit your post and hopefully make it "better".