The include has been tested for any bugs and so far it's working perfectly. If you find any bug, report it here.
Only one function: - OnPlayerQuickTurn(playerid, turntype) Turntypes 1 - As a driver 2 - As a passenger
V1.1 - Added types in the callback. - Added a check if player uses quick turn while being as a passenger. (Type #2)
#if defined sQt_Included #endinput #endif #define sQt_Included #include <a_samp> #define MIN_ROT_VARIANCE 89.0 #define MAX_ROT_VARIANCE 91.0 /*================================================= * Forwarding Hooks ===================================================*/ #if defined sQt_OnPlayerUpdate forward sQt_OnPlayerUpdate(playerid); #endif #if defined sQt_OnPlayerStateChange forward sQt_OnPlayerStateChange(playerid, newstate, oldstate); #endif #if defined OnPlayerQuickTurn forward OnPlayerQuickTurn(playerid, infractions); #endif /*================================================= * Variable For Old Angle ===================================================*/ static Float:sQt_OldAngle[MAX_PLAYERS]; static sQt_Infractions[MAX_PLAYERS]; /*================================================= * Callbacks ===================================================*/ public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == PLAYER_STATE_DRIVER) { new Float:z_rot; new vehicleid = GetPlayerVehicleID(playerid); GetVehicleZAngle(vehicleid, sQt_OldAngle[playerid]); } #if defined sQt_OnPlayerStateChange return sQt_OnPlayerStateChange(playerid, newstate, oldstate); #else return 1; #endif } public OnPlayerUpdate(playerid) { if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { new Float:z_rot; new vid = GetPlayerVehicleID(playerid); GetVehicleZAngle(vid, z_rot); if((sQt_OldAngle[playerid] - z_rot) <= MIN_ROT_VARIANCE || (sQt_OldAngle[playerid] - z_rot) >= MAX_ROT_VARIANCE) { sQt_Infractions[playerid]++; #if defined OnPlayerQuickTurn OnPlayerQuickTurn(playerid, sQt_Infractions[playerid]); #endif } sQt_OldAngle[playerid] = z_rot; } #if defined sQt_OnPlayerUpdate return sQt_OnPlayerUpdate(playerid); #else return 1; #endif } public OnPlayerDisconnect(playerid) { sQt_Infractions[playerid] = 0; #if defined sQt_OnPlayerDisconnect return sQt_OnPlayerDisconnect(playerid); #else return 1; #endif } /*================================================= * Hooked Functions ===================================================*/ #if defined _ALS_OnPlayerStateChange #undef OnPlayerStateChange #else #define _ALSOnPlayerStateChange #endif #define OnPlayerStateChange sQt_OnPlayerStateChange #if defined _ALS_OnPlayerUpdate #undef OnPlayerUpdate #else #define _ALS_OnPlayerUpdate #endif #define OnPlayerUpdate sQt_OnPlayerUpdate #if defined _ALS_OnPlayerDisconnect #undef OnPlayerDisconnect #else #define _ALS_OnPlayerDisconnect #endif #define OnPlayerDisconnect sQt_OnPlayerDisconnect
Why not do it like this?
Код:
#if defined sQt_Included #endinput #endif #define sQt_Included #include <a_samp> #define MIN_ROT_VARIANCE 89.0 #define MAX_ROT_VARIANCE 91.0 /*================================================= * Forwarding Hooks ===================================================*/ #if defined sQt_OnPlayerUpdate forward sQt_OnPlayerUpdate(playerid); #endif #if defined sQt_OnPlayerStateChange forward sQt_OnPlayerStateChange(playerid, newstate, oldstate); #endif #if defined OnPlayerQuickTurn forward OnPlayerQuickTurn(playerid, infractions); #endif /*================================================= * Variable For Old Angle ===================================================*/ static Float:sQt_OldAngle[MAX_PLAYERS]; static sQt_Infractions[MAX_PLAYERS]; /*================================================= * Callbacks ===================================================*/ public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == PLAYER_STATE_DRIVER) { new Float:z_rot; new vehicleid = GetPlayerVehicleID(playerid); GetVehicleZAngle(vehicleid, sQt_OldAngle[playerid]); } #if defined sQt_OnPlayerStateChange return sQt_OnPlayerStateChange(playerid, newstate, oldstate); #else return 1; #endif } public OnPlayerUpdate(playerid) { if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { new Float:z_rot; new vid = GetPlayerVehicleID(playerid); GetVehicleZAngle(vid, z_rot); if((sQt_OldAngle[playerid] - z_rot) <= MIN_ROT_VARIANCE || (sQt_OldAngle[playerid] - z_rot) >= MAX_ROT_VARIANCE) { sQt_Infractions[playerid]++; #if defined OnPlayerQuickTurn OnPlayerQuickTurn(playerid, sQt_Infractions[playerid]); #endif } sQt_OldAngle[playerid] = z_rot; } #if defined sQt_OnPlayerUpdate return sQt_OnPlayerUpdate(playerid); #else return 1; #endif } public OnPlayerDisconnect(playerid) { sQt_Infractions[playerid] = 0; #if defined sQt_OnPlayerDisconnect return sQt_OnPlayerDisconnect(playerid); #else return 1; #endif } /*================================================= * Hooked Functions ===================================================*/ #if defined _ALS_OnPlayerStateChange #undef OnPlayerStateChange #else #define _ALSOnPlayerStateChange #endif #define OnPlayerStateChange sQt_OnPlayerStateChange #if defined _ALS_OnPlayerUpdate #undef OnPlayerUpdate #else #define _ALS_OnPlayerUpdate #endif #define OnPlayerUpdate sQt_OnPlayerUpdate #if defined _ALS_OnPlayerDisconnect #undef OnPlayerDisconnect #else #define _ALS_OnPlayerDisconnect #endif #define OnPlayerDisconnect sQt_OnPlayerDisconnect |
I used the exact number for a reason. I have debugged the cheat and its exact 90 difference and moreover Rogue said that its better to use exact number cuz he said when player turns left angle goes from 0 to 360
|
His script will work because he blocked it between 89 and 91 but he missed the negative angle so it will counter the cheat but not always.
I hardly see a difference that would affect much between yours and his. |
Well, why would you ever want to disregard precision? That is such a poor mentality. I equate that statement right away to "it's good enough" for me nothing is ever good enough. Sure I talk shit to you guys! I know it but I talk the same shit to myself constantly.
I will talk some more shit that is..... neither of you guys have proven shit to me beyond you are both probably capable of taking your work to the extreme. The sooner you guys stop making these petty bullshit releases and go for the gold I won't be fully impressed until that time. |
Originally Posted by Pottus
petty bullshit releases and go for the gold
|
I'm just trying to push you guys to do better. That is all and I made a mistake there but an easy fix and I was well aware of that I just didn't address it at all. I don't know why I have to be such a prick
|
I found a compiler stopping bug in the code. I posted an issue on github along with a fix.
https://github.com/Sunehildeep/OnPla...kTurn/issues/1 |