This function dont ban
#1

Hi all,i maked a simple Speedcheck for cheaters.

If a players goes more than 280 km/h (with car),he will be autobanned,with the planes (310 km/h),same.

But this dont work,here is the code:

OnPlayerStateChange

Код:
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
		{
			new Float:speed;
			speed = GetPlayerSpeed(playerid, false);
			if(speed > 280)
			{
 			new string[100];
            new name[MAX_PLAYER_NAME];
         	GetPlayerName(playerid, name, sizeof(name));
            format(string, 100, "%s was auto-banned for SpeedHack.", name);
            SendClientMessageToAll(COLOR_RED, string);
            BanLog(string);
            Ban(playerid);
            new str[100];
   	        format(str,sizeof str,"0,4s was auto-banned for SpeedHack", name);
   	   	    IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
			}
			if(!IsPlayerInPlane(playerid))
			{
			speed = GetPlayerSpeed(playerid, true);
			if(speed > 310)
			{
 			new string[100];
            new name[MAX_PLAYER_NAME];
     	    GetPlayerName(playerid, name, sizeof(name));
            format(string, 100, "%s was auto-banned for SpeedHack.", name);
            SendClientMessageToAll(COLOR_RED, string);
            Ban(playerid);
            BanLog(string);
            new str[100];
   	        format(str,sizeof str,"0,4s was auto-banned for SpeedHack", name);
   	   	    IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
			}
			}
}
And the stocks:

Код:
stock GetPlayerSpeed(playerid,bool:kmh)
{
  	new Float:Vx,Float:Vy,Float:Vz,Float:rtn;
  	if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),Vx,Vy,Vz); else 	               GetPlayerVelocity(playerid,Vx,Vy,Vz);
  	rtn = floatsqroot(floatabs(floatpower(Vx + Vy + Vz,2)));
  	return kmh?floatround(rtn * 100 * 1.61):floatround(rtn * 100);
}

stock IsPlayerInPlane(playerid)
{
	if(IsPlayerInAnyVehicle(playerid))
	{
 		switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
	  	{
			case 593,592,577,563,553,548,520,519,513,512,511,
			497,488,487,476,469,460,447,425,417,493,484,453: return 1;
	   		default: return 0;
		}
	}
	return 0;
}
What's wrong with it?
Reply


Messages In This Thread
This function dont ban - by Face9000 - 20.12.2010, 22:19
Respuesta: This function dont ban - by admantis - 20.12.2010, 22:29
Re: This function dont ban - by Face9000 - 20.12.2010, 22:41
Respuesta: Re: This function dont ban - by admantis - 20.12.2010, 22:44
Re: This function dont ban - by Face9000 - 20.12.2010, 22:45
Re: This function dont ban - by cessil - 20.12.2010, 23:40
Re: This function dont ban - by The_Gangstas - 21.12.2010, 01:55
Re: This function dont ban - by Face9000 - 21.12.2010, 09:03
Re: This function dont ban - by Face9000 - 21.12.2010, 16:29
Re: This function dont ban - by The_Gangstas - 21.12.2010, 16:35

Forum Jump:


Users browsing this thread: 1 Guest(s)