15.04.2017, 18:24
(
Последний раз редактировалось LEOTorres; 15.04.2017 в 19:12.
)
Quote:
I had tried that, but sometimes the position of the camera with that of the player varies a lot.
Would you help me improve it? PHP код:
|
What I would recommend is having more checks to see whether the player is in fact using the spectate cheat, or it's just a bug or abnormal change in the game. This can be done by changing the players position back to default upon detection of the cheat the first time, then when a quick change is remade, you can be more likely positive that the player is using the spectate cheat.
Код:
new specWarn[MAX_PLAYERS]; forward ResetSpecWarn (playerid); new Float:PosPlayer[3], Float:PosCamera[3]; GetPlayerCameraPos(playerid, PosCamera[0], PosCamera[1], PosCamera[2]); GetPlayerPos(playerid, PosPlayer[0], PosPlayer[1], PosPlayer[2]); new Float:PosFinal[3]; PosFinal[0] = PosCamera[0] - PosPlayer[0]; PosFinal[1] = PosCamera[1] - PosPlayer[1]; new surf = GetPlayerSurfingVehicleID(playerid); new seat = GetPlayerVehicleSeat (playerid); if(PosFinal[0] > 20 || PosFinal[0] < -20 || PosFinal[1] > 20 || PosFinal[1] < -20) { if (specWarn[playerid] == 0) { specWarn[playerid] = 1; SetCameraBehindPlayer(playerid); SetTimerEx("ResetSpecWarn", 60000, false, "i", playerid); return 1; } if (surf != INVALID_VEHICLE_ID) { //player is using cheats or surfing is affecting the camera? return 1; } if (seat > 0) { //player is using cheats or g camera bug? return 1; } //player is using cheats (most likely) } public ResetSpecWarn (playerid) { specWarn[playerid] = 0; return 1; }