Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Easy, look you use OnPlayerUpdate(playerid)
- //So mine is like this, It's kinda simple and easy
- new SpeedHacking[MAX_PLAYERS];
- #define SpeedCheck(%0,%1,%2,%3,%4) floatround(floatsqroot(%4?(%0*%0+%1*%1+%2*%2):(%0*%0+%1*%1) ) *%3*1.6)
- //=================================================================================================//
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_GREEN 0x33AA33AA //{00FF00}
- #define COLOR_RED 0xFF0000AA //{FF0000}
- #define COLOR_YELLOW 0xFFFF00AA
- #define COLOR_WHITE 0xFFFFFFAA //{FFFFFF}
- #define COLOR_VIOLETBLUE 0x8A2BE2AA
- #define COLOR_DEADCONNECT 0x808080AA
- #define COLOR_BLUE 0x0000FFAA
- #define COLOR_FORESTGREEN 0x228B22AA
- #define COLOR_DODGERBLUE 0x1E90FFAA
- #define COLOR_DARKOLIVEGREEN 0x556B2FAA
- #define COLOR_ORANGE 0xFFA500AA
- #define COLOR_PURPLE 0x800080AA
- #define COLOR_ROYALBLUE 0x4169FFAA
- #define COLOR_ERROR 0xD2691EAA
- #define COLOR_PINK 0xFF0080FF
- #define COLOR_SEXYGREEN 0x00FF00FF
- #define COLOR_LIGHTBLUE 0x33CCFFAA
- #define COLOR_LIME 0x10F441AA
- #define COLOR_CYAN 0x40FFFFFF
- #define COLOR_ORANGERED 0xFF4500AA
- //=================================================================================================//
- //Under OnPlayerUpdate
- public OnPlayerUpdate(playerid)
- {
- //Anti SpeedHack
- if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
- {
- if(GetPlayerVehicleID(playerid) != 578 || GetPlayerVehicleID(playerid) != 520 || GetPlayerVehicleID(playerid) != 578) //You can add more vehicle exceptions here
- {
- if(GetVehicleSpeed(GetPlayerVehicleID(playerid), 0) > 250)
- {
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- SetPlayerPos(playerid, x, y, z+5);
- SpeedHacking[playerid] =1;
- CheatsDetected(playerid);
- return 1;
- }
- }
- }
- //OTHER CODES
- return 1;
- }
- //=================================================================================================//
- //Now lets go to the stock CheatsDetected
- //Stock CheatsDeteceed
- stock CheatsDetected(playerid)
- {
- new string[128];
- if(SpeedHacking[playerid] == 1)
- {
- new pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
- format(string,sizeof(string),"[ANTI CHEAT] Anti-Cheat has banned %s(%d). [Reason: Cheats Detected]",pName,playerid);
- SendClientMessageToAll(COLOR_PINK,string);
- format(string, sizeof(string), "~r~BANNED!");
- GameTextForPlayer(playerid, string, 3000, 1);
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File,"Player's Data");
- INI_WriteString(File,"BanReason","Cheats Detected");
- INI_WriteString(File,"Reason","Speed Hacks");
- INI_Close(File);
- PlayerInfo[playerid][pBanned] =1;
- SetTimerEx("KickPlayer",1000,false,"i",playerid);
- return 1;
- }
- return 1;
- }
- //=================================================================================================//
- //In o.3x Kick(playerid); has proirity over all codes, so you have to make a timer for it
- //like this so it posts all the codes needed before the kick
- forward KickPlayer(ID);
- public KickPlayer(ID)
- {
- Kick(ID);
- return 1;
- }
- //=================================================================================================//
- //Now lets come to OnPlayerConnect part
- //So I'm using Y_INI as you see
- if(fexist(UserPath(playerid)))
- {
- INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
- if(PlayerInfo[playerid][pBanned] == 1)
- {
- format(string,sizeof(string),"[BANNED] You are currently banned from the server. [Reason: %s]",PlayerInfo[playerid][pBanReason]);
- SendClientMessage(playerid, COLOR_RED,string);
- SendClientMessage(playerid, COLOR_RED,"[BANNED] Please Ban Appeal on our forums at www.SERVER.net");
- SetTimerEx("KickPlayer",1000,false,"i",playerid);
- return 1;
- }
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"{FF0000}SERVER","{FFFFFF}Welcome back to the server! \n Type your password below to login.","Login","Quit");
- }
- //=================================================================================================//
- //Vehicle speed
- stock GetVehicleSpeed(vehicleid, get3d)
- {
- new Float:x, Float:y, Float:z;
- GetVehicleVelocity(vehicleid, x, y, z);
- return SpeedCheck(x, y, z, 100.0, get3d);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement