12.11.2013, 19:10
Hello,
I have a question. How the fck my AC isn't work properly.
I use arrays when SetPlayerPos to AC to detect teleports etc.
But I don't know why the GetPlayerPos return false position.
Look at the code:
Function which I test (command /warp x y z)
And in Anti Cheat (in loop):
AC_CheckTeleport function:
Logs from testing:
Look at time - all is in 1 second.
AC check players every 1.5 sec.
warp command I type every about 1s all time - when AC won't send any msg.
It is possible that the functions overlap?
Please, help me.
I have a question. How the fck my AC isn't work properly.
I use arrays when SetPlayerPos to AC to detect teleports etc.
But I don't know why the GetPlayerPos return false position.
Look at the code:
Function which I test (command /warp x y z)
Код:
stock SetPlayerPosEx(playerid, Float:x, Float:y, Float:z) { SetPVarInt(playerid, "teleport", 1); PlayerInfo[playerid][pPos][0] = x; PlayerInfo[playerid][pPos][1] = y; PlayerInfo[playerid][pPos][2] = z; PlayerInfo[playerid][pOldPos][0] = x; PlayerInfo[playerid][pOldPos][1] = y; PlayerInfo[playerid][pOldPos][2] = z; SetPlayerPos(playerid, x, y, z); printf("Player %d pos set to: %f, %f, %f DEBUG (NEW: %f, %f, %f __ OLD: %f, %f, %f)", playerid, x, y, z,PlayerInfo[playerid][pPos][0],PlayerInfo[playerid][pPos][1],PlayerInfo[playerid][pPos][2],PlayerInfo[playerid][pOldPos][0],PlayerInfo[playerid][pOldPos][1],PlayerInfo[playerid][pOldPos][2]); }
Код:
GetPlayerPos(i, PlayerInfo[i][pPos][0],PlayerInfo[i][pPos][1],PlayerInfo[i][pPos][2]); AC_CheckTeleport(i); AC_CheckAirBreak(i); AC_CheckFly(i); AC_CheckCar(i); PlayerInfo[i][pOldPos][0] = PlayerInfo[i][pPos][0]; PlayerInfo[i][pOldPos][1] = PlayerInfo[i][pPos][1]; PlayerInfo[i][pOldPos][2] = PlayerInfo[i][pPos][2];
Код:
public AC_CheckTeleport(playerid) { if(GetPlayerSurfingVehicleID(playerid) == INVALID_VEHICLE_ID && GetPlayerSurfingObjectID(playerid) == INVALID_OBJECT_ID) { if(GetDistanceBetweenPoints(PlayerInfo[playerid][pOldPos][0], PlayerInfo[playerid][pOldPos][1], PlayerInfo[playerid][pOldPos][2], PlayerInfo[playerid][pPos][0], PlayerInfo[playerid][pPos][1], PlayerInfo[playerid][pPos][2]) > 350) { if(GetPVarInt(playerid, "spawned") == 1 && GetPVarInt(playerid, "ac_jump") == 0) { CallRemoteFunction("OnPlayerHack", "ii", playerid, 6); } } } }
Logs from testing:
Код:
[12/11/2013 21:02:50] Player 0 pos set to: -1720.089965, 1018.739074, 17.583700 DEBUG (NEW: -1720.089965, 1018.739074, 17.583700 __ OLD: -1720.089965, 1018.739074, 17.583700) [12/11/2013 21:02:50] Player 0 pos set to: -1613.584106, 732.961669, -5.243100 DEBUG (NEW: -1613.584106, 732.961669, -5.243100 __ OLD: -1613.584106, 732.961669, -5.243100) [12/11/2013 21:02:50] Anti-Cheat: Kubi (UID: 1) banned for Teleport (pos: -1720.089965|1018.739074|17.585937 old: -1613.584106|732.961669|-5.243100)
AC check players every 1.5 sec.
warp command I type every about 1s all time - when AC won't send any msg.
It is possible that the functions overlap?
Please, help me.