[C/C++] Toggle Samp Cursor

DutchGay101

Active member
Joined
Sep 15, 2023
Messages
27
Reaction score
2
Can Anyone Share The ToggleSampCursor Function For C/C++ ? Thanks<3
 

Expl01T3R

Active member
Joined
Nov 20, 2022
Messages
133
Reaction score
21
Location
Czech Republic
C++:
void toggleSAMPCursor(int iToggle)
{
    static int last_state = -1;

    if (g_Input == NULL) return;
    if (g_Input->iInputEnabled) return;
    if (last_state == iToggle) return;

    last_state = iToggle;
    void* obj = *(void**)(g_dwSAMP_Addr + SAMPOffsets[SAMP_MISC_INFO]);

    ((void(__thiscall*) (void*, int, bool)) (g_dwSAMP_Addr + SAMPOffsets[SAMP_FUNC_TOGGLECURSOR]))(obj, iToggle ? 3 : 0, !iToggle);
    if (!iToggle && SAMPOffsets[SAMP_FUNC_CURSORUNLOCKACTORCAM])
        ((void(__thiscall*) (void*)) (g_dwSAMP_Addr + SAMPOffsets[SAMP_FUNC_CURSORUNLOCKACTORCAM]))(obj);
}

0.3.7-R1:
C++:
SAMPOffsets[SAMP_FUNC_TOGGLECURSOR] = 0x9BD30;
SAMPOffsets[SAMP_FUNC_CURSORUNLOCKACTORCAM] = 0x9BC10;
 
Top