[CMD-Error] /warn
#8

Код:
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;
}
Reply


Messages In This Thread
[CMD-Error] /warn - by Flashy - 24.06.2010, 11:01
Re: [CMD-Error] /warn - by Montis123 - 24.06.2010, 11:11
Re: [CMD-Error] /warn - by Flashy - 24.06.2010, 11:13
Re: [CMD-Error] /warn - by Montis123 - 24.06.2010, 11:17
Re: [CMD-Error] /warn - by NewTorran - 24.06.2010, 11:27
Re: [CMD-Error] /warn - by Flashy - 24.06.2010, 11:37
Re: [CMD-Error] /warn - by aircombat - 24.06.2010, 11:48
Re: [CMD-Error] /warn - by DJDhan - 24.06.2010, 11:54
Re: [CMD-Error] /warn - by W00Z - 24.06.2010, 11:58

Forum Jump:


Users browsing this thread: 1 Guest(s)