24.06.2010, 11:54
Код:
dcmd_warn(playerid,params[]) { if(PlayerInfo[playerid][AdminLevel] < 1) return SendClientMessage(playerid, COLOR_BRIGHTRED,"ERROR: You are not a high enough level to use this command"); new tmp[256], tmp2[256], Index; tmp = strtok(params,Index); tmp2 = strtok(params,Index); if(!strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "USAGE: /warn [playerid] [reason]"); new pName[24], ReturnUserName[24], string[256]; new warned = strval(tmp); GetPlayerName(playerid, pName, 24); GetPlayerName(warned, ReturnUserName, 24); if(!IsPlayerConnected(playerid))) return SendClientMessage(playerid, COLOR_BRIGHTRED, "ERROR: Player is not connected"); if(warned==playerid) return SendClientMessage(playerid, COLOR_BRIGHTRED, "ERROR: You cannot warn yourself"); SendAdminMsg(playerid,"WARN"); PlayerInfo[warned][Warnings]++; if(PlayerInfo[warned][Warnings] == MAX_WARNINGS) { new File:KickFile = fopen("logs/KickLog.txt", io_append); format(str, sizeof (str), "[ADMIN]: %s (ID: %d) has kicked %s (ID: %d). (Reason: Reaching 3 Warnings.) (Warning: %d/%d)***", pName, playerid, ReturnUserName, ReturnPlayer, PlayerInfo[warned][Warnings], MAX_WARNINGS); SendClientMessageToAll(COLOR_BRIGHTRED, str); fwrite(KickFile, string); fclose(KickFile); Kick(warned); PlayerInfo[warned][Warnings] = 0; } format(str, sizeof (str), "[ADMIN]: %s has given %s a warning. (Reason: %s) (Warning: %d/%d)***", pName, ReturnUserName, params[1+strlen(tmp)], PlayerInfo[warned][Warnings], MAX_WARNINGS); SendClientMessageToAll(COLOR_PINK, str); return 1; }