Menu
Is free
registration
home  /  Programs/ Download plugin for gta san andreas. Writing a simple ASI plugin for GTA San Andreas

Download plugin for gta san andreas. Writing a simple ASI plugin for GTA San Andreas

I warn you right away it will be difficult, but not everything is as scary as it seems.
Let's write a simple plugin, the function of which will be: by pressing a key, we give our player a bunch of bucks, for a rich and happy life!
An article for beginners, experienced coders, it will be useless.

Get to the point! First, download the IDE, and in simple words- a program in which programmers work their wonders. I chose a free and quite convenient, and most importantly simple one - Dev C ++ 5.11.
You can download it
You can choose whatever you want, like Code Blocks or Visual Studio C ++, it's a matter of taste, I recommend Code Blocks.

I warn you in advance if you could not install yourself this program, or download, then you should not read this article further.

Run the program, click on the menu - create ---> project and select DLL.

We save our project to any previously created folder under the name AsiPlugin.
The source code of the project opens in front of us, we do not touch anything, all you need now is a function called DllMain.

What is DllMain? This is a function that can be called by the game at startup and, accordingly, everything that you have in mind will be executed in this piece of code. For our little experiment, we need the following piece of code:

Case DLL_PROCESS_ATTACH: (// here we write our action and it will be executed. Break;)

What do we need in order to fund a player's account? That's right, first find out when we pressed the key!
I will give you a template for this function and you can use it in the future.

Void OnTimer (HWND hwnd, UINT msg, UINT idTimer, DWORD dwTime) (if (GetAsyncKeyState (0x47) & 0x8000) // if you pressed G, 0x47 is the key code (// then we execute our code here))

The codes for the keyboard can be found.
This section of the code will be constantly repeated and each time the state of the G key will be checked.

Next is the hardest part. We need the address of a variable that stores the amount of the player's money. Using this address, we count the money into our variable and write the new amount.
Go here (here you will find the main addresses of the game variables)

We see our address: 0xB7CE50 - Money.
How do you use this, you ask? Explaining!

DWORD Many = * (DWORD *) 0xB7CE50; // get money.
* (DWORD *) 0xB7CE50 = 1000000; // give money to the player

DWORD Many = * (DWORD *) 0xB7CE50; // how much money does the player have? if (Many

Next, we need to start a timer that will perform our function and ask each time: have we pressed a key?
This is done like this - SetTimer (0, 0, 200, (TIMERPROC) OnTimer); // 200 interval in milliseconds

As a result, we get the following code:

Void OnTimer (HWND hwnd, UINT msg, UINT idTimer, DWORD dwTime) (if (GetAsyncKeyState (0x47) & 0x8000) // if G was pressed (DWORD Many = * (DWORD *) 0xB7CE50; // get the amount of money if (Many

Now we just have to compile our program and try it in the game. I want to draw your attention right away. Choose 32 bit compiler in Dev C ++, otherwise our plugin won't work.
See the picture for how to do it and what to click to compile.

Did it work without errors? If yes, then go to the folder with our project and find DLL file which we got. Rename the extension to ASI and drop it into the game folder. Important! Don't forget to install AsiLoader, or CLEO 4.
That's all. Start the game and press G. Is everything working? Well done, congratulations!
Ask what's next? My answer is: study programming, maybe you will become a modding guru, and maybe even cooler.
For those who did not succeed, I give the plugin AsiPlugin.rar and the source of the project lesson.rar.

Useful links:
Programming books can be downloaded.
Addresses and functions of Gta San Andreas, there you can also find a base for IDA, in which there are many interesting things. I'm afraid I need a separate article on how to use IDA.

Thank you for your attention, I hope you liked the article! Good luck to all!
p.s: If the article arouses interest, then in the next article I will teach you how to use the GTA functions and, for example, spawn cars.

The article is exclusive for the site site, when copying the material, you must provide a link to the site.

Scripts

When using CLEO, new scripts can be added to the game, written in Sanny Builder or another script editor, without having to start new game... All that is required to add such a script to the game is to place it in the CLEO folder. The script will start working after the start of the game. To remove a script from the game, delete the corresponding file.

All scripts are written by fans of the game and are not related to the developers of CLEO. Although the CLEO library itself should work with different versions games, individual scripts may have their own restrictions and requirements for the game files. For questions about the performance of a particular script, please contact its author.

Opcodes

CLEO 4 adds 100 new script commands to the game that allow you to work with external files, change data in the game memory, call game functions with your own parameters, and much more.

In the fourth version, new commands appeared for working with sounds, strings, the ability to display text on the screen without using external files(.gxt, .fxt). To evaluate new achievements and use them in your scripts, install latest version libraries CLEO 4.

Plugins

CLEO plugins are regular DLL files, but with the extension .CLEO. At startup, the CLEO library looks for files with the given extension in the CLEO folder and tries to load them. If the download is successful, the plugin starts working and performs the functions for which it was written.

CLEO 4 allows you to create new opcodes using source codes CLEO SDK. In the starter kit of the library, you can find three examples of such plugins.

Plugins are installed and removed in the same way as scripts. A list of available plugins can be found on this page.

Installation

CLEO 4 is distributed as automatic installer... To install the library, run the installer and follow its instructions.

CLEO 4.3 supports three versions of the GTA game San andreas: 1.0, 1.01, 3.0 (steam).

CLEO requires the installation of ASI Loader, which comes with the library. ASI Loader is a program that automatically loads .asi files when starting a game. ASI Loader replaces one of the original game files "vorbisFile.dll" with its own, so make sure you make a copy of this file.

Other game files are not replaced, but are added following files and folders:
- cleo \ (folder CLEO, into which all scripts and plugins are copied)
- cleo \ FileSystemOperations.cleo (plugin for working with files)
- cleo \ IniFiles.cleo (plugin for working with INI)
- cleo \ IntOperations.cleo (plugin for working with integers at the bit level)
- cleo \ cleo_save \ (save folder CLEO)
- cleo.asi (the core of the CLEO library)
- bass.dll (library for working with audio)
- vorbisHooked.dll (Silent "s ASI Loader)
All plugins are optional, but their functionality can be used by various CLEO scripts.

CLEO 4 for San Andreas requires BASS.dll version 2.4 installed to play sound files, which can be downloaded from the official website of Un4seen Developments Ltd.

CLEO 3 compatible

CLEO is constantly improving and expanding over time. In very rare cases, some scripts written for CLEO 3 may not work with CLEO 4. Starting with CLEO 4.3, you can enable special treatment compatibility for CLEO 3 scripts. To do this, change the script file extension (usually ".cs") to ".cs3". CLEO 4.3 will work with such scripts in a special mode, which includes changing the behavior of some script commands. At the same time, in the vast majority of cases, CLEO 3 scripts work with CLEO 4 without any problems, and the use of compatibility mode is not required.

About the authors

The developers are not affiliated with Take 2 Interactive or Rockstar Games and are not responsible for any negative consequences caused by using of this product or any other products distributed with the library. Use it at your own risk.

Information about changes in version 4.3 and more detailed description CLEO features can be found in the readme files that come with the library.

ASI Loader - allows you to run asi scripts, it is necessary for mods to work in GTA 5. Note, if you already have it installed, then in this case you do not need to install ASI Loader, since the asi script is already included in the hook script.

The script is needed for those players who prefer to use a variety of mods in the game that add many different features, from functionality for changing the models of the main characters, to all kinds of trainers.

Mod ASI Mod Manager

Some players think that you need to run the asi loader somehow separately, but this is not the case, you just need to install the file with the .dll extension and all subsequent downloaded modifications will work.

The scene of Grand Theft Auto V was the fictional city of Los Santos, the prototype of which is Los Angeles. Los Santos first appeared in one of the previous games in the series, Grand Theft Auto: San Andreas, released in 2004. In the game, in addition to the city itself, there are also adjacent areas of the countryside, mountains, forests, hills, and beaches, in the game called "Blaine County". There is also a separate play space - the fictional state of North Yankton; probably a parody of the real state of North Dakota close to the Canadian border. There is only one gloomy city in this state - Ludendorff. You cannot get to North Yankton, with the exception of two story missions, which take place directly in Ludendorff. The entire map of Los Santos and its environs is open to players from the very beginning. There are 39 locations in the game in total.

How to install

Copy dinput8.dll to root folder GTA 5. If this file is already present just replace it.