Post: How To Use "sprintf" In Your SPRX
08-14-2014, 10:41 PM #1
Shark
Retired.
(adsbygoogle = window.adsbygoogle || []).push({}); Hey, since a lot of people have been having trouble getting sprintf to work in their codes due to compile errors I have decided to release this so people are able to use sprintf without any issues as its a really useful function to have :p

well first of all if you want to use this for other games you will need to the "com_sprintf" address from the game and you also need the TOC

    
//0x03E4BE0 - Com_sprintf (char *dest, int size, const char *fmt,...)

opd_s Com_sprintf_t = { 0x03E4BE0, TOC };
int(*Com_sprintf)(char *dest, int size, const char *fmt, ...) = (int(*)(char *, int, char const *, ...))&Com_sprintf_t;


How To Use
    
char buffer[100];
Com_sprintf(buffer, 100, "Testing %s %i", "Hi", 1337);
//Final String Will Be Stored In Buffer
//Buffer = "Testing Hi 1337"


You can do this method for any other functions that are in the game you just have to find the address Smile!
Last edited by Shark ; 08-17-2014 at 10:47 AM.

The following 12 users say thank you to Shark for this useful post:

ALI ALHILFI, Azus, EvilFerg, ImAzazel, Krxxl, milky4444, John, OhHotzz-, ParadoxSPRX, ryu_hayabusa80, wdegrgefwef
08-14-2014, 11:37 PM #2
Azus
Little One
Originally posted by Shark View Post
Hey, since a lot of people have been having trouble getting sprintf to work in their codes due to compile errors I have decided to release this so people are able to use sprintf without any issues as its a really useful function to have :p

well first of all if you want to use this for other games you will need to the "com_sprintf" address from the game and you also need the TOC

    
//0x03E4BE0 - Com_sprintf (char *dest, int size, const char *fmt,...)
//Function returns a pointer to the string

opd_s Com_sprintf_t = { 0x03E4BE0, TOC };
int(*Com_sprintf)(char *dest, int size, const char *fmt, ...) = (int(*)(char *, int, char const *, ...))&Com_sprintf_t;


How To Use
    
char buffer[100];
Com_sprintf(buffer, 100, "Testing %s %i", "Hi", 1337);
//Will return a pointer to a string "Testing Hi 1337"


You can do this method for any other functions that are in the game you just have to find the address Smile!


gg m8

The following user thanked Azus for this useful post:

John
04-03-2020, 04:34 PM #3
Whats Cod Ghost Com_sprintf_t

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo