07.10.2017, 00:48
how can I know when player do ESC?
Anti-InvalidSeat (Anti-Crasher)
Код:
const PASSENGER_SYNC = 211; IPacket:PASSENGER_SYNC(playerid, BitStream:bs){ if GetPlayerVehicleSeat(playerid) == 0 *then{ new string[100],name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); format(string,sizeof(string),"[Anti-CrasherHack]: %q (ID:%d) auto-kicked [Reason: InvalidSeat]",name,playerid); SendClientMessageToAll(-1,string); string[0] = EOS; Kick(playerid); return false; } return true; } |
#include <a_samp> #include <Pawn.RakNet> new bool:PlayerAFK[MAX_PLAYERS],TimerEx[MAX_PLAYERS]; forward OnPlayerAFK(playerid); public OnPlayerConnect(playerid) { TimerEx[playerid] = SetTimerEx("OnPlayerAFK", 1000, true, "i", playerid); return true; } public OnIncomingPacket(playerid, packetid, BitStream:bs) { PlayerAFK[playerid] = false; return true; } public OnPlayerAFK(playerid) return PlayerAFK[playerid] = true; public OnPlayerDisconnect(playerid, reason) { KillTimer(TimerEx[playerid]); TimerEx[playerid] = 0; PlayerAFK[playerid] = false; return true; } /* if(PlayerAFK[playerid] == true){ player is pause }else{ not in pause }*/
That Kar include sucks, because those distances and false rates are too big and it detects when player is flying to the other side of the map and then also its questionable.
|
const VEHICLE_SYNC = 200; IPacket:VEHICLE_SYNC(playerid, BitStream:bs) { new inCarData[PR_InCarSync]; BS_IgnoreBits(bs, 8); BS_ReadInCarSync(bs, inCarData); static Float:S = floatsqroot(floatpower(floatabs(inCarData[PR_velocity][0]), 2.0) + floatpower(floatabs(inCarData[PR_velocity][1]), 2.0) + floatpower(floatabs(inCarData[PR_velocity][2]), 2.0)) * 253.3; if(S > 350.0) { new string[144],name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); format(string,sizeof(string),"{FF0000}[Anti-SpeedCar]: {FFFF00}%s {999999}(ID:%d) {00FF00}auto-kicked {FF0000}[Reason: SpeedCar]", name,playerid); SendClientMessageToAll(-Unu, string); string[0] = EOS; Kick(playerid); return false; } return true; }
const PLAYER_SYNC = 207; IPacket:PLAYER_SYNC(playerid, BitStream:bs) { new onFootData[PR_OnFootSync]; BS_IgnoreBits(bs, 8); BS_ReadInCarSync(bs, onFootData); static Float:S = floatsqroot(floatpower(floatabs(onFootData[PR_velocity][0]), 2.0) + floatpower(floatabs(onFootData[PR_velocity][1]), 2.0) + floatpower(floatabs(onFootData[PR_velocity][2]), 2.0)) * 253.3; if(S > 100.0) { new string[144],name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); format(string,sizeof(string),"{FF0000}[Anti-SpeedSkin]: {FFFF00}%s {999999}(ID:%d) {00FF00}auto-kicked {FF0000}[Reason: SpeedSkin]", name,playerid); SendClientMessageToAll(-Unu, string); string[0] = EOS; Kick(playerid); return false; } return true; }