Need help to make code short and better..
#1

Код:
public OnPlayerUpdate(playerid)
{
	UpdatePlayerMoney(playerid);
	Anticheat(playerid);
    return 1;
}
stock Anticheat(playerid)
{
   	new Float:Armour;
	GetPlayerArmour(playerid,Armour);
	new a[16];
	GetPlayerIp(playerid, a, sizeof(a));
	new year, month, day, hour, minuite, second;
    getdate(year, month, day);
  	gettime(hour,minuite,second);
    if(Player[playerid][pAdmin] < 1 )
    {
 	if(Armour > 99.0 && hacker[playerid] == 0){
	SCM(playerid, COLOR_YELLOW, "You have been banned from the server. Reason: Armour Hack");
 	format(Message,sizeof(Message),"SERVER : %s has been banned from the server. Reason: Armour Hack <Date: %d/%d/%d> <Time: %d:%d>",GetName(playerid),day,month,year,hour,minuite);
 	SCMToAll(COLOR_KRED,Message);
 	format(Message,sizeof(Message),"SERVER : %s and his ip %s",GetName(playerid),a);
	SaveIn("BanLog.txt",Message);
	hacker[playerid] =1;
    SetTimerEx("Banned",10,false,"d", playerid);
 	return 1;
}
	if(GetPlayerAnimationIndex(playerid))
	{ new animlib[32], animname[32]; GetAnimationName(GetPlayerAnimationIndex(playerid), animlib, sizeof(animlib), animname, sizeof(animname));
	 if(!strcmp(animlib, "PARACHUTE", true) && !strcmp(animname, "FALL_SkyDive_Accel", true))
	 { if(GetPlayerWeapon(playerid) != 46 && hacker[playerid] == 0)  {
	SCM(playerid, COLOR_YELLOW, "You have been banned from the server. Reason: Fly Hack");
 	format(Message,sizeof(Message),"SERVER : %s has been banned from the server. Reason: Fly Hack <Date: %d/%d/%d> <Time: %d:%d>",GetName(playerid),day,month,year,hour,minuite);
 	SCMToAll(COLOR_KRED,Message);
 	format(Message,sizeof(Message),"SERVER : %s and his ip %s",GetName(playerid),a);
	SaveIn("BanLog.txt",Message);
	hacker[playerid] =1;
 	SetTimerEx("Banned",10,false,"d", playerid);
 	return 1;
  }}}

	if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && hacker[playerid] == 0)
	{
	if(GetVehicleSpeed(GetPlayerVehicleID(playerid)) > 250 && !IsVehicleFLYVehicle(GetPlayerVehicleID(playerid))){
	SCM(playerid, COLOR_YELLOW, "You have been Kicked from the server. Reason: Sobiet Speed Hack");
 	format(Message,sizeof(Message),"SERVER : %s has been kick from the server. Reason: Speed Hack <Date: %d/%d/%d> <Time: %d:%d>",GetName(playerid),day,month,year,hour,minuite);
 	SCMToAll(COLOR_KRED,Message);
 	format(Message,sizeof(Message),"SERVER : %s and his ip %s",GetName(playerid),a);
	SaveIn("BanLog.txt",Message);
	hacker[playerid] =1;
    SetTimerEx("KickPlayer",10,false,"d", playerid);
	 return 1;
	}}

		new Float:Pos_x,Float:Pos_y,Float:Pos_z;
        new anim = GetPlayerAnimationIndex(playerid);
        GetPlayerVelocity(playerid,Pos_x,Pos_y,Pos_z);
        if((Pos_x <= -0.800000  || Pos_y <= -0.800000 || Pos_z <= -0.800000) && (anim == 1008 || anim == 1539))
        {
        if(hacker[playerid] == 0)
        {
		SCM(playerid, COLOR_YELLOW, "You have been banned from the server. Reason: Sobiet Fly Hack");
	 	format(Message,sizeof(Message),"SERVER : %s has been banned from the server. Reason: Sobiet fly Hack <Date: %d/%d/%d> <Time: %d:%d>",GetName(playerid),day,month,year,hour,minuite);
	 	SCMToAll(COLOR_KRED,Message);
	 	format(Message,sizeof(Message),"SERVER : %s and his ip %s",GetName(playerid),a);
		SaveIn("BanLog.txt",Message);
		hacker[playerid] =1;
	    SetTimerEx("Banned",10,false,"d", playerid);
		}
		}
}
return 1;
}
I'm using this Anti cheat code Under OnPlayerUpdate ! I want to know ! how i can make these all code short and more Efficient to reduce the lag .. Thanks.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)