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
#2

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

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

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.
Reply
#5

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.
Reply
#6

reduce the speed and see if it triggers
Reply
#7

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
Reply
#8

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.
Reply
#9

BUMP.
Reply
#10

show us the entire public and the timer
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)