headscript Posted April 28, 2015 Author Share Posted April 28, 2015 i need help there is a menu on my upper left written a b c d how to remove this ? delete testgui.lua if you never intend to write GUI'S yourself hmm maybe i should release one version as SDK which has examples included and one for normal Users without them ? Link to comment Share on other sites More sharing options...
StephenSCO Posted April 28, 2015 Share Posted April 28, 2015 (edited) I had it basically something like this: 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) local getValue = VEHICLE.GET_VEHICLE_DIRT_LEVEL(1) local setValue = VEHICLE.SET_VEHICLE_DIRT_LEVEL(1,1) 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 setValue = getValue + 1 elseif(get_key_pressed(107)) then setValue = getValue - 1 end end endendreturn dirtyvehicle As i said i'm completely new to this and just had the thinking that i could use the GET_VEHICLE_DIRT_LEVEL value then add/subtract to it but how to code it properly is beyond me and thank you for your time. Edited April 28, 2015 by StephenSCO Link to comment Share on other sites More sharing options...
headscript Posted April 28, 2015 Author Share Posted April 28, 2015 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) local getValue = VEHICLE.GET_VEHICLE_DIRT_LEVEL(1) 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,getValue + 1) elseif(get_key_pressed(107)) then VEHICLE.SET_VEHICLE_DIRT_LEVEL(veh,getValue - 1) end end endendreturn dirtyvehicle try that but think about it you dont delay your input so when someone holds the key like second it changes from clean to very dirty really quickly also you should add limits StephenSCO 1 Link to comment Share on other sites More sharing options...
StephenSCO Posted April 28, 2015 Share Posted April 28, 2015 Thanks i'll give that a try. Link to comment Share on other sites More sharing options...
override367 Posted April 28, 2015 Share Posted April 28, 2015 (edited) Thanks for your help I got it working now, the problem was actually not loading in the additional models which is why nothing I did worked lol Now I just need to figure out how to delete the 3 peds every time this runs because their bodies don't go away/ if you spawn too many wonky sh*t happens with the AI Code below, it spawns Mike's family as bodyguards when pressing "/" local family = {}family.peds = {}family.howMany = 0function family.tick()if(get_key_pressed(111)) then local int positionoffset = 10local int modelselector = 1 local familySkinID = GAMEPLAY.GET_HASH_KEY("CS_JimmyDiSanto")local familySkinIDB = GAMEPLAY.GET_HASH_KEY("CS_AmandaTownley")local familySkinIDC = GAMEPLAY.GET_HASH_KEY("CS_TracyDiSanto")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, positionoffset, 25.0)local playerGroup = PED.GET_PED_GROUP_INDEX(playerPed) STREAMING.REQUEST_MODEL(familySkinID)while(not STREAMING.HAS_MODEL_LOADED(familySkinID)) dowait(50)end STREAMING.REQUEST_MODEL(familySkinIDB)while(not STREAMING.HAS_MODEL_LOADED(familySkinIDB)) dowait(50)end STREAMING.REQUEST_MODEL(familySkinIDC)while(not STREAMING.HAS_MODEL_LOADED(familySkinIDC)) dowait(50)end for i = 0 ,family.howMany,1 dowait(300)positionoffset = positionoffset + 3playerPosition = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0.0, positionoffset, 0.0) if(modelselector == 1) thenmodelselector = 2family.peds[i] = PED.CREATE_PED( 1,familySkinID,playerPosition.x, playerPosition.y, playerPosition.z,1,false,true)PED.SET_PED_CAN_SWITCH_WEAPON(family.peds[i],true)WEAPON.GIVE_DELAYED_WEAPON_TO_PED(family.peds[i], GAMEPLAY.GET_HASH_KEY("WEAPON_PISTOL50"), 1000, false)PED.SET_PED_AS_GROUP_MEMBER(family.peds[i], playerGroup)PED.SET_PED_MAX_HEALTH(family.peds[i], 10000) endif (modelselector == 2) thenmodelselector = 3family.peds[i] = PED.CREATE_PED( 1,familySkinIDB,playerPosition.x, playerPosition.y, playerPosition.z,1,false,true)PED.SET_PED_CAN_SWITCH_WEAPON(family.peds[i],true)WEAPON.GIVE_DELAYED_WEAPON_TO_PED(family.peds[i], GAMEPLAY.GET_HASH_KEY("WEAPON_SNIPERRIFLE"), 1000, false)PED.SET_PED_AS_GROUP_MEMBER(family.peds[i], playerGroup)PED.SET_PED_MAX_HEALTH(family.peds[i], 10000)end if (modelselector == 3) thenmodelselector = 1 endfamily.peds[i] = PED.CREATE_PED( 1,familySkinIDC,playerPosition.x, playerPosition.y, playerPosition.z,1,false,true)PED.SET_PED_CAN_SWITCH_WEAPON(family.peds[i],true)WEAPON.GIVE_DELAYED_WEAPON_TO_PED(family.peds[i], GAMEPLAY.GET_HASH_KEY("WEAPON_ASSAULTSHOTGUN"), 1000, false)PED.SET_PED_AS_GROUP_MEMBER(family.peds[i], playerGroup)PED.SET_PED_MAX_HEALTH(family.peds[i], 10000) endSTREAMING.SET_MODEL_AS_NO_LONGER_NEEDED(familySkinID)STREAMING.SET_MODEL_AS_NO_LONGER_NEEDED(familySkinIDB)STREAMING.SET_MODEL_AS_NO_LONGER_NEEDED(familySkinIDC)endend return family Edited April 28, 2015 by override367 Link to comment Share on other sites More sharing options...
headscript Posted April 28, 2015 Author Share Posted April 28, 2015 Thanks for your help I got it working now, the problem was actually not loading in the additional models which is why nothing I did worked lol Now I just need to figure out how to delete the 3 peds every time this runs because their bodies don't go away/ if you spawn too many wonky sh*t happens with the AI check my bodyguard.lua the unload function Link to comment Share on other sites More sharing options...
xsploit Posted April 28, 2015 Share Posted April 28, 2015 i can't get this to work CLEAR_AREA_OF_PEDS(coords.x, coords.y, coords.z,3000,0000) is there a way to set all the peds to zombieskin? Link to comment Share on other sites More sharing options...
Swarm96 Posted April 28, 2015 Share Posted April 28, 2015 Has anyone been able to get the current player model used? Not sure if there is a native for that. Link to comment Share on other sites More sharing options...
Szabo Posted April 28, 2015 Share Posted April 28, 2015 (edited) i need help there is a menu on my upper left written a b c d how to remove this ? delete testgui.lua if you never intend to write GUI'S yourself hmm maybe i should release one version as SDK which has examples included and one for normal Users without them ? Please do that! And also add a "README" instructing the user to simply save their scripts to the 'addins' folder. Imo though, the 'main' could be internal (in the dll) and there could be only a single 'lua_scripts' folder so libs could be named like "lib_xxxx.lua" or "xxxx_lib.lua" so the user doesn't have to care in which folder he is going to place libs and scripts, and of course you could instruct users to always keep the latest libs when it's asked (because windows explorer ask if you want to replace files and it shows which is newer), so when libs are 'shared' this should avoid some headaches. That's just my opinion though. Also, is there a way to 'control' the ticking time of my specific mod? Should I just use an integer for that? Will the single 'tick' interval always be the same? I mean, it seems the mods are ticked every 20ms atm, do you plan to change that in the future? EDIT: Oh, and another thing: Imho, that statement in line 278 (main.lua) should be removed... perhaps it shouldn't load the mods automatically at startup so the main script only has a key to 'load all mods', but that's all, or not even that. The other stuff should be on the mod's side imo. Edited April 28, 2015 by Szabo Link to comment Share on other sites More sharing options...
StephenSCO Posted April 28, 2015 Share Posted April 28, 2015 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) local getValue = VEHICLE.GET_VEHICLE_DIRT_LEVEL(1) 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,getValue + 1) elseif(get_key_pressed(107)) then VEHICLE.SET_VEHICLE_DIRT_LEVEL(veh,getValue - 1) end end endendreturn dirtyvehicle try that but think about it you dont delay your input so when someone holds the key like second it changes from clean to very dirty really quickly also you should add limits I tried it out and it semi works that it will clean the car but not add more dirt. I think is down to the "local getValue = VEHICLE.GET_VEHICLE_DIRT_LEVEL(1) " not actually returning a value to use and just using the (1) then adding/subtracting from that when i press a hotkey ,i have no idea how to solve it yet much more learning to do . Link to comment Share on other sites More sharing options...
headscript Posted April 28, 2015 Author Share Posted April 28, 2015 (edited) i need help there is a menu on my upper left written a b c d how to remove this ? delete testgui.lua if you never intend to write GUI'S yourself hmm maybe i should release one version as SDK which has examples included and one for normal Users without them ? Please do that! And also add a "README" instructing the user to simply save their scripts to the 'addins' folder. Imo though, the 'main' could be internal (in the dll) and there could be only a single 'lua_scripts' folder so libs could be named like "lib_xxxx.lua" or "xxxx_lib.lua" so the user doesn't have to care in which folder he is going to place libs and scripts, and of course you could instruct users to always keep the latest libs when it's asked (because windows explorer ask if you want to replace files and it shows which is newer), so when libs are 'shared' this should avoid some headaches. That's just my opinion though. Also, is there a way to 'control' the ticking time of my specific mod? Should I just use an integer for that? Will the single 'tick' interval always be the same? I mean, it seems the mods are ticked every 20ms atm, do you plan to change that in the future? EDIT: Oh, and another thing: Imho, that statement in line 278 (main.lua) should be removed... perhaps it shouldn't load the mods automatically at startup so the main script only has a key to 'load all mods', but that's all, or not even that. The other stuff should be on the mod's side imo. Also, is there a way to 'control' the ticking time of my specific mod? ofc just run everything inside your tick function every n ms see GAMEPLAY.GET_GAME_TIMER() // Edited April 28, 2015 by headscript Chumillas 1 Link to comment Share on other sites More sharing options...
Camo69 Posted April 28, 2015 Share Posted April 28, 2015 Can you stop the console alt tabbing the game and/or making it windowed mode? Link to comment Share on other sites More sharing options...
headscript Posted April 28, 2015 Author Share Posted April 28, 2015 Can you stop the console alt tabbing the game and/or making it windowed mode? ? Link to comment Share on other sites More sharing options...
Camo69 Posted April 28, 2015 Share Posted April 28, 2015 Can you stop the console alt tabbing the game and/or making it windowed mode? ? When I start the game. The game goes in windowed mode when the LUA console pops up. Anyway to stop that happening? Link to comment Share on other sites More sharing options...
headscript Posted April 28, 2015 Author Share Posted April 28, 2015 Can you stop the console alt tabbing the game and/or making it windowed mode? ? When I start the game. The game goes in windowed mode when the LUA console pops up. Anyway to stop that happening? sure i will make a sdk version and a user version sdk version got a console attached user version doesnt Link to comment Share on other sites More sharing options...
Pico Posted April 28, 2015 Share Posted April 28, 2015 (edited) Dude, what's up with the download for "GTA Online and SP Trainer Download" on your website? That's super shady. Edited April 28, 2015 by Pico Link to comment Share on other sites More sharing options...
headscript Posted April 28, 2015 Author Share Posted April 28, 2015 Dude, what's up with the download for "GTA Online and SP Trainer Download" on your website? That's super shady. its not my website its from a british youtuber gonna talk with him about putting mine in a subcategory sorry Link to comment Share on other sites More sharing options...
Szabo Posted April 28, 2015 Share Posted April 28, 2015 Can you stop the console alt tabbing the game and/or making it windowed mode? ? When I start the game. The game goes in windowed mode when the LUA console pops up. Anyway to stop that happening? sure i will make a sdk version and a user version sdk version got a console attached user version doesnt That would be awesome! Any thoughts on the single folder and internal 'main.lua'? That would make installing lua mods more user-friendly imho, and would avoid other mods from messing with main.lua. Link to comment Share on other sites More sharing options...
ffzero58 Posted April 28, 2015 Share Posted April 28, 2015 Trying to get VEHICLE.SET_VEHICLE_NUMBER_PLATE_TEXT to work however it seems the argument that accepts the string actually accepts a number. In C++, I can use a string no worries. test.lua: local licPlate = {} function licPlate.tick() local playerPed = PLAYER.PLAYER_PED_ID(); local veh = PED.GET_VEHICLE_PED_IS_USING(playerPed); if(PED.IS_PED_IN_ANY_VEHICLE(playerPed, false)) then VEHICLE.SET_VEHICLE_NUMBER_PLATE_TEXT(veh, "BANG"); end endreturn licPlate On the console, it says: tick: scripts/addins/test.lua:8: error in function 'SET_VEHICLE_NUMBER_PLATE_TEXT'. argument #2 is 'string'; 'number' expected. If I change that line to VEHICLE.SET_VEHICLE_NUMBER_PLATE_TEXT(veh, 65); It will change the plate to 'A' when I enter any car. Is there a function in LUA to change the string to its numerical representation? It seems to accept ASCII but not sure how to format this in. My questions is why is this different in LUA vs C++? I'd rather much use LUA to test scripting than compiling every time I make modifications. Link to comment Share on other sites More sharing options...
headscript Posted April 28, 2015 Author Share Posted April 28, 2015 because in the natives.h from Alexander Blade which is outdated it is defined as DWORD(number) sorry for that but when alexander blade has updated nativesdb to support PC gta5 i will update all natives instantly in that mean time im gonna push regularly updates with a custom natives.h Link to comment Share on other sites More sharing options...
Drkz Posted April 28, 2015 Share Posted April 28, 2015 If someone can get a script working where if you aim you weapon at a ped and press a key, the ped puts is hands up and follow the player it would be amazing. I failed so far. Link to comment Share on other sites More sharing options...
ffzero58 Posted April 28, 2015 Share Posted April 28, 2015 Ok, thanks for the heads up headscript (no pun intended). Please, don't be sorry - this is still an awesome utility. I'm learning LUA as I go. So this particular native will be broken until a new LUA asi can be built around the latest native db changes? Link to comment Share on other sites More sharing options...
headscript Posted April 28, 2015 Author Share Posted April 28, 2015 Ok, thanks for the heads up headscript (no pun intended). Please, don't be sorry - this is still an awesome utility. I'm learning LUA as I go. So this particular native will be broken until a new LUA asi can be built around the latest native db changes? i can change this particular native myself for now will be in the next version but i cant change every natives alone (more then 2000) Link to comment Share on other sites More sharing options...
Foul_Play Posted April 28, 2015 Share Posted April 28, 2015 (edited) Here's a Bodyguard script by me. Feel free to copy, use and modify this. Licence: MIT New version: https://github.com/FoulPlay/GTAVLUA/tree/master/bodyguardscript/bodyguardscript_v2_2 Changelog: 2.0 [29/04/15] *New test version with old content from Version: 1.5. +Added a new table for melee weapons +Renamed "mainWeapons" to "primaryWeapons" +Added "WEAPON_NIGHTSTICK", "WEAPON_CROWBAR" and "WEAPON_BAT" to meleeWeapons table. +Created 3 new functions: "bodyguardScript.loadPedModels", "bodyguardScript.applyNativesToBodyguards" and "bodyguardScript.applyWeaponsToBodyguards". -Removed "PED.IS_PED_FATALLY_INJURED(guard)" +Replaced "PED.IS_PED_FATALLY_INJURED(guard)" with "ENTITY.GET_ENTITY_HEALTH(guard) <= 0" to fix a bug with Guards getting removed when they shouldn't do. (It is mine fault because I didn't know about the Native "ENTITY.GET_ENTITY_HEALTH".) +Added "WEAPON_PISTOL", "WEAPON_APPISTOL", "WEAPON_PUMPSHOTGUN", "WEAPON_ASSAULTSHOTGUN" and "WEAPON_SMG" to the "secondaryWeapons" table. +Added "WEAPON_CARBINERIFLE", "WEAPON_HEAVYSNIPER", "WEAPON_ADVANCEDRIFLE", "WEAPON_SPECIALCARBINE", "WEAPON_COMBATMG" to the "primaryWeapons" table. -Removed "ENTITY.GET_ENTITY_HEALTH(guard) <= 0" +Replaced "ENTITY.GET_ENTITY_HEALTH(guard) <= 0" with "ENTITY.IS_ENTITY_DEAD(guard)" +Fixed a bug where they get deleted when not fully dead. +Added "PED.SET_PED_ARMOUR(guards, 200)", "WEAPON.SET_PED_DROPS_WEAPONS_WHEN_DEAD(guards, false)", "AI.SET_PED_PATH_CAN_USE_CLIMBOVERS(guards, true)", "AI.SET_PED_PATH_CAN_USE_LADDERS(guards, true)" and "AI.SET_PED_PATH_CAN_DROP_FROM_HEIGHT(guards, true)" to the "bodyguardScript.applyNativesToBodyguards" function. +More changes that are undocumented. 2.1 [02/05/15] +Fixed a bug where models do not load and causing the bodyguards not to spawn. *Rewritten the "bodyguardScript.loadPedModels" function. 2.2 [09/05/15] *Rewritten the "bodyguardScript.loadPedModels" function again. +Added "bodyguardScript.unloadPedModels" function. +Renamed "Models_Loaded" to "int_Models_Loaded". +Renamed "Has_Models_loaded" to "bool_Models_Loaded". +Renamed "Skins" to "Models". +More undocumented changes. Picture: Edit: The old version's here: https://github.com/FoulPlay/GTAVLUA/releases Edited May 9, 2015 by Foul_Play Link to comment Share on other sites More sharing options...
headscript Posted April 28, 2015 Author Share Posted April 28, 2015 Ok, thanks for the heads up headscript (no pun intended). Please, don't be sorry - this is still an awesome utility. I'm learning LUA as I go. So this particular native will be broken until a new LUA asi can be built around the latest native db changes? done update it and try again and report if it worked couldnt test it yet Link to comment Share on other sites More sharing options...
ffzero58 Posted April 28, 2015 Share Posted April 28, 2015 Ok, thanks for the heads up headscript (no pun intended). Please, don't be sorry - this is still an awesome utility. I'm learning LUA as I go. So this particular native will be broken until a new LUA asi can be built around the latest native db changes? done update it and try again and report if it worked couldnt test it yet Yup, worked like a charm. Thanks! headscript 1 Link to comment Share on other sites More sharing options...
Fireboyd78 Posted April 28, 2015 Share Posted April 28, 2015 (edited) Good work! One thing I want to suggest though is making syntax like this: GetPlayerName Entity.DoesEntityExist I never liked how the natives were in all capitals...and it doesn't fit Lua at all. By the way, the authors of Lua would have a fit if they saw the thread title! It's "Lua", not "LUA". Edited April 28, 2015 by CarLuver69 Link to comment Share on other sites More sharing options...
Freakyy Posted April 28, 2015 Share Posted April 28, 2015 By the way, the authors of Lua would have a fit if they saw the thread title! It's "Lua", not "LUA". Actually, they would have said "all lowercase": lua. I'm also using it wrong in my project, because it simply looks better Link to comment Share on other sites More sharing options...
Ynd21 Posted April 28, 2015 Share Posted April 28, 2015 (edited) Hello, made an account to share my bit of code, adds feature that if you hit a car, pedestrian, or drive in the oncoming lane you'll get a wanted star. Honk your horn to remove the wanted level. It's very simplistic, feel free to use it as you want, it was my first attempt at making something for myself. local testmodule = {}function testmodule.tick() -- variables local playerPed = PLAYER.PLAYER_PED_ID() local player = PLAYER.GET_PLAYER_PED(playerPed) local playerExists = ENTITY.DOES_ENTITY_EXIST(playerPed) local onVehHit = PLAYER.GET_TIME_SINCE_PLAYER_HIT_VEHICLE(player) local onHitPed = PLAYER.GET_TIME_SINCE_PLAYER_HIT_PED(player) local onPavement = PLAYER.GET_TIME_SINCE_PLAYER_DROVE_ON_PAVEMENT(player) local againstTraffic = PLAYER.GET_TIME_SINCE_PLAYER_DROVE_AGAINST_TRAFFIC(player) -- variables end if(playerExists) then if(PED.IS_PED_IN_ANY_VEHICLE(playerPed, true)) then print("---") print(onHitPed/1000, "Human Hit") print(onVehHit/1000, "Car Tapped") print(againstTraffic/1000, "On-Coming Traffic") print("---") if (onHitPed < 1000) or (onVehHit < 1000) or (againstTraffic < 1000) then PLAYER.SET_PLAYER_WANTED_LEVEL(player, 1, true) PLAYER.SET_PLAYER_WANTED_LEVEL_NOW(player, true)end if(PLAYER.IS_PLAYER_PRESSING_HORN(player)) then print("beep") PLAYER.SET_PLAYER_WANTED_LEVEL(player, 0, true) PLAYER.SET_PLAYER_WANTED_LEVEL_NOW(player, true) print("second beep") end end endendreturn testmodule Also, editing the testmodule script automatically reloads it ingame, pretty handy, really love this I wanted to make use of "or" to make that neater, but i couldn't figure it out, so several "if"s it is edit: Here is my full testmodule with only this script, uses default main.lua Hey man thanks for that code, using it and loving it. Any chance you know how to display the info (since last x) above the minimap? I found this code in the thread by Alexander void NotifyAboveMap(char* Message){ _0x202709F4C58A0424("STRING"); ADD_TEXT_COMPONENT_STRING(Message); _0x2ED7843F8F801023(0, 1);} but I have no idea how to actually use that in lua lol. If anyone could help or teach me, sh*t would be awesome. Thanks for making this possible headscript Edited April 28, 2015 by Ynd21 Link to comment Share on other sites More sharing options...
Fireboyd78 Posted April 28, 2015 Share Posted April 28, 2015 (edited) I found this code in the thread by Alexander void NotifyAboveMap(char* Message){ _0x202709F4C58A0424("STRING"); ADD_TEXT_COMPONENT_STRING(Message); _0x2ED7843F8F801023(0, 1);}but I have no idea how to actually use that in lua lol. If anyone could help or teach me, sh*t would be awesome. Thanks for making this possible headscript function NotifyAboveMap(message) _0x202709F4C58A0424("STRING") ADD_TEXT_COMPONENT_STRING(message) _0x2ED7843F8F801023(0, 1)endTry something like that, maybe? I'd test it but I'm without a computer for now... Edited April 28, 2015 by CarLuver69 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now