Jump to content

[V] Script/Native Documentation and Research


Alexander Blade

Recommended Posts

 

 

There is straight hierarchy for this , which excludes multiply script engines at all , for example

 

- c++ script engine

--- c++ plugin (1) (i.e. carspawner.asi)

--- .net wrapper built on top of the c++ plugin (2) (i.e. trainer.asi)

----- corresponding script for this wrapper (i.e. trainer.net -- as you can see corresponding file has the same name as the wrapper)

--- the same .net wrapper built on top of the c++ plugin (3) (i.e. coolplugin.asi)

----- corresponding script for this wrapper (i.e. coolplugin.net -- same as above)

 

The goal is to make everything version independent and as much compatible as possible , the only thing that will be changing is the script engine on top of this hierarchy . If we are talking about .net then script developer publishes his script (coolplugin.net) in pair with the wrapper it was written for (coolplugin.asi) , so for the end user there is no difference between installing c++ plugin (carspawner.asi) and installing .net one (coolplugin.asi + coolplugin.net) , meanwhile wrapper developer shouldn't maintain backward compatibility for a scripts his wrapper is running .

 

So if someone will want to build .net/javascript/python script engine for GTA V the only thing he will need to do is to build a wrapper on top of the c++ plugin .

Has anyone done a Python one yet?

 

a friend of me wants to do one but he just has not enough motivation

 

I'll give him motivation :p

Link to comment
Share on other sites

Fireboyd78

Just spent the past hour and a half (maybe longer) changing as many uppercase parameter names to lowercase, and also filling in the blanks to some obvious parameters. I corrected so many natives that I lost count!

 

@Alexander Blade, could you possibly add support to NativeDB for Vector3 pointer parameters? Here's an example:

 

void GET_MOBILE_PHONE_POSITION(Any p0) // 0xB2E1E1A0
Shouldn't the declaration be:

 

void GET_MOBILE_PHONE_POSITION(Vector3 *outPosition) // 0xB2E1E1A0
? Edited by CarLuver69
  • Like 2
Link to comment
Share on other sites

Alexander Blade

NATIVE DB is updated to support PC hashes , lots of stuff is rewritten , PC decompiled scripts published , lets test it !

 

CarLuver69

Check it now plz .

Edited by Alexander Blade
Link to comment
Share on other sites

NATIVE DB is updated to support PC hashes , lots of stuff is rewritten , PC decompiled scripts published , lets test it !

 

CarLuver69

Check it now plz .

You THE MAN

Lets do this

Link to comment
Share on other sites

NATIVE DB is updated to support PC hashes , lots of stuff is rewritten , PC decompiled scripts published , lets test it !

 

CarLuver69

Check it now plz .

 

Thanks a lot for the updates. :happy:

Link to comment
Share on other sites

TotalCraftGames

NATIVE DB is updated to support PC hashes , lots of stuff is rewritten , PC decompiled scripts published , lets test it !

 

CarLuver69

Check it now plz .

Thank you so much! Is it now possible to get or set fuel in cars for "Fuel HUD"?

Link to comment
Share on other sites

Fireboyd78

Great work!

 

Sent you a PM about something very important, by the way.

Edited by CarLuver69
Link to comment
Share on other sites

sasuke78200

Decompiled sources are weird, for example I take a function.

 

auto sub_182(auto _a0, auto _a1, auto _a2)

 

Look at the prototype, parameters always start with an underscore ("_"), but when they're used inside the function, the underscore is after the "a".

 

sub_1e0((a_0), (a_2), 0);

Link to comment
Share on other sites

Fireboyd78

The decompiled scripts are of terrible quality in general. I think "listener" should actually look at the output of his decompiled code before releasing anything...

Edited by CarLuver69
Link to comment
Share on other sites

The decompiled scripts are of terrible quality in general. I think "listener" should actually look at the output of his decompiled code before releasing anything...

 

At this moment, it noting more than proof-of-concept.

In the matter of fact, I haven't planned to release something. At least, until it can fully decompile scripts and compile them back.

I don't know, when I'll get some spare time for the scripts. Maybe in 2016. Maybe never.

 

Alexander had convinced me, that badly decompiled scripts is better than nothing. If he was wrong, ask him to remove link.

Link to comment
Share on other sites

Fireboyd78

 

The decompiled scripts are of terrible quality in general. I think "listener" should actually look at the output of his decompiled code before releasing anything...

At this moment, it noting more than proof-of-concept.

In the matter of fact, I haven't planned to release something. At least, until it can fully decompile scripts and compile them back.

I don't know, when I'll get some spare time for the scripts. Maybe in 2016. Maybe never.

 

Alexander had convinced me, that badly decompiled scripts is better than nothing. If he was wrong, ask him to remove link.

 

I shouldn't have been so harsh in my wording. I think your decompiler has potential, and once I get my new rig, I'm going to be looking into making an awesome decompiler (since everything else is taken, lol).

 

Are you going to provide any source code/documentation for scripts?

Link to comment
Share on other sites

sasuke78200

 

The decompiled scripts are of terrible quality in general. I think "listener" should actually look at the output of his decompiled code before releasing anything...

 

At this moment, it noting more than proof-of-concept.

In the matter of fact, I haven't planned to release something. At least, until it can fully decompile scripts and compile them back.

I don't know, when I'll get some spare time for the scripts. Maybe in 2016. Maybe never.

 

Alexander had convinced me, that badly decompiled scripts is better than nothing. If he was wrong, ask him to remove link.

 

 

 

Which method are you using to decompile ?

Link to comment
Share on other sites

Fireboyd78

EDIT: The following rant was written under the assumption that my changes were lost forever. I now know that my changes still exist on an old db and have not been lost after all.

 

So according to Alex, it's not worth reverting any changes to the NativeDB even though I spent 6 f*cking hours on hundreds of natives. 6 hours of fixing parameter names, figuring out unknown ones, adding easy to understand descriptions...

 

What a f*cking joke. No apology or anything. "I'm not reverting anything".

 

Don't waste your time on this guys. Your work isn't even appreciated.

Edited by CarLuver69
Link to comment
Share on other sites

So according to Alex, it's not worth reverting any changes to the NativeDB even though I spent 6 f*cking hours on hundreds of natives. 6 hours of fixing parameter names, figuring out unknown ones, adding easy to understand descriptions...

 

What a f*cking joke. No apology or anything. "I'm not reverting anything".

 

Don't waste your time on this guys. Your work isn't even appreciated.

Reverting? You mean you edited them and he didn't accept the edits?

Hope this is not true, else the thing is just worthless. If users can't make edits and improve the lack luster information which it provides then no reason for it to exist.

 

Maybe there is a misunderstanding though.

Link to comment
Share on other sites

Fireboyd78

Well nevermind, the old db where I made my changes is still there. I though it was overidden, which is why I was freaking out.

Edited by CarLuver69
Link to comment
Share on other sites

The function PATHFIND::GET_CLOSEST_ROAD is not yet documented so I went trough the decompiled scripts and tested, and came up wit the following:

BOOL GET_CLOSEST_ROAD(float X, float Y, float Z, float unknown1, int unknown2, float &X1, float &X2, float &Z, float &Y1, float &Y2, BOOL unknown3) // 132F52BBA570FE92 567B0E11

The X Y Z speaks for itself

unknown1, 2 and 3 doesn't seems to affect anything at this moment.

X1 and Y1 is the location of the first road lane, X2 and Y2 is the location of the second road lane. Z is used for both.

 

In some cases this works and I get the expected results.

But most of the time I get X1 as X1, X2 as Y1 or Y2, Y1 as X2 and the rest is 'garbage' data.

 

for example:

//e.g. playerLocation.x: 193.497, playerLocation.y: -1348.76, playerLocation.z: 29.3305PATHFIND::GET_CLOSEST_ROAD(playerLocation.x, playerLocation.y, playerLocation.z, 1.0f /*default: 1f*/, 1 /*default: 1*/, &roadX1, &roadX2, &roadZ, &roadY1, &roadY2, FALSE /*default: False*/);//output/*roadX1: 199.0roadY1: 195.25roadX2: -1351.75roadY2: 0roadZ: 2.9026e-045*///Expected output/*roadX1: 199.0roadY1: -1351.75roadX2: 195.25roadY2: ~-1350.75 (something like that)roadZ: ~29.3305*/

Any thoughts?

  • Like 1
Link to comment
Share on other sites

Alexander Blade

Check what it calls before , according to the original scripts you need to have valid node around .

Link to comment
Share on other sites

Fireboyd78

The "UNK_SC" namespace should be updated to "SOCIALCLUB".

Edited by CarLuver69
Link to comment
Share on other sites

Guys, I want to get the character ID so which API should I use? PLAYER_ID or PLAYER_PED_ID()? Is there an easier way to find the character that is currently playing as? I want to change my keyboard lighting when player switches character.

 

Anyway what is PED?

Link to comment
Share on other sites

Fireboyd78

Guys, I want to get the character ID so which API should I use? PLAYER_ID or PLAYER_PED_ID()? Is there an easier way to find the character that is currently playing as? I want to change my keyboard lighting when player switches character.

 

Anyway what is PED?

 

Have you looked in the decompiled scripts how they are used? And PED is basically for all things related to characters/pedestrians.

Link to comment
Share on other sites

 

Guys, I want to get the character ID so which API should I use? PLAYER_ID or PLAYER_PED_ID()? Is there an easier way to find the character that is currently playing as? I want to change my keyboard lighting when player switches character.

 

Anyway what is PED?

 

Have you looked in the decompiled scripts how they are used? And PED is basically for all things related to characters/pedestrians.

 

Yea I did use the NativeTrainer as reference. I tried PLAYER_ID and PLAYER_PED_ID both returns me inconsistent numbers. I thought there will be a fixed ID for characters. I also tried changing character use the NativeTrainer but still not getting what I want.

Link to comment
Share on other sites

Fireboyd78

You might have to resort to using the actual hashes of the character models.

Link to comment
Share on other sites

You might have to resort to using the actual hashes of the character models.

Thanks for the advice :)

Link to comment
Share on other sites

SSJ2_Snake

Guys, I want to get the character ID so which API should I use? PLAYER_ID or PLAYER_PED_ID()? Is there an easier way to find the character that is currently playing as? I want to change my keyboard lighting when player switches character.

 

Anyway what is PED?

 

Try PLAYER.GET_PLAYER_INDEX(), that seems to be what GTALua is using.

Link to comment
Share on other sites

diamond-optic

did the return for GET_HASH_KEY change?

 

like should it return Hash instead of int..

 

before while having unarmed selected ingame the values for these would be the same:

 

GET_HASH_KEY("WEAPON_UNARMED"))

GET_SELECTED_PED_WEAPON(PLAYER.PLAYER_PED_ID()))

 

Old Output:

 

get_hash: 2725352035

player_weap: 2725352035

 

but now im getting:

 

get_hash: -1569615261

player_weap: 2725352035

Link to comment
Share on other sites

Alexander Blade

Function should return unsigned value , not int

 

did the return for GET_HASH_KEY change?

like should it return Hash instead of int..

before while having unarmed selected ingame the values for these would be the same:

GET_HASH_KEY("WEAPON_UNARMED"))
GET_SELECTED_PED_WEAPON(PLAYER.PLAYER_PED_ID()))

Old Output:

get_hash: 2725352035
player_weap: 2725352035

but now im getting:

get_hash: -1569615261
player_weap: 2725352035

Link to comment
Share on other sites

jfmherokiller

I have figured out 2 of the parameters to CHANGE_PLAYER_PED the first one is the output of PLAYER.GET_PLAYER_INDEX() and the second one is the id of the ped you wish to change to.

here is my example code that works to change the ped

natives.PLAYER.CHANGE_PLAYER_PED(natives.PLAYER.GET_PLAYER_INDEX(),ped.ID,false,false)

sorry that it is in GTALua I just found it easier than writing test code that would require me to restart the game for every little edit.

void PLAYER::CHANGE_PLAYER_PED(int playerindex, int PedId, BOOL p2, BOOL p3)--changes the Ped of the player to the one specified by PedId

based upon what I have found I have updated the function.

Link to comment
Share on other sites

ThalonMook

Hi I have found some issues in the native.h from the Script Hook SDK.

I think they shoud be also updated in the GTAV NATIVE DB.

Wrongstatic Any GET_PLAYER_RADIO_STATION_NAME() { return invoke<Any>(0xF6D733C32076AD03); }Rightstatic char* GET_PLAYER_RADIO_STATION_NAME() { return invoke<char*>(0xF6D733C32076AD03); }Wrongstatic Any GET_PLAYER_RADIO_STATION_NAME(Any p0) { return invoke<Any>(0xF6D733C32076AD03); }Rightstatic char* GET_PLAYER_RADIO_STATION_NAME(Any p0) { return invoke<char*>(0xF6D733C32076AD03); }

Thx for all the work.

Link to comment
Share on other sites

 

 

The .net hook didn't call game natives directly (even though you could call them directly) and had many things preconfigured. Yes that is indeed easier to use but makes customization harder to achieve.

 

The scripthook came with a development loader in which any asi/dll that was loaded could be unloaded and reloaded. Including the .net scripthook by the way. Which is another downside I mentioned before, it is another layer.

 

 

Though I have never programmed in .NET (I'm fluent mainly in only C and C++), I personally noticed large performance hits when using others' .NET modifications.

 

because they wrote sh*tty code... if the .net developer knows what he is doing, the user should notice no difference between an asi and .net dlls calling the same native functions & logic

Edited by c39687
Link to comment
Share on other sites

Is 1.49 the highest movement speed you can set?

 

I tried setting PLAYER::_SET_SWIM_SPEED_MULTIPLIER(player, 2.0); but it doesn't seem to take. I tried 2.0f too.

 

Thanks for the help.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.