SA-MP Forums Archive
This function dont ban - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: This function dont ban (/showthread.php?tid=201309)



This function dont ban - Face9000 - 20.12.2010

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?


Respuesta: This function dont ban - admantis - 20.12.2010

i think Ban should be the last function because if player is offline (banned) you cant get playernames variables etc, you get me?


Re: This function dont ban - Face9000 - 20.12.2010

This ban only who reach a specific speedlimit,how the script can ban a player (offline) that has reached the specific speedlimit?lol.


Respuesta: Re: This function dont ban - admantis - 20.12.2010

Quote:
Originally Posted by Logitech90
Посмотреть сообщение
This ban only who reach a specific speedlimit,how the script can ban a player (offline) that has reached the specific speedlimit?lol.
I mean, instead of
pawn Код:
Ban(playerid);
SendClientMessage(playerid,0xFFFFFFF,"Hello world");
SetTimer("Timer1",1000,0);
It should be
pawn Код:
SendClientMessage(playerid,0xFFFFFFF,"Hello world");
SetTimer("Timer1",1000,0);
Ban(playerid);
Probably that's just not your problem, but I can't read good with that crappy identation, sorry.


Re: This function dont ban - Face9000 - 20.12.2010

Ye sorry for the identation,when i parsed the code here,the forum crappied it.

BTW I need the ban functions,or an answer why dont ban.

It's like an anticheat..autoban.


Re: This function dont ban - cessil - 20.12.2010

reduce the speed and see if it triggers


Re: This function dont ban - The_Gangstas - 21.12.2010

it should be > 250 and > 303/302. and check if there not in a train to.

no vehicle rlly goes 280 with hacks unless they hold the hack down forever


Re: This function dont ban - Face9000 - 21.12.2010

Edited a bit,now i get this:

pawn Код:
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);
            }
            return 1;
            }
}
@The_Gangstas i dont have trains in my gm.

But the code dont autoban :S

BTW I tried with a speedhack,i was going more than 400 km/h and the script havent banned me lol.


Re: This function dont ban - Face9000 - 21.12.2010

BUMP.


Re: This function dont ban - The_Gangstas - 21.12.2010

show us the entire public and the timer