Quantcast

Jump to content

» «
Photo

GTA Modding With C

3 replies to this topic
Inan-Ahammad
  • Inan-Ahammad

    Project Props - Mapper

  • Members
  • Joined: 15 Jul 2016
  • Bangladesh

#1

Posted 01 August 2017 - 08:12 AM

Well,i am learning C.I dont know C++ yet.But i opened some source codes and tried to figure them out.As i noticed that there's a lot more to C++ than C and its a obvious fact.But I still can't get it.Well i know variables,data types etc of C and can make programs with it also but still i cant figure out how i can make my program to do some specific work on GTA games.Like I wanna decet some file it game directory and when the files are dected i wanna show a pop up before game starts.
I know can check a file or read a file using pointer but still how i am gonna put the pop up?
Will it work is i use printf or there is any other ways.???
I am still confused.Still it even possible to develop a mod via pure C???

Parik
  • Parik

    Transform

  • Members
  • Joined: 03 Dec 2012
  • Olympics

#2

Posted 01 August 2017 - 11:40 AM Edited by Parik, 01 August 2017 - 01:15 PM.

You cannot display a pop up with pure c. You have to use some sort of library.

Windows has WINAPI which has a nice function called MessageBox you can use to pop up a message box.

MessageBox(hWnd,lpText,lpCaption,uType)

this is its syntax. You can read about it on MSDN. https://msdn.microso...5(v=vs.85).aspx

Example Code:

MessageBox(NULL,"A file has been detected" , "Detected" , MB_ICONINFORMATION);

To have it run when the game starts , you have to compile the program as a dynamic link library , and then rename it to ASI. With the help of an asi loader it will be loaded.

 

I have some sample programs you might consider reading through ( C ):

[NOTE: neither was tested]

 

https://gist.github....6ea86e8dfd377ed- A mod similar to what you described.

https://gist.github....d62c64cd426965c- A script which increments your money by 20 if F6 is being holded. (GTA SA)

 

The above two were simple programs , and therefore could be made using "pure" c with winapi , however when you are trying to do bigger mods , such as writing your own multiplayer client , it will become more difficult to write them with pure C. Learning C++ and also taking up some projects would help you to improve. For simple mods it is not recommended to use C. You can easily do it using CLEO in GTA VC/SA , or using C#/C++ Scripthook for GTA V/IV.

  • K^2 likes this

K^2
  • K^2

    Vidi Vici Veni

  • Moderator
  • Joined: 14 Apr 2004
  • United-States
  • Best Poster [Technology / Programming] 2016
    Best Poster [Programming] 2015
    Most Knowledgeable [Web Development/Programming] 2013
    Most Knowledgeable [GTA Series] 2011
    Best Debater 2010

#3

Posted 01 August 2017 - 12:40 PM

If you want to use printf, you can open a new console window, and re-direct stdout to it. If no console has been created yet, as with most games, all you really have to do is call AllocConsole. That will open a new console window, and you'll be able to printf to it.

Keep in mind, though, that the game itself might also be printing a lot of debug info to stdout or stderror. So you might be getting a lot of stuff printed to that console.

But yeah, either way, your program has to communicate with something else to create output. Either the operating system or the game itself.

Inan-Ahammad
  • Inan-Ahammad

    Project Props - Mapper

  • Members
  • Joined: 15 Jul 2016
  • Bangladesh

#4

Posted 01 August 2017 - 12:59 PM Edited by inan.ahammad, 01 August 2017 - 01:02 PM.

You cannot display a pop up with pure c. You have to use some sort of library.
Windows has WINAPI which has a nice function called MessageBox you can use to pop up a message box.

MessageBox(hWnd,lpText,lpCaption,uType)
this is its syntax. You can read about it on MSDN. https://msdn.microso...5(v=vs.85).aspx
Example Code:
MessageBox(NULL,"A file has been detected" , "Detected" , MB_ICONINFORMATION);
To have it run when the game starts , you have to compile the program as a dynamic link library , and then rename it to ASI. With the help of an asi loader it will be loaded.
 
I have some sample programs you might consider reading through ©:
[NOTE: neither was tested]
 
https://gist.github....6ea86e8dfd377ed- A mod similar to what you described.
https://gist.github....d62c64cd426965c- A script which increments your money by 20 if F6 is being holded. (GTA SA)
 
The above two were simple programs , and therefore could be made using "pure" c with winapi , however when you are trying to do bigger mods , such as writing your own multiplayer client , it will become more difficult to write them with pure C. Learning C++ and also taking up some projects would help you to improve. For simple mods it is not recommended to use C. You can easily do it using CLEO in GTA VC/SA , or using C#/C++ Scripthook for GTA V/IV.
Thanks bro..I really needed a help on that.
So i think it will be best for me to got to C++ then.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users