Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. Gameplay
      2. Missions
      3. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Arena War
      2. After Hours
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA Next

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

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

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

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

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

    2. Forum Support

    3. Site Suggestions

headscript

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

Recommended Posts

Echelonc

What is a good program to use for writing lua scripts? :)

Nvm guess any text editor will do

Edited by Echelonc

Share this post


Link to post
Share on other sites
Chumillas

What is a good program to use for writing lua scripts? :)

Nvm guess any text editor will do

 

Notepad++ and SublimeText are very good ones, you don't need more. Both support plugins and autocompletion.

 

The script doesn't work for me for some reason, it says that it failed to run in the log. I had the same issue with the vehicle controller script but that was solved somehow.

 

You need https://www.microsoft.com/en-us/download/details.aspx?id=40784

Share this post


Link to post
Share on other sites
noahvt

Any way to have autocompletion in something like notepad++? I don't really know any of the variables like GET_WANTED_LEVEL_RADIUS

Share this post


Link to post
Share on other sites
KingDong

Any way to have autocompletion in something like notepad++? I don't really know any of the variables like GET_WANTED_LEVEL_RADIUS

Once you already have something typed notepad++ will show an auto completion thing when you start typing something simliar to it go through it with the arrow keys and press enter or use your mouse to select it

Share this post


Link to post
Share on other sites
KingDong

Im trying to make a prop spawning script but console keeps saying

tick: scripts/addins.propspawner.lua:16: attempt to call global 'CREATE_OBJECT' (a nil value)

heres my code

local propspawn ={}function propspawn.tick()local propID = GAMEPLAY.GET_HASH_KEY("petrol_pump")		local playerPed = PLAYER.PLAYER_PED_ID()		local player = PLAYER.GET_PLAYER_PED(playerPed)		local playerID = PLAYER.PLAYER_ID()		local playerExists = ENTITY.DOES_ENTITY_EXIST(playerPed)		local playerPosition = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0.0, 5.0, 0.0)		local playerGroup = PED.GET_PED_GROUP_INDEX(playerPed)	local player = PLAYER.GET_PLAYER_PED(playerPed)	local playerExists = ENTITY.DOES_ENTITY_EXIST(playerPed)	if(playerExists) then	if(get_key_pressed(40)) then	CREATE_OBJECT(PETROL_PUMP)	propspawn.unload()		STREAMING.REQUEST_MODEL(propID)		while(not STREAMING.HAS_MODEL_LOADED(propID)) do				wait(50)		end			prop.object[i] = OBJECT.CREATE_OBJECT( 26,propID,playerPosition.x, playerPosition.y, playerPosition.z,1,false,true)			STREAMING.SET_MODEL_AS_NO_LONGER_NEEDED(propID)		end	end	end	return propspawn

Share this post


Link to post
Share on other sites
Personality

 

Im trying to make a prop spawning script but console keeps saying

tick: scripts/addins.propspawner.lua:16: attempt to call global 'CREATE_OBJECT' (a nil value)

heres my code

local propspawn ={}function propspawn.tick()local propID = GAMEPLAY.GET_HASH_KEY("petrol_pump")		local playerPed = PLAYER.PLAYER_PED_ID()		local player = PLAYER.GET_PLAYER_PED(playerPed)		local playerID = PLAYER.PLAYER_ID()		local playerExists = ENTITY.DOES_ENTITY_EXIST(playerPed)		local playerPosition = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0.0, 5.0, 0.0)		local playerGroup = PED.GET_PED_GROUP_INDEX(playerPed)	local player = PLAYER.GET_PLAYER_PED(playerPed)	local playerExists = ENTITY.DOES_ENTITY_EXIST(playerPed)	if(playerExists) then	if(get_key_pressed(40)) then	CREATE_OBJECT(PETROL_PUMP)	propspawn.unload()		STREAMING.REQUEST_MODEL(propID)		while(not STREAMING.HAS_MODEL_LOADED(propID)) do				wait(50)		end			prop.object[i] = OBJECT.CREATE_OBJECT( 26,propID,playerPosition.x, playerPosition.y, playerPosition.z,1,false,true)			STREAMING.SET_MODEL_AS_NO_LONGER_NEEDED(propID)		end	end	end	return propspawn

 

I made a example this should work

 

local basemodule = {} function basemodule.unload()endfunction basemodule.init() endfunction basemodule.tick()local player = PLAYER.PLAYER_ID()local playerPed = PLAYER.PLAYER_PED_ID()local coords = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0.0, 5.0, 0.0)if(get_key_pressed(114)) then OBJECT.CREATE_OBJECT(GAMEPLAY.GET_HASH_KEY("prop_windmill_01"), coords.x, coords.y, coords.z, true, false, true);end endreturn basemodule
Edited by Personality

Share this post


Link to post
Share on other sites
KingDong

 

 

Im trying to make a prop spawning script but console keeps saying

tick: scripts/addins.propspawner.lua:16: attempt to call global 'CREATE_OBJECT' (a nil value)

heres my code

local propspawn ={}function propspawn.tick()local propID = GAMEPLAY.GET_HASH_KEY("petrol_pump")		local playerPed = PLAYER.PLAYER_PED_ID()		local player = PLAYER.GET_PLAYER_PED(playerPed)		local playerID = PLAYER.PLAYER_ID()		local playerExists = ENTITY.DOES_ENTITY_EXIST(playerPed)		local playerPosition = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0.0, 5.0, 0.0)		local playerGroup = PED.GET_PED_GROUP_INDEX(playerPed)	local player = PLAYER.GET_PLAYER_PED(playerPed)	local playerExists = ENTITY.DOES_ENTITY_EXIST(playerPed)	if(playerExists) then	if(get_key_pressed(40)) then	CREATE_OBJECT(PETROL_PUMP)	propspawn.unload()		STREAMING.REQUEST_MODEL(propID)		while(not STREAMING.HAS_MODEL_LOADED(propID)) do				wait(50)		end			prop.object[i] = OBJECT.CREATE_OBJECT( 26,propID,playerPosition.x, playerPosition.y, playerPosition.z,1,false,true)			STREAMING.SET_MODEL_AS_NO_LONGER_NEEDED(propID)		end	end	end	return propspawn

 

I made a example this should work

local basemodule = {} function basemodule.unload()endfunction basemodule.init() endfunction basemodule.tick()local player = PLAYER.PLAYER_ID()local playerPed = PLAYER.PLAYER_PED_ID()local coords = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0.0, 5.0, 0.0)if(get_key_pressed(114)) then OBJECT.CREATE_OBJECT(GAMEPLAY.GET_HASH_KEY("prop_windmill_01"), coords.x, coords.y, coords.z, true, false, true);end endreturn basemodule

Still getting an error

Error in function 'CREATE_OBJECT'. Argument #5 is 'number'; 'boolean' expected.

Share this post


Link to post
Share on other sites
Personality

 

 

 

Im trying to make a prop spawning script but console keeps saying

tick: scripts/addins.propspawner.lua:16: attempt to call global 'CREATE_OBJECT' (a nil value)

heres my code

local propspawn ={}function propspawn.tick()local propID = GAMEPLAY.GET_HASH_KEY("petrol_pump")		local playerPed = PLAYER.PLAYER_PED_ID()		local player = PLAYER.GET_PLAYER_PED(playerPed)		local playerID = PLAYER.PLAYER_ID()		local playerExists = ENTITY.DOES_ENTITY_EXIST(playerPed)		local playerPosition = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0.0, 5.0, 0.0)		local playerGroup = PED.GET_PED_GROUP_INDEX(playerPed)	local player = PLAYER.GET_PLAYER_PED(playerPed)	local playerExists = ENTITY.DOES_ENTITY_EXIST(playerPed)	if(playerExists) then	if(get_key_pressed(40)) then	CREATE_OBJECT(PETROL_PUMP)	propspawn.unload()		STREAMING.REQUEST_MODEL(propID)		while(not STREAMING.HAS_MODEL_LOADED(propID)) do				wait(50)		end			prop.object[i] = OBJECT.CREATE_OBJECT( 26,propID,playerPosition.x, playerPosition.y, playerPosition.z,1,false,true)			STREAMING.SET_MODEL_AS_NO_LONGER_NEEDED(propID)		end	end	end	return propspawn

 

I made a example this should work

local basemodule = {} function basemodule.unload()endfunction basemodule.init() endfunction basemodule.tick()local player = PLAYER.PLAYER_ID()local playerPed = PLAYER.PLAYER_PED_ID()local coords = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0.0, 5.0, 0.0)if(get_key_pressed(114)) then OBJECT.CREATE_OBJECT(GAMEPLAY.GET_HASH_KEY("prop_windmill_01"), coords.x, coords.y, coords.z, true, false, true);end endreturn basemodule

Still getting an error

Error in function 'CREATE_OBJECT'. Argument #5 is 'number'; 'boolean' expected.

 

 

Yeah i edited my post and fixed that straight after :lol:

Share this post


Link to post
Share on other sites
KingDong

 

 

 

 

Im trying to make a prop spawning script but console keeps saying

tick: scripts/addins.propspawner.lua:16: attempt to call global 'CREATE_OBJECT' (a nil value)

heres my code

local propspawn ={}function propspawn.tick()local propID = GAMEPLAY.GET_HASH_KEY("petrol_pump")		local playerPed = PLAYER.PLAYER_PED_ID()		local player = PLAYER.GET_PLAYER_PED(playerPed)		local playerID = PLAYER.PLAYER_ID()		local playerExists = ENTITY.DOES_ENTITY_EXIST(playerPed)		local playerPosition = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0.0, 5.0, 0.0)		local playerGroup = PED.GET_PED_GROUP_INDEX(playerPed)	local player = PLAYER.GET_PLAYER_PED(playerPed)	local playerExists = ENTITY.DOES_ENTITY_EXIST(playerPed)	if(playerExists) then	if(get_key_pressed(40)) then	CREATE_OBJECT(PETROL_PUMP)	propspawn.unload()		STREAMING.REQUEST_MODEL(propID)		while(not STREAMING.HAS_MODEL_LOADED(propID)) do				wait(50)		end			prop.object[i] = OBJECT.CREATE_OBJECT( 26,propID,playerPosition.x, playerPosition.y, playerPosition.z,1,false,true)			STREAMING.SET_MODEL_AS_NO_LONGER_NEEDED(propID)		end	end	end	return propspawn

 

I made a example this should work

local basemodule = {} function basemodule.unload()endfunction basemodule.init() endfunction basemodule.tick()local player = PLAYER.PLAYER_ID()local playerPed = PLAYER.PLAYER_PED_ID()local coords = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0.0, 5.0, 0.0)if(get_key_pressed(114)) then OBJECT.CREATE_OBJECT(GAMEPLAY.GET_HASH_KEY("prop_windmill_01"), coords.x, coords.y, coords.z, true, false, true);end endreturn basemodule

Still getting an error

Error in function 'CREATE_OBJECT'. Argument #5 is 'number'; 'boolean' expected.

 

 

Yeah i edited my post and fixed that straight after :lol:

 

Thanks now i have to make a delete script

Share this post


Link to post
Share on other sites
marcinn

Hey,

 

Why are there 'a' 'b' 'c' 'd' on the left hand corner of the game? Is there a way to remove it? It really goes in the way of the Native Trainer.

Share this post


Link to post
Share on other sites
headscript

Hey,

 

Why are there 'a' 'b' 'c' 'd' on the left hand corner of the game? Is there a way to remove it? It really goes in the way of the Native Trainer.

because of the testgui which is a example how to write guis just delete it if you dont need it

Share this post


Link to post
Share on other sites
marcinn

Thanks a lot.

Share this post


Link to post
Share on other sites
StephenSCO

Is at possible at the moment to create a AI driver with the functions currently available?

Share this post


Link to post
Share on other sites
Szabo

Hey guys, this project is progressing really fast... Is there a way to 'reload' a lua script on-the-fly? Even if it had some kind of error? (so you fix the error and re-run the script?)

Share this post


Link to post
Share on other sites
Snuki

Hey guys, this project is progressing really fast... Is there a way to 'reload' a lua script on-the-fly? Even if it had some kind of error? (so you fix the error and re-run the script?)

Make a change, save the lua script. Press F4 ingame.

Share this post


Link to post
Share on other sites
Szabo

 

Hey guys, this project is progressing really fast... Is there a way to 'reload' a lua script on-the-fly? Even if it had some kind of error? (so you fix the error and re-run the script?)

Make a change, save the lua script. Press F4 ingame.

 

Thanks, yeah, i see that in main.lua there's:

	if(get_key_pressed(115)) then		loadLibs()		loadAddIns()	end

where 115 happens to be f4 of course, but I couldn't find the code to 'unload' the stuff. Unless that's not needed.

Share this post


Link to post
Share on other sites
xsploit

Anyone

 

 

 

 

 

 

Im trying to make a prop spawning script but console keeps saying

tick: scripts/addins.propspawner.lua:16: attempt to call global 'CREATE_OBJECT' (a nil value)

heres my code

local propspawn ={}function propspawn.tick()local propID = GAMEPLAY.GET_HASH_KEY("petrol_pump")		local playerPed = PLAYER.PLAYER_PED_ID()		local player = PLAYER.GET_PLAYER_PED(playerPed)		local playerID = PLAYER.PLAYER_ID()		local playerExists = ENTITY.DOES_ENTITY_EXIST(playerPed)		local playerPosition = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0.0, 5.0, 0.0)		local playerGroup = PED.GET_PED_GROUP_INDEX(playerPed)	local player = PLAYER.GET_PLAYER_PED(playerPed)	local playerExists = ENTITY.DOES_ENTITY_EXIST(playerPed)	if(playerExists) then	if(get_key_pressed(40)) then	CREATE_OBJECT(PETROL_PUMP)	propspawn.unload()		STREAMING.REQUEST_MODEL(propID)		while(not STREAMING.HAS_MODEL_LOADED(propID)) do				wait(50)		end			prop.object[i] = OBJECT.CREATE_OBJECT( 26,propID,playerPosition.x, playerPosition.y, playerPosition.z,1,false,true)			STREAMING.SET_MODEL_AS_NO_LONGER_NEEDED(propID)		end	end	end	return propspawn

 

I made a example this should work

local basemodule = {} function basemodule.unload()endfunction basemodule.init() endfunction basemodule.tick()local player = PLAYER.PLAYER_ID()local playerPed = PLAYER.PLAYER_PED_ID()local coords = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0.0, 5.0, 0.0)if(get_key_pressed(114)) then OBJECT.CREATE_OBJECT(GAMEPLAY.GET_HASH_KEY("prop_windmill_01"), coords.x, coords.y, coords.z, true, false, true);end endreturn basemodule

Still getting an error

Error in function 'CREATE_OBJECT'. Argument #5 is 'number'; 'boolean' expected.

 

 

Yeah i edited my post and fixed that straight after :lol:

 

Thanks now i have to make a delete script

 

is there a bong or pipe entity lol, i want to be able to hit a bong or joint where ever i go

Share this post


Link to post
Share on other sites
Snuki

 

 

Hey guys, this project is progressing really fast... Is there a way to 'reload' a lua script on-the-fly? Even if it had some kind of error? (so you fix the error and re-run the script?)

Make a change, save the lua script. Press F4 ingame.

 

Thanks, yeah, i see that in main.lua there's:

	if(get_key_pressed(115)) then		loadLibs()		loadAddIns()	end

where 115 happens to be f4 of course, but I couldn't find the code to 'unload' the stuff. Unless that's not needed.

 

I'm pretty sure it does that for you.

Share this post


Link to post
Share on other sites
Szabo

 

 

 

Hey guys, this project is progressing really fast... Is there a way to 'reload' a lua script on-the-fly? Even if it had some kind of error? (so you fix the error and re-run the script?)

Make a change, save the lua script. Press F4 ingame.

 

Thanks, yeah, i see that in main.lua there's:

	if(get_key_pressed(115)) then		loadLibs()		loadAddIns()	end

where 115 happens to be f4 of course, but I couldn't find the code to 'unload' the stuff. Unless that's not needed.

 

I'm pretty sure it does that for you.

 

Yeah, thanks. I was stupid... the functions they check and unload the stuff when needed, sorry.

Edited by Szabo

Share this post


Link to post
Share on other sites
n00854180t

Hey guys, I'm looking into using GET_PED_NEARBY_PEDS, which takes the PED to search from, an array out and a radius I guess (-1 being no limit).

 

My only problem is that I don't know how to properly pass the output array that the function expects - I tried just passing a table and that didn't work.

 

Here's another thread where the usage is shown: http://gtaforums.com/topic/789788-function-args-to-pedget-ped-nearby-peds/

 

Any help is greatly appreciated!

Share this post


Link to post
Share on other sites
Swarm96

So I've been trying to get this to work!

if(get_key_pressed(114)) then		wait(100)		local playerPed = PLAYER.PLAYER_PED_ID()		local tester = PLAYER.PLAYER_ID()		local player = PLAYER.GET_PLAYER_PED(playerPed)		local playerExists = ENTITY.DOES_ENTITY_EXIST(playerPed)		local zombieskinID = GAMEPLAY.GET_HASH_KEY("s_m_y_swat_01")		STREAMING.REQUEST_MODEL(zombieskinID)		PLAYER.SET_PLAYER_MODEL(tester, zombieskinID)		PED.SET_PED_DEFAULT_COMPONENT_VARIATION(playerPed);		-print("Test!")end

The line PED.SET_PED_DEFAULT_COMPONENT_VARIATION(playerPed); seems to crash it but Im not 100% sure

Edited by Swarm96

Share this post


Link to post
Share on other sites
M60warrior

How can I go about making backspace close the gui menu?

Share this post


Link to post
Share on other sites
Szabo

Hello there, I just released my first script: http://gtaforums.com/topic/790030-vrelhookluaalpha-szabos-persistance-mod-scripthook-lua/

 

Now I need to know if it's possible to somehow serialize all data of a vehicle so I can store it (like, color, mods, etc) on a file in order to re-spawn it on the next launch. Any ideas?

 

Also, any ideas on how I can get the 'owner' of the vehicle? Or at least a way to know if the vehicle was bought by the player?

EDIT: I don't think it's possible.... i'm gonna use VEHICLE::IS_VEHICLE_STOLEN in the meantime... I don't know when a vehicle is considered 'stolen' by the engine though

 

Thanks in advance.

Edited by Szabo

Share this post


Link to post
Share on other sites
ikilluwitastick

First of all, this is amazing. Love it, love everything about it. Created an account just to post on here.

One thing I've noticed though: the bodyguards...don't make very good bodyguards. Hahaha if any of them accidentally shoots the other one, all hell breaks loose and they all start shooting each other AND me. Any ideas how to fix this? I tried adding a call to PED.SET_CAN_ATTACK_FRIENDLY, but I must have done something wrong or that must not be the right thing because it didn't make any difference.

Share this post


Link to post
Share on other sites
bugbutts

First of all, this is amazing. Love it, love everything about it. Created an account just to post on here.

One thing I've noticed though: the bodyguards...don't make very good bodyguards. Hahaha if any of them accidentally shoots the other one, all hell breaks loose and they all start shooting each other AND me. Any ideas how to fix this? I tried adding a call to PED.SET_CAN_ATTACK_FRIENDLY, but I must have done something wrong or that must not be the right thing because it didn't make any difference.

I don't know, but it's a heck of a lot of fun to watch 20-50 peds shoot it out in the street. :)

Share this post


Link to post
Share on other sites
StephenSCO

I'm looking for a little help on this.

What i'm trying to create is a script to increase/decrease the amount of dirt on a vehicle rather than what i have now where its either fully dirty or clean.

I tried using GET_VEHICLE_DIRT_LEVEL then adding/subtracting from that value but i dont think i did it correctly since it didn't work or show a error.

I have basically no knowledge of LUA so any help on this would be appreciated.

local dirtyvehicle = {}function dirtyvehicle.unload()endfunction dirtyvehicle.tick()    local playerPed = PLAYER.PLAYER_PED_ID()    local player = PLAYER.GET_PLAYER_PED(playerPed)    local playerExists = ENTITY.DOES_ENTITY_EXIST(playerPed)    if(playerExists) then        if(PED.IS_PED_IN_ANY_VEHICLE(playerPed, false)) then            local veh = PED.GET_VEHICLE_PED_IS_IN(playerPed,true)            if(get_key_pressed(109)) then            VEHICLE.SET_VEHICLE_DIRT_LEVEL(veh, 0.0) -- clean            elseif(get_key_pressed(107)) then            VEHICLE.SET_VEHICLE_DIRT_LEVEL(veh, 15) -- 15 = maximum dirt            end        end    endendreturn dirtyvehicle
Edited by StephenSCO

Share this post


Link to post
Share on other sites
override367

I've noticed npcs in the players group will only act like a group if there's 5 or less of them

 

anyway I'm having some trouble with a script to spawn 3 distinct NPCs

 

for some reason the second elseif statement never works, is it not possible to do 2 elseif statements? There's probably a better way to do this anyway

 

for i = 0 ,family.howMany,1 doif(modelselector == 1) thenfamily.peds[i] = PED.CREATE_PED( 1,familySkinID,playerPosition.x, playerPosition.y, playerPosition.z,1,false,true)modelselector = modelselector + 1elseif(modelselector == 2) thenfamily.peds[i] = PED.CREATE_PED( 1,familySkinID2,playerPosition.x, playerPosition.y, playerPosition.z,1,false,true)modelselector = modelselector + 1elseif (modelselector == 3) thenfamily.peds[i] = PED.CREATE_PED( 1,familySkinID3,playerPosition.x, playerPosition.y, playerPosition.z,1,false,true)modelselector = 1endPED.SET_PED_CAN_SWITCH_WEAPON(family.peds[i],true)WEAPON.GIVE_DELAYED_WEAPON_TO_PED(family.peds[i], GAMEPLAY.GET_HASH_KEY("WEAPON_SAWNOFFSHOTGUN"), 1000, false)PED.SET_PED_AS_GROUP_MEMBER(family.peds[i], playerGroup) end

 

Also does anyone know how to make NPCs a bit tought? The ones I spawn tend to get immediately gunned down, I've tried the following at the end of an otherwise working bodyguard creation script

 

I've tried things like

PED.SET_PED_MAX_HEALTH(family.peds, 10000)
to no avail
Edited by override367

Share this post


Link to post
Share on other sites
StephenSCO

Maybe try these?

PED.ADD_ARMOUR_TO_PED(Ped PedHandle, int Amount)
PED.SET_PED_ARMOUR(Any p0, Any p1)

PED.GET_PED_ARMOUR(Ped PedHandle)

Share this post


Link to post
Share on other sites
headscript

 

 

 

I've noticed npcs in the players group will only act like a group if there's 5 or less of them

 

anyway I'm having some trouble with a script to spawn 3 distinct NPCs

 

for some reason the second elseif statement never works, is it not possible to do 2 elseif statements? There's probably a better way to do this anyway

for i = 0 ,family.howMany,1 doif(modelselector == 1) thenfamily.peds[i] = PED.CREATE_PED( 1,familySkinID,playerPosition.x, playerPosition.y, playerPosition.z,1,false,true)modelselector = modelselector + 1elseif(modelselector == 2) thenfamily.peds[i] = PED.CREATE_PED( 1,familySkinID2,playerPosition.x, playerPosition.y, playerPosition.z,1,false,true)modelselector = modelselector + 1elseif (modelselector == 3) thenfamily.peds[i] = PED.CREATE_PED( 1,familySkinID3,playerPosition.x, playerPosition.y, playerPosition.z,1,false,true)modelselector = 1endPED.SET_PED_CAN_SWITCH_WEAPON(family.peds[i],true)WEAPON.GIVE_DELAYED_WEAPON_TO_PED(family.peds[i], GAMEPLAY.GET_HASH_KEY("WEAPON_SAWNOFFSHOTGUN"), 1000, false)PED.SET_PED_AS_GROUP_MEMBER(family.peds[i], playerGroup) end

Also does anyone know how to make NPCs a bit tought? The ones I spawn tend to get immediately gunned down, I've tried the following at the end of an otherwise working bodyguard creation script

 

I've tried things like

PED.SET_PED_MAX_HEALTH(family.peds, 10000)
to no avail

 

elseif is only getting called when the if before is not true

 

you got two options now

1. write it differently that you dont use if/elseif (like iterating through a table)

2. convert your elseif to if then end's

 

 

I'm looking for a little help on this.

What i'm trying to create is a script to increase/decrease the amount of dirt on a vehicle rather than what i have now where its either fully dirty or clean.

I tried using GET_VEHICLE_DIRT_LEVEL then adding/subtracting from that value but i dont think i did it correctly since it didn't work or show a error.

I have basically no knowledge of LUA so any help on this would be appreciated.

local dirtyvehicle = {}

function dirtyvehicle.unload()

end

 

function dirtyvehicle.tick()

local playerPed = PLAYER.PLAYER_PED_ID()

local player = PLAYER.GET_PLAYER_PED(playerPed)

local playerExists = ENTITY.DOES_ENTITY_EXIST(playerPed)

if(playerExists) then

if(PED.IS_PED_IN_ANY_VEHICLE(playerPed, false)) then

local veh = PED.GET_VEHICLE_PED_IS_IN(playerPed,true)

if(get_key_pressed(109)) then

VEHICLE.SET_VEHICLE_DIRT_LEVEL(veh, 0.0) -- clean

elseif(get_key_pressed(107)) then

VEHICLE.SET_VEHICLE_DIRT_LEVEL(veh, 15) -- 15 = maximum dirt

end

end

end

 

end

return dirtyvehicle

 

 

show me your add/subtract script and u probably have to add a delay between two userinputs else each set dirt level is getting 100 times called per second

Edited by headscript

Share this post


Link to post
Share on other sites
MR.GREY

i need help there is a menu on my upper left written a b c d how to remove this ?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • 2 Users Currently Viewing
    0 members, 0 Anonymous, 2 Guests

×
×
  • Create New...

Important Information

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