Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Forum Support

    3. Suggestions

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


headscript
 Share

Recommended Posts

headscript

Thanks Headscript!

 

PS: Not to offend but it'll be nice if you can make your code readable.

 

Edit:

 

I can help you with that if you want help if you're going to make it readable.

 

 

 

 

I don't know if it is my script or it is the Lua SDK because I'm getting this error: "unload: attempt to call a nil value"

 

Even without the code it still has that error. This only happened since I've updated the Lua SDK.

 

Please help.

 

Thanks.

 

With Code:

 

 

function bodyguardScript.unload()  for k, guard in pairs(guards) do    if (guard ~= nil) then      PED.DELETE_PED(guard)      guards[k] = nil      bodyguardCount = 0    end  endend

 

 

 

Without code still causes that error:

 

 

function bodyguardScript.unload()end

 

 

and you Sir just found a bug :) (no actually i forogt to update the main.lua in the zip sorry)

 

headscript does this work with the new ScripthookV?

yes apart from the bug mentioned above which i will fix instantly

 

-Fixed just redownload it -

 

 

 

i have nothing against help :) would be nice if you would make it readable

Link to comment
Share on other sites

Foul_Play

Sure! What files need making readable?

 

 

 

 

 

Thanks Headscript!

 

PS: Not to offend but it'll be nice if you can make your code readable.

 

Edit:

 

I can help you with that if you want help if you're going to make it readable.

 

 

 

 

I don't know if it is my script or it is the Lua SDK because I'm getting this error: "unload: attempt to call a nil value"

 

Even without the code it still has that error. This only happened since I've updated the Lua SDK.

 

Please help.

 

Thanks.

 

With Code:

 

 

function bodyguardScript.unload()  for k, guard in pairs(guards) do    if (guard ~= nil) then      PED.DELETE_PED(guard)      guards[k] = nil      bodyguardCount = 0    end  endend

 

 

 

Without code still causes that error:

 

 

function bodyguardScript.unload()end

 

 

and you Sir just found a bug :) (no actually i forogt to update the main.lua in the zip sorry)

 

headscript does this work with the new ScripthookV?

yes apart from the bug mentioned above which i will fix instantly

 

-Fixed just redownload it -

 

 

 

i have nothing against help :) would be nice if you would make it readable

 

 

Link to comment
Share on other sites

headscript

Sure! What files need making readable?

 

 

 

 

 

Thanks Headscript!

 

PS: Not to offend but it'll be nice if you can make your code readable.

 

Edit:

 

I can help you with that if you want help if you're going to make it readable.

 

 

 

 

I don't know if it is my script or it is the Lua SDK because I'm getting this error: "unload: attempt to call a nil value"

 

Even without the code it still has that error. This only happened since I've updated the Lua SDK.

 

Please help.

 

Thanks.

 

With Code:

 

 

function bodyguardScript.unload()  for k, guard in pairs(guards) do    if (guard ~= nil) then      PED.DELETE_PED(guard)      guards[k] = nil      bodyguardCount = 0    end  endend

 

 

 

Without code still causes that error:

 

 

function bodyguardScript.unload()end

 

 

and you Sir just found a bug :) (no actually i forogt to update the main.lua in the zip sorry)

 

headscript does this work with the new ScripthookV?

yes apart from the bug mentioned above which i will fix instantly

 

-Fixed just redownload it -

 

 

 

i have nothing against help :) would be nice if you would make it readable

 

 

gui.lua main.lua for now

Link to comment
Share on other sites

Foul_Play

Sure, I'll get working on it tomorrow when I'm back to my house.

 

 

 

Sure! What files need making readable?

 

 

 

 

 

Thanks Headscript!

 

PS: Not to offend but it'll be nice if you can make your code readable.

 

Edit:

 

I can help you with that if you want help if you're going to make it readable.

 

 

 

 

I don't know if it is my script or it is the Lua SDK because I'm getting this error: "unload: attempt to call a nil value"

 

Even without the code it still has that error. This only happened since I've updated the Lua SDK.

 

Please help.

 

Thanks.

 

With Code:

 

 

function bodyguardScript.unload()  for k, guard in pairs(guards) do    if (guard ~= nil) then      PED.DELETE_PED(guard)      guards[k] = nil      bodyguardCount = 0    end  endend

 

 

 

Without code still causes that error:

 

 

function bodyguardScript.unload()end

 

 

and you Sir just found a bug :) (no actually i forogt to update the main.lua in the zip sorry)

 

headscript does this work with the new ScripthookV?

yes apart from the bug mentioned above which i will fix instantly

 

-Fixed just redownload it -

 

 

 

i have nothing against help :) would be nice if you would make it readable

 

 

gui.lua main.lua for now

 

 

Link to comment
Share on other sites

Royalgamer06

I got an error at this line:

for mod in io.popen([[dir "scripts/libs/" /b ]]):lines() do

in main.lua

 

Do you know why?

Link to comment
Share on other sites

diamond-optic

anyone able to get STAT_GET_INT to work for getting player cash? Im able to set player cash with STAT_SET_INT, but cant get the current cash value...

 

quite likely Im doing this wrong, as its been quite a long time since I did anything like this and the last language I worked with heavily was pawn..

 

 

 

 

local character = 1
-- 0: michael
-- 1: franklin
-- 2: trevor

print("-----------------------")
print("char: ", character)

local hashname = string.format("SP%d_TOTAL_CASH", character)
print("name: ", hashname)

local hash = GAMEPLAY.GET_HASH_KEY(hashname)
print("hash: ", hash)

local oldcash = 0
STATS.STAT_GET_INT(hash, oldcash, -1)

local newcash = oldcash + 100
STATS.STAT_SET_INT(hash, newcash, true)

print("old: ", oldcash)
print("new: ", newcash)
print("-----------------------")

 

 

 

it always just sets the cash to the 100

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

mitterdoo

does anybody know why some lua functions aren't here?

for example getfenv or loadstring does not work.

need loadstring for a lua prompt so i can mess around and also possibly reload a script

 

edit: io.read freezes gta v sadly.. do you think that you could add something like that so it's easier to debug and whatnot?

Edited by mitterdoo
Link to comment
Share on other sites

local Table,Count = PED.GET_PED_NEARBY_PEDS(playerPed, 0, -1) for k,v in ipairs(Table) do    print("Give Weapon to "..v)    WEAPON.GIVE_DELAYED_WEAPON_TO_PED(v, GAMEPLAY.GET_HASH_KEY("WEAPON_RAILGUN"), 1000, false)end

Does this work for everybody?

Link to comment
Share on other sites

headscript

does anybody know why some lua functions aren't here?

for example getfenv or loadstring does not work.

need loadstring for a lua prompt so i can mess around and also possibly reload a script

 

edit: io.read freezes gta v sadly.. do you think that you could add something like that so it's easier to debug and whatnot?

edit: io.read freezes gta v sadly.. do you think that you could add something like that so it's easier to debug and whatnot?

 

it should not show me your code

 

for example getfenv or loadstring does not work.

which are both no Lua 5.2 functions?

quote from Wiki

Lua 5.2 deprecates loadstring in favor of the existing load function, which has been augmented to accept strings. In addition, it allows providing the function's environment directly, as environments are now upvalues.

print(load("print('Hello ' .. a)", "", "t", { a = "World!", print = print })())
Edited by headscript
Link to comment
Share on other sites

 

does anybody know why some lua functions aren't here?

for example getfenv or loadstring does not work.

need loadstring for a lua prompt so i can mess around and also possibly reload a script

 

edit: io.read freezes gta v sadly.. do you think that you could add something like that so it's easier to debug and whatnot?

edit: io.read freezes gta v sadly.. do you think that you could add something like that so it's easier to debug and whatnot?

 

it should not show me your code

 

for example getfenv or loadstring does not work.

which are both no Lua 5.2 functions?

quote from Wiki

Lua 5.2 deprecates loadstring in favor of the existing load function, which has been augmented to accept strings. In addition, it allows providing the function's environment directly, as environments are now upvalues.

print(load("print('Hello ' .. a)", "", "t", { a = "World!", print = print })())it cra

it crashes for me no matter what all i want to do was player._set_player_model

they are making it hard to do anything, in the console version you could change a meta file and get everyone the same model.....then you try the other way create ped...but when you point a weapon at the zombie model they run

Edited by xsploit
Link to comment
Share on other sites

headscript

 

 

does anybody know why some lua functions aren't here?

for example getfenv or loadstring does not work.

need loadstring for a lua prompt so i can mess around and also possibly reload a script

 

edit: io.read freezes gta v sadly.. do you think that you could add something like that so it's easier to debug and whatnot?

edit: io.read freezes gta v sadly.. do you think that you could add something like that so it's easier to debug and whatnot?

 

it should not show me your code

 

for example getfenv or loadstring does not work.

which are both no Lua 5.2 functions?

quote from Wiki

Lua 5.2 deprecates loadstring in favor of the existing load function, which has been augmented to accept strings. In addition, it allows providing the function's environment directly, as environments are now upvalues.

print(load("print('Hello ' .. a)", "", "t", { a = "World!", print = print })())it cra

it crashes for me no matter what all i want to do was player._set_player_model

they are making it hard to do anything, in the console version you could change a meta file and get everyone the same model.....then you try the other way create ped...but when you point a weapon at the zombie model they run

 

PLAYER.SET_PLAYER_MODEL(PLAYER.PLAYER_ID(),modelhash)

show me what u did if that doesnt work

Link to comment
Share on other sites

 

 

 

does anybody know why some lua functions aren't here?

for example getfenv or loadstring does not work.

need loadstring for a lua prompt so i can mess around and also possibly reload a script

 

edit: io.read freezes gta v sadly.. do you think that you could add something like that so it's easier to debug and whatnot?

edit: io.read freezes gta v sadly.. do you think that you could add something like that so it's easier to debug and whatnot?

 

it should not show me your code

 

for example getfenv or loadstring does not work.

which are both no Lua 5.2 functions?

quote from Wiki

Lua 5.2 deprecates loadstring in favor of the existing load function, which has been augmented to accept strings. In addition, it allows providing the function's environment directly, as environments are now upvalues.

print(load("print('Hello ' .. a)", "", "t", { a = "World!", print = print })())it cra

it crashes for me no matter what all i want to do was player._set_player_model

they are making it hard to do anything, in the console version you could change a meta file and get everyone the same model.....then you try the other way create ped...but when you point a weapon at the zombie model they run

 

PLAYER.SET_PLAYER_MODEL(PLAYER.PLAYER_ID(),modelhash)

show me what u did if that doesnt work

 

ilocal Table,Count = PED.GET_PED_NEARBY_PEDS(playerPed, 0, -1) for k,v in ipairs(Table) do    print("Give Weapon to "..v)    PLAYER.SET_PLAYER_MODELend

I guess player only refers to the local player

Edited by xsploit
Link to comment
Share on other sites

headscript

 

 

 

 

does anybody know why some lua functions aren't here?

for example getfenv or loadstring does not work.

need loadstring for a lua prompt so i can mess around and also possibly reload a script

 

edit: io.read freezes gta v sadly.. do you think that you could add something like that so it's easier to debug and whatnot?

edit: io.read freezes gta v sadly.. do you think that you could add something like that so it's easier to debug and whatnot?

 

it should not show me your code

 

for example getfenv or loadstring does not work.

which are both no Lua 5.2 functions?

quote from Wiki

Lua 5.2 deprecates loadstring in favor of the existing load function, which has been augmented to accept strings. In addition, it allows providing the function's environment directly, as environments are now upvalues.

print(load("print('Hello ' .. a)", "", "t", { a = "World!", print = print })())it cra

it crashes for me no matter what all i want to do was player._set_player_model

they are making it hard to do anything, in the console version you could change a meta file and get everyone the same model.....then you try the other way create ped...but when you point a weapon at the zombie model they run

 

PLAYER.SET_PLAYER_MODEL(PLAYER.PLAYER_ID(),modelhash)

show me what u did if that doesnt work

 

ilocal Table,Count = PED.GET_PED_NEARBY_PEDS(playerPed, 0, -1) for k,v in ipairs(Table) do    print("Give Weapon to "..v)    PLAYER.SET_PLAYER_MODELend

I guess player only refers to the local player

 

player refers to all players in the lobby

others are Ped's

Link to comment
Share on other sites

 

 

 

 

 

does anybody know why some lua functions aren't here?

for example getfenv or loadstring does not work.

need loadstring for a lua prompt so i can mess around and also possibly reload a script

 

edit: io.read freezes gta v sadly.. do you think that you could add something like that so it's easier to debug and whatnot?

edit: io.read freezes gta v sadly.. do you think that you could add something like that so it's easier to debug and whatnot?

 

it should not show me your code

 

for example getfenv or loadstring does not work.

which are both no Lua 5.2 functions?

quote from Wiki

Lua 5.2 deprecates loadstring in favor of the existing load function, which has been augmented to accept strings. In addition, it allows providing the function's environment directly, as environments are now upvalues.

print(load("print('Hello ' .. a)", "", "t", { a = "World!", print = print })())it cra

it crashes for me no matter what all i want to do was player._set_player_model

they are making it hard to do anything, in the console version you could change a meta file and get everyone the same model.....then you try the other way create ped...but when you point a weapon at the zombie model they run

 

PLAYER.SET_PLAYER_MODEL(PLAYER.PLAYER_ID(),modelhash)

show me what u did if that doesnt work

 

ilocal Table,Count = PED.GET_PED_NEARBY_PEDS(playerPed, 0, -1) for k,v in ipairs(Table) do    print("Give Weapon to "..v)    PLAYER.SET_PLAYER_MODELend

I guess player only refers to the local player

 

player refers to all players in the lobby

others are Ped's

 

thanks maybe i'll try CHANGE_PLAYER_PED if i cant get the params right if not figure out how to get the zombie model to attack ppl with guns

Link to comment
Share on other sites

ILS_Supernova

Can someone help please, Ive installed everything in right place and all required items but get failed to load in asi.loader!

Link to comment
Share on other sites

There is vehicles spawn in old script. But now with the new one, I can't spawn it any more. I don't have any knowledge to using this.

Link to comment
Share on other sites

headscript

There is vehicles spawn in old script. But now with the new one, I can't spawn it any more. I don't have any knowledge to using this.

local playerPed = PLAYER.PLAYER_PED_ID()	local pedPosition = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0.0, 5.0, 0.0)	local hash = GAMEPLAY.GET_HASH_KEY(vehicle)	STREAMING.REQUEST_MODEL(hash)	local executionBreaker = 0	while( not STREAMING.HAS_MODEL_LOADED(hash) and executionBreaker< 50)do		wait(0)		executionBreaker= executionBreaker +1	end	local veh  = VEHICLE.CREATE_VEHICLE(hash, pedPosition.x,pedPosition.y,pedPosition.z, 0, false, false)	PED.SET_PED_INTO_VEHICLE(playerPed,veh,-1)
Link to comment
Share on other sites

Foul_Play

Mr HeadScript, I've done the main.lua file for you.

 

Also I've changed "addins" to addons and bug tested it.

The reason I've changed it because "addins" doesn't sound good.

To load custom scripts, they now go in the "addons" folder.

I've changed the prints to make it easier for you and other modders to read.

 

The function that prints in console "Loaded main.lua" needs a "\n" at the end so the console can make a new line.

 

Is there anyway to send you the file?

 

PS: I'm going to start working on gui.lua when I can.

 

 

 

XLtuuyh.png

 

Link to comment
Share on other sites

headscript

Mr HeadScript, I've done the main.lua file for you.

 

Also I've changed "addins" to addons and bug tested it.

The reason I've changed it because "addins" doesn't sound good.

To load custom scripts, they now go in the "addons" folder.

I've changed the prints to make it easier for you and other modders to read.

 

The function that prints in console "Loaded main.lua" needs a "\n" at the end so the console can make a new line.

 

Is there anyway to send you the file?

 

PS: I'm going to start working on gui.lua when I can.

 

 

 

XLtuuyh.png

 

stay with addins i have reserved addons for a different functionality already^^ and thank you very much

just add me on skype or something (fabs1996)

Edited by headscript
Link to comment
Share on other sites

Foul_Play

Okay, can you PM me where you're from because I found someone with that Skype name and isn't from Germany.

 

Also I'll change "addons" to "addins" now.

 

 

 

 

Mr HeadScript, I've done the main.lua file for you.

 

Also I've changed "addins" to addons and bug tested it.

The reason I've changed it because "addins" doesn't sound good.

To load custom scripts, they now go in the "addons" folder.

I've changed the prints to make it easier for you and other modders to read.

 

The function that prints in console "Loaded main.lua" needs a "\n" at the end so the console can make a new line.

 

Is there anyway to send you the file?

 

PS: I'm going to start working on gui.lua when I can.

 

 

 

XLtuuyh.png

 

stay with addins i have reserved addons for a different functionality already^^ and thank you very much

just add me on skype or something (fabs1966)

 

 

 

Link to comment
Share on other sites

headscript

The member Foul_Play can not use the messaging system

and my name is fabs1996 sorry

Link to comment
Share on other sites

ILS_Supernova

Can someone please try help me? Trying to install this as I wanna try some scripts out but the asi,loader says this,

 

ASI: Loading "C:\Program Files\Rockstar Games\Grand Theft Auto V\LUA.asi"
"LUA.asi" failed to load
Link to comment
Share on other sites

 

Thanks now i have to make a delete script

 

 

 

Have you made a working delete script? Using DELETE_OBJECT does not remove it straight away.

 

Also, it seems some of the objects only spawn when they are in the right area of the map. Have you seen something similar?

Link to comment
Share on other sites

Is it possible to check what weapon is the player currently holding and then lose ammo of that weapon by a key press?

I'm trying GET_CURRENT_PED_WEAPON but I'm getting a "nil" error.

Link to comment
Share on other sites

local Zombie = {}Zombie.peds = {}Zombie.howMany = 0function Zombie.unload()end function Zombie.tick()	if(get_key_pressed(117)) then	local playerPed = PLAYER.PLAYER_PED_ID()	local player = PLAYER.GET_PLAYER_PED(playerPed)	local playerExists = ENTITY.DOES_ENTITY_EXIST(playerPed)local Table,Count = PED.GET_PED_NEARBY_PEDS(PLAYER.PLAYER_PED_ID(), 55.0, 1) for k,v in ipairs(Table) do       PED.SET_PED_AS_ENEMY(v, true)	PED.SET_CAN_ATTACK_FRIENDLY(playerPed,true,true)	PED.SET_PED_COMBAT_ABILITY(v, 2)	PED.SET_PED_COMBAT_RANGE(v, 500)		end	end	 end return Zombie

 

tick: scripts/addins/riftmodule.lua:10: error in function 'GET_PED_NEARBY_PEDS'.

argument #1 is 'nil'; 'number' expected.

it either crashes or doesnt work

Link to comment
Share on other sites

 

There is vehicles spawn in old script. But now with the new one, I can't spawn it any more. I don't have any knowledge to using this.

local playerPed = PLAYER.PLAYER_PED_ID()	local pedPosition = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0.0, 5.0, 0.0)	local hash = GAMEPLAY.GET_HASH_KEY(vehicle)	STREAMING.REQUEST_MODEL(hash)	local executionBreaker = 0	while( not STREAMING.HAS_MODEL_LOADED(hash) and executionBreaker< 50)do		wait(0)		executionBreaker= executionBreaker +1	end	local veh  = VEHICLE.CREATE_VEHICLE(hash, pedPosition.x,pedPosition.y,pedPosition.z, 0, false, false)	PED.SET_PED_INTO_VEHICLE(playerPed,veh,-1)

Thanks, but where should I put it in? I create new file with name veh.lua, try add "function" and other thing, but don't know how to make it loads. it always said "a nil value". Sorry, I'm freaking noob

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
 Share

  • 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.