01.06.2013, 02:57
not showing the name of the player who got warned
Код:
// Warn a player COMMAND:warn(playerid, params[]) { new id, Reason[128], ReasonMsg[128], Name[24]; new tmp[128]; SendAdminText(playerid, "/warn", params); // Check if the player has logged in if (APlayerData[playerid][LoggedIn] == true) { // Check if the player's admin-level is at least 1 if (APlayerData[playerid][PlayerLevel] >= 1) { if (sscanf(params, "us[128]", id, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /warn [id] [Reason]"); else if (IsPlayerConnected(id)) // If the player is a valid playerid (he's connected) { // Increase the number of warnings APlayerData[id][Warnings]++; // Get the name of the player who warned the player GetPlayerName(playerid, Name, sizeof(Name)); GetPlayerName(params[0], tmp, MAX_PLAYER_NAME); // Send the warned player a message who warned him and why he's been warned format(ReasonMsg, 128, "Administrator %s has %s gave warning a for: %s (%i/%i)",Name,tmp, Reason, APlayerData[id][Warnings], AutoKickWarnings); SendClientMessageToAll(0xFF0000FF, ReasonMsg); // Get the name of the warned player GetPlayerName(id, Name, sizeof(Name)); // Automatically kick the player if he got 3 warnings (if autokick is enabled) if ((APlayerData[id][Warnings] == AutoKickWarnings) && (AutoKickAfterWarn == 1)) Kick(id); } else SendClientMessage(playerid, 0xFF0000FF, "ERROR: That player isn't online"); } } // Let the server know that this was a valid command return 1; }