Get Game Text

_Safa

Well-known member
Joined
Sep 22, 2019
Messages
297
Reaction score
103
Location
UGBASE
You want to display a gametext?

C++:
Code by y0mike

void GameText(const char* szText, int iTime, signed int iStyle)
{
    typedef void(__stdcall* GameText_t)(const char*, int, signed int);
    GameText_t pGameText = (GameText_t)(g_dwSAMP + 0x9C2C0);
    return pGameText(szText, iTime, iStyle);
}

samp.GameText("~r~You're gay!", 1000, 5);
 

_Safa

Well-known member
Joined
Sep 22, 2019
Messages
297
Reaction score
103
Location
UGBASE
You can hook the incoming RPC ID 73 and read out the message buffer.
 
  • Like
Reactions: pnx

dphome

Well-known member
Joined
Mar 21, 2020
Messages
475
Solutions
9
Reaction score
168
Location
Poland
Code:
        case RPC_DisplayGameText:
        {
            BitStream bsData(rpcParams->input, rpcParams->numberOfBitsOfData / 8, false);
            char szMessage[400];
            int iType, iTime, iLength;

            bsData.Read(iType);
            bsData.Read(iTime);
            bsData.Read(iLength);

            if (iLength > 400) return;

            bsData.Read(szMessage, iLength);
            szMessage[iLength] = '\0';

            if (set.test)
            {
                addMessageToChatWindow("%s", szMessage);
            }
            break;
        }
        }
 

pnx

Member
Joined
Dec 21, 2019
Messages
10
Reaction score
1
Location
Israel
Thanks It worked, but how do I use these functions in another project, like a dll?
You need to link it to the other project as well, include them and hook into Render and Reset functions.
There’s a lot of examples in the internet...
But first learn some basic CPP
 

pnx

Member
Joined
Dec 21, 2019
Messages
10
Reaction score
1
Location
Israel
Another easy way to print the text for gametext is by simply hooking function between the text and the execution
 
Top