Jump to content

[V|REL|HOOK] LUA Plugin for Script Hook V


headscript

Recommended Posts

panther_124

can you convert me a lua script to a asi script?

 

here is the lua code:

 

local jesus = {}
function jesus.unload()
end
function jesus.init()
end
function jesus.tick()
local player = PLAYER.PLAYER_PED_ID()
local pos = ENTITY.GET_ENTITY_COORDS(player, true)
WATER.MODIFY_WATER(pos.x,pos.y,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x,pos.y,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x,pos.y + 5,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x,pos.y + 4,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x,pos.y + 3,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x,pos.y + 2,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x,pos.y + 1,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x,pos.y - 1,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x,pos.y - 2,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x,pos.y - 3,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x,pos.y - 4,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x,pos.y - 5,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x,pos.y + 3,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x,pos.y,pos.z + 3,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x + 3,pos.y,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x,pos.y,pos.z + - 3,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x + - 3,pos.y,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
end
return jesus
Link to comment
Share on other sites

headscript

 

can you convert me a lua script to a asi script?

 

here is the lua code:

 

local jesus = {}
function jesus.unload()
end
function jesus.init()
end
function jesus.tick()
local player = PLAYER.PLAYER_PED_ID()
local pos = ENTITY.GET_ENTITY_COORDS(player, true)
WATER.MODIFY_WATER(pos.x,pos.y,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x,pos.y,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x,pos.y + 5,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x,pos.y + 4,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x,pos.y + 3,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x,pos.y + 2,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x,pos.y + 1,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x,pos.y - 1,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x,pos.y - 2,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x,pos.y - 3,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x,pos.y - 4,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x,pos.y - 5,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x,pos.y + 3,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x,pos.y,pos.z + 3,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x + 3,pos.y,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x,pos.y,pos.z + - 3,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
WATER.MODIFY_WATER(pos.x + - 3,pos.y,pos.z,99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999*99999999999999999999)
end
return jesus

 

there is no default datatype in lua or c++ which can hold 9 duotrigintillion long numbers

Link to comment
Share on other sites

headscript

That means that the script wont work? because its not working on lua.

yep it wont work also water natives not working anyways (at least noone knows how to use them)

Link to comment
Share on other sites

Back when the LUA plugin was on v8 I modified szabo's persistance mod to save & load custom plates and the dirt level.

 

in Lua plugin version 9 the GET_VEHICLE_DIRT_LEVEL stopped returning the expected integer so that stopped working

 

in Lua plugin version 10 the dirt still doesn't work, but now the GET_VEHICLE_PLATE_TEXT has also stopped working.

 

Can we expect to see these fixed in the future or are we at the complete mercy of people randomly changing the nativesDB database?

Link to comment
Share on other sites

headscript

Back when the LUA plugin was on v8 I modified szabo's persistance mod to save & load custom plates and the dirt level.

 

in Lua plugin version 9 the GET_VEHICLE_DIRT_LEVEL stopped returning the expected integer so that stopped working

 

in Lua plugin version 10 the dirt still doesn't work, but now the GET_VEHICLE_PLATE_TEXT has also stopped working.

 

Can we expect to see these fixed in the future or are we at the complete mercy of people randomly changing the nativesDB database?

are we at the complete mercy of people randomly changing the nativesDB database?

yep unfortunatly for the current time yes

you could as alexander blade if he may got a way

Link to comment
Share on other sites

 

Back when the LUA plugin was on v8 I modified szabo's persistance mod to save & load custom plates and the dirt level.

 

in Lua plugin version 9 the GET_VEHICLE_DIRT_LEVEL stopped returning the expected integer so that stopped working

 

in Lua plugin version 10 the dirt still doesn't work, but now the GET_VEHICLE_PLATE_TEXT has also stopped working.

 

Can we expect to see these fixed in the future or are we at the complete mercy of people randomly changing the nativesDB database?

are we at the complete mercy of people randomly changing the nativesDB database?

yep unfortunatly for the current time yes

you could as alexander blade if he may got a way

 

 

I don't know him, or how scripthook, lua plugin or nativeDB interact

 

I have edited the GET_VEHICLE_PLATE_TEXT native DB function back their correct return type (char*) , when will you be rebuilding Lua Plugin?

 

[edit] actually I need to test GET_VEHICLE_DIRT_LEVEL, it should return a float & looks like it has and it was correctly defined in nativeDB so that may be working OK.

Edited by janimal
Link to comment
Share on other sites

headscript

 

 

Back when the LUA plugin was on v8 I modified szabo's persistance mod to save & load custom plates and the dirt level.

 

in Lua plugin version 9 the GET_VEHICLE_DIRT_LEVEL stopped returning the expected integer so that stopped working

 

in Lua plugin version 10 the dirt still doesn't work, but now the GET_VEHICLE_PLATE_TEXT has also stopped working.

 

Can we expect to see these fixed in the future or are we at the complete mercy of people randomly changing the nativesDB database?

are we at the complete mercy of people randomly changing the nativesDB database?

yep unfortunatly for the current time yes

you could as alexander blade if he may got a way

 

 

I don't know him, or how scripthook, lua plugin or nativeDB interact

 

I have edited the two native DB functions back their correct return types, when will you be rebuilding Lua Plugin?

 

https://github.com/gallexme/LuaPlugin-GTAV

all 10 minutes

Link to comment
Share on other sites

 

 

Back when the LUA plugin was on v8 I modified szabo's persistance mod to save & load custom plates and the dirt level.

 

in Lua plugin version 9 the GET_VEHICLE_DIRT_LEVEL stopped returning the expected integer so that stopped working

 

in Lua plugin version 10 the dirt still doesn't work, but now the GET_VEHICLE_PLATE_TEXT has also stopped working.

 

Can we expect to see these fixed in the future or are we at the complete mercy of people randomly changing the nativesDB database?

are we at the complete mercy of people randomly changing the nativesDB database?

yep unfortunatly for the current time yes

you could as alexander blade if he may got a way

 

 

I don't know him, or how scripthook, lua plugin or nativeDB interact

 

I have edited the GET_VEHICLE_PLATE_TEXT native DB function back their correct return type (char*) , when will you be rebuilding Lua Plugin?

 

[edit] actually I need to test GET_VEHICLE_DIRT_LEVEL, it should return a float & looks like it has and it was correctly defined in nativeDB so that may be working OK.

 

I thought dirt level were integer...

 

Anyway, I'm going to implement plate text and also dirt level in the future... plate text is trivial, it was working before they screwed with the nativedb, but the dirt level has the problem that most people don't want to keep re-saving their vehicles, so I'd need to make it so when the player leaves any saved vehicle the dirt level is updated, what's going to take some time and tinkering :).

 

At the moment there's still a color that I've only saw in one airplane that won't save, it's a 'tertiary' colour but there's nothing 'tertiary' on the nativedb. Other than that, the plate text and the dirt level, everything else is saving so the mod is progressing (although slowly cause I don't have the time and I'm developing yet another mod atm).

Link to comment
Share on other sites

GTAGeek123

Just a quick note I can get the dirt level to save and re-apply just fine. However, the plates still don't save text, just a number.

 

I noticed that janimal said that he changed the type back to (char*) in the nativeDB. The current command I'm using is below. Does it need to altered for the text to save now that it has been changed in the nativeDB?

 

My current script:

table.insert (vals, VEHICLE.GET_VEHICLE_NUMBER_PLATE_TEXT(v))

 

 

Quote from janimal:

 

I have edited the GET_VEHICLE_PLATE_TEXT native DB function back their correct return type (char*) , when will you be rebuilding Lua Plugin?

 

 

Edit: Nevermind, figured it out.

Edited by GTAGeek123
Link to comment
Share on other sites

diamond-optic

*edit*

 

nevermind..

Edited by diamond-optic
Link to comment
Share on other sites

 

Noob Q: Where can I find the latest LUA.asi NATIVES list ?

http://www.dev-c.com/nativedb/

 

 

Yes, that's where I've found them too... It might be me being noob at all this coding stuff but I feel like some of those natives act different in asi then in LUA. Like for ex. accepting different value types Int & string, in asi but only Int in LUA...

 

Ex: AUDIO::SET_VEH_RADIO_STATION(Vehicle vehicle, char *radioStation) in asi accepts "NULL" as 2nd parameter while in LUA it doesn't... it gives an error asking for an Int.

The problem it's that Radio Off Index appears to be "255" ? but it does nothing... and "NULL" it's not accepted as an Int... since it really isn't... :(

I thought that the LUA plugin somehow "translates" or "emulates" hardcoded natives so the HookScript to interpret them as "asi", thus the LUA natives could be different/erroneous if not up to date with the "official" natives db... if that makes any sense...

Edited by 80T
Link to comment
Share on other sites

headscript

Lua plugins call 1 to 1 every native without anything in between

Check if it's correct on nativedb and that u have the latest sdk version from Github

 

just checked as it is a char* on nativedb you have to pass a string as second argument

Edited by headscript
Link to comment
Share on other sites

MADRIZONABRUTA

What does this error mean?



[22:08:05] [ERROR] Caught fatal unhandled exception:

System.NullReferenceException: Referencia a objeto no establecida como instancia de un objeto.

en RealLife.OnTick(Object sender, EventArgs e)

en GTA.Script.MainLoop()

Link to comment
Share on other sites

What does this error mean?

 

[22:08:05] [ERROR] Caught fatal unhandled exception:

System.NullReferenceException: Referencia a objeto no establecida como instancia de un objeto.

en RealLife.OnTick(Object sender, EventArgs e)

en GTA.Script.MainLoop()

That's a NET error, not a Lua

Link to comment
Share on other sites

MADRIZONABRUTA

 

What does this error mean?

 

[22:08:05] [ERROR] Caught fatal unhandled exception:

System.NullReferenceException: Referencia a objeto no establecida como instancia de un objeto.

en RealLife.OnTick(Object sender, EventArgs e)

en GTA.Script.MainLoop()

That's a NET error, not a Lua

 

sorryy :)

Link to comment
Share on other sites

@headscript Can you help me get luaLanes, or any other Preemptive Multitasking solution working, there is no other way to do what I am trying to do, coroutines will cause studdering, because one method call takes 50 mills, and i am using them correctly,

 

I am making an android app that communicates with a java application with sockets, and the java application is run by lua using io.piopen, and reads the output, that is how it is getting the messages from the phone, so the end user can use the app to controll the mod, instead of binding keys. it all works , except for the studdering, so i need to run the read call in another thread, so the game does not studder.

Link to comment
Share on other sites

headscript

@headscript Can you help me get luaLanes, or any other Preemptive Multitasking solution working, there is no other way to do what I am trying to do, coroutines will cause studdering, because one method call takes 50 mills, and i am using them correctly,

 

I am making an android app that communicates with a java application with sockets, and the java application is run by lua using io.piopen, and reads the output, that is how it is getting the messages from the phone, so the end user can use the app to controll the mod, instead of binding keys. it all works , except for the studdering, so i need to run the read call in another thread, so the game does not studder.

Hope you got Skype I am working on something already, just add me
Link to comment
Share on other sites

 

@headscript Can you help me get luaLanes, or any other Preemptive Multitasking solution working, there is no other way to do what I am trying to do, coroutines will cause studdering, because one method call takes 50 mills, and i am using them correctly,

 

I am making an android app that communicates with a java application with sockets, and the java application is run by lua using io.piopen, and reads the output, that is how it is getting the messages from the phone, so the end user can use the app to controll the mod, instead of binding keys. it all works , except for the studdering, so i need to run the read call in another thread, so the game does not studder.

Hope you got Skype I am working on something already, just add me

 

I will add you when I get home from work, won't be until about 4pm eastern time, and thankyou

Link to comment
Share on other sites

Lua plugins call 1 to 1 every native without anything in between

 

Check if it's correct on nativedb and that u have the latest sdk version from Github

 

just checked as it is a char* on nativedb you have to pass a string as second argument

 

I've updated to LUA v10 and the problem it's gone. I can pass NULL and strings as arguments and no more error in console asking for integer.

 

Oh, and the unload function now seems to be really working :D

Edited by 80T
Link to comment
Share on other sites

EnforcerZhukov

Hi, i'm trying to download the normal version but when i click on Free Download, after the wait time, it asks me to pay for the Premium service. Could you please upload the file to a decent hosting? thanks! :)

Link to comment
Share on other sites

headscript

Hi, i'm trying to download the normal version but when i click on Free Download, after the wait time, it asks me to pay for the Premium service. Could you please upload the file to a decent hosting? thanks! :)

i have no problems with downloading from it could you try it again : prove http://puu.sh/ibcma/fa4fd98195.png

Link to comment
Share on other sites

For some reason anytime I try to call WEAPON.GET_PED_LAST_WEAPON_IMPACT it crashes me when I shoot.

local coords = 0if(PED.IS_PED_SHOOTING(playerPed)) then	WEAPON.GET_PED_LAST_WEAPON_IMPACT_COORD(playerPed, coords)end

In the c code that other trainers has used, coords needed to be a float[6]... anytime I tried making coords an array it'd say "argument 2 is table, needs a number".

Link to comment
Share on other sites

EnforcerZhukov

 

Hi, i'm trying to download the normal version but when i click on Free Download, after the wait time, it asks me to pay for the Premium service. Could you please upload the file to a decent hosting? thanks! :)

i have no problems with downloading from it could you try it again : prove http://puu.sh/ibcma/fa4fd98195.png

 

 

Congratulations, but I tried from 3 different browsers several times and i always get this screen:

http://i.imgur.com/jgqjWxh.png

Indeed, before that, it says that "all the free slots are busy".

Could somebody reupload it to some other hosting? Like Mediafire or any other. Thanks¡

Link to comment
Share on other sites

I've noticed that native db has changed that native (the get coords of where your bullet hit I mentioned two posts up), so I shall try it out with the newly compiled lua_sdk and edit for my results.

 

EDIT:

 

I have no idea how to initialize a vector3 in lua with this plugin

Edited by Jsk2003
Link to comment
Share on other sites

Shnockered1

@headscript. I am new member, and have searched earnestly for a way to PM you a request, but have found no method to PM on this site. Can you please covert to independent ASI for this LUA script please??

https://www.gta5-mods.com/scripts/another-bank-job(need converted to ASI)

LUA scripts do not work on my PC.

ASI: Loading "C:\Program Files (x86)\Steam\steamapps\common\Grand Theft Auto V\LUA.asi"
"LUA.asi" failed to load
Link to comment
Share on other sites

reddevilthp

Im sorry if this sounds childishly stupid to you modders but doesnt the nativedb need to be protected or moderated somehow so that people cant just randomly change attributes? To a person who knows nothing about modding it seems like modders are doing a lot of hard work only to have it ruined by changes they have no idea who made.

 

Isnt there a way to moderate these changes and standardize the Lua Plugin versions so that modders dont have to spend so much time fighting compatibility issues?

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.