lua parameters

shanker

Well-known member
Joined
Sep 18, 2016
Messages
291
Reaction score
16
Location
Romania
shouldn't it to show me parameters of any command?

i installed moonloader, what else i have to do?

@springfield
@monday
 

Ezel

Active member
Joined
Dec 6, 2017
Messages
134
Reaction score
18
Location
Syria
officel IDE of moonloader is Atom.

Atom

how to install(copied from gtaforums.com)
[font=helvetica, arial, sans-serif]Extension for Atom includes Lua syntax highlighting, smart autocompletion, real-time error checking. There is also fuzzy search for functions and opcodes - activated with hotkey [/font][font=helvetica, arial, sans-serif]Ctrl+Alt+A[/font][font=helvetica, arial, sans-serif], to find function by opcode add prefix [/font][font=helvetica, arial, sans-serif]'@'[/font][font=helvetica, arial, sans-serif] before search query.[/font]
[font=helvetica, arial, sans-serif]Installation:[/font]
[font=helvetica, arial, sans-serif]Note: if you already have package 'language-lua' or 'linter-lua' installed in your Atom, disable or remove it to avoid conflicts.[/font]
[font=helvetica, arial, sans-serif]1. Install and run Atom[/font]
[font=helvetica, arial, sans-serif]2. Go to the settings window (menu [/font][font=helvetica, arial, sans-serif]File -> Settings[/font][font=helvetica, arial, sans-serif] or hotkey [/font][font=helvetica, arial, sans-serif]Ctr + ,[/font][font=helvetica, arial, sans-serif])[/font]
[font=helvetica, arial, sans-serif]3. Go to the "Install" tab[/font]
[font=helvetica, arial, sans-serif]4. Enter "moonloader" in the search box and install first module from the results list[/font]
[font=helvetica, arial, sans-serif]Note: if an error occurred during autoinstallation of "autocomplete-lua" just install it yourself by the same method.[/font]

[font=helvetica, arial, sans-serif]you can find more info here; click[/font]
 

shanker

Well-known member
Joined
Sep 18, 2016
Messages
291
Reaction score
16
Location
Romania
yea ty now it works fine ^^

im new on it, just 3 or 4 hours of work and already i learned a lot ^^

do you have any ideea why when i press the checkbox, dialog will dissapear?

[shcode=cpp]
if imgui.Checkbox('Infinite Run', player_menu_state) then
     local read = readMemory(0xB7CEE4, 4)
     if not read == 0 then writeMemory(0xB7CEE4, 1, 4)
     else writeMemory(0xB7CEE4, 0, 4)
     end
end
[/shcode]

infinite run works fine, but i dont want the dialog to just dissapear :-s

first time i did it with a callback func but i thought it's impossible

[shcode=cpp]
if imgui.Checkbox('Infinite Run', player_menu_state) then
     Infinite_Run()
end

function Infinite_Run()
if var_on == 1 then 
    writeMemory(0xB7CEE4, 1, 4)
    printStringNow('ON', 1000)
    var_on = 0
    --main_window_state.v = not main_window_state.v 
else
    writeMemory(0xB7CEE4, 0, 4)
    printStringNow('Off', 1000)
    var_on = 1
    --main_window_state.v = not main_window_state.v
end
end
[/shcode]


later ediiiiiiiiiiiiiit

i solved

[shcode=cpp]
player_menu_state.v = not player_menu_state.v
-- in call back func
[/shcode]
 

shanker

Well-known member
Joined
Sep 18, 2016
Messages
291
Reaction score
16
Location
Romania
how to read textdraw string?

[shcode=cpp]
for i = 0, 2400 do
   local textdraw = sampTextdrawIsExists(i)
   if textdraw == true then local text = sampTextdrawGetString(i)
   sampAddChatMessage("Textdraw with string %s", text, -1) end
end
[/shcode]

outputs null
 

_=Gigant=_

Well-known member
Joined
Mar 21, 2017
Messages
353
Reaction score
16
some of my random trash xD idk maybe you find something useful

Code:
local imgui = require 'imgui'
local key = require 'vkeys'

local main_window_state = imgui.ImBool(false)
function imgui.OnDrawFrame()
  if main_window_state.v then
    imgui.SetNextWindowSize(imgui.ImVec2(200, 200), imgui.Cond.FirstUseEver) 
    imgui.Begin('[Lua] s0beit', main_window_state)
	local btn_size = imgui.ImVec2(-0.1, 0)
    imgui.Text('')
    imgui.Button('Hacks', btn_size)
	if imgui.Button('God Mode', btn_size) then
	 printStringNow('Player is now in God Mode', 1000)
	end
	imgui.Button('Anti Fall',btn_size) 
	imgui.Button('God Mode Vehicle', btn_size) 
    imgui.Button('No Collision', btn_size)
	if imgui.Button('Invisible', btn_size) then
	 printStringNow('You are invisible!', 1000)
	end
    imgui.End()
  end
end

function main()
  while true do
    wait(0)
    if wasKeyPressed(key.VK_H) then
     main_window_state.v = not main_window_state.v 
    end
    imgui.Process = main_window_state.v 
  end
end
 

shanker

Well-known member
Joined
Sep 18, 2016
Messages
291
Reaction score
16
Location
Romania
_=Gigant=_ said:
some of my random trash xD idk maybe you find something useful

Code:
local imgui = require 'imgui'
local key = require 'vkeys'

local main_window_state = imgui.ImBool(false)
function imgui.OnDrawFrame()
  if main_window_state.v then
    imgui.SetNextWindowSize(imgui.ImVec2(200, 200), imgui.Cond.FirstUseEver) 
    imgui.Begin('[Lua] s0beit', main_window_state)
	local btn_size = imgui.ImVec2(-0.1, 0)
    imgui.Text('')
    imgui.Button('Hacks', btn_size)
	if imgui.Button('God Mode', btn_size) then
	 printStringNow('Player is now in God Mode', 1000)
	end
	imgui.Button('Anti Fall',btn_size) 
	imgui.Button('God Mode Vehicle', btn_size) 
    imgui.Button('No Collision', btn_size)
	if imgui.Button('Invisible', btn_size) then
	 printStringNow('You are invisible!', 1000)
	end
    imgui.End()
  end
end

function main()
  while true do
    wait(0)
    if wasKeyPressed(key.VK_H) then
     main_window_state.v = not main_window_state.v 
    end
    imgui.Process = main_window_state.v 
  end
end

3 hours ago were very useful .. were  :iknowwhatyoudidthere:

https://imgur.com/a/hG6oX

i still need help to the above problem
and some examples with sliders / get slider value etc if u have  :pPFFH:
 

_=Gigant=_

Well-known member
Joined
Mar 21, 2017
Messages
353
Reaction score
16
doroftel said:
and some examples with sliders / get slider value etc if u have  :pPFFH:

maybe this help you with slider 

Code:
local slider_float = imgui.ImFloat(0.0)
imgui.SliderFloat('lel', slider_float, 0.0, 1.0)


Code:
local imgui = require 'imgui'
local key = require 'vkeys'

local main_window_state = imgui.ImBool(false)
local slider_float = imgui.ImFloat(0.0)
function imgui.OnDrawFrame()
  if main_window_state.v then
    imgui.SetNextWindowSize(imgui.ImVec2(200, 100), imgui.Cond.FirstUseEver) 
    imgui.Begin('slider', main_window_state)
	local btn_size = imgui.ImVec2(-0.1, 0)
    imgui.Text('')
	imgui.SliderFloat('lel', slider_float, 0.0, 1.0)
	end
    imgui.End()
  end

function main()
  while true do
    wait(0)
    if wasKeyPressed(key.VK_H) then
     main_window_state.v = not main_window_state.v 
    end
    imgui.Process = main_window_state.v 
  end
end
 

shanker

Well-known member
Joined
Sep 18, 2016
Messages
291
Reaction score
16
Location
Romania
_=Gigant=_ said:
doroftel said:
and some examples with sliders / get slider value etc if u have  :pPFFH:

maybe this help you with slider 

Code:
local slider_float = imgui.ImFloat(0.0)
imgui.SliderFloat('lel', slider_float, 0.0, 1.0)


Code:
local imgui = require 'imgui'
local key = require 'vkeys'

local main_window_state = imgui.ImBool(false)
local slider_float = imgui.ImFloat(0.0)
function imgui.OnDrawFrame()
  if main_window_state.v then
    imgui.SetNextWindowSize(imgui.ImVec2(200, 100), imgui.Cond.FirstUseEver) 
    imgui.Begin('slider', main_window_state)
	local btn_size = imgui.ImVec2(-0.1, 0)
    imgui.Text('')
	imgui.SliderFloat('lel', slider_float, 0.0, 1.0)
	end
    imgui.End()
  end

function main()
  while true do
    wait(0)
    if wasKeyPressed(key.VK_H) then
     main_window_state.v = not main_window_state.v 
    end
    imgui.Process = main_window_state.v 
  end
end
 

how to get slider value?

[shcode=cpp]
local fast_rotation_slider = imgui.ImFloat(0.0)
imgui.SliderFloat('Default: 7.5~, Recomandat: 18.0', fast_rotation_slider, 7.5, 20.0)
sampAddChatMessage("%f", fast_rotation_slider, 0xffffff)
-- outputs 0.0
[/shcode]
 

shanker

Well-known member
Joined
Sep 18, 2016
Messages
291
Reaction score
16
Location
Romania
did someone tried to make a fast rotation in lua?

[shcode=cpp]
if fast_rotation_on == 1 then
local CPED = readMemory(0xB6F5F0, 4, virtualProtect)
CPED = CPED + 0x560
writeMemory(CPED, 4, 19.0, 0)
end
[/shcode]

it should work, same example in CLEO and its fking work

[shcode=cpp]
0A8D: 0@ = read_memory 0xB6F5F0 size 4 virtual_protect 0
0@ += 0x560
0A8C: write_memory 0@ size 4 value 20.0 virtual_protect 0
[/shcode]
 

veysileth

Active member
Joined
Mar 23, 2017
Messages
85
Reaction score
6
tested and working examples

Memory:
Code:
local memory = require "memory"

memory.read(0xB79494, 4, true)
memory.write(0xB79494, 1148829695 , 4, true)

Sliders
Code:
local slider_test = imgui.ImInt(25)

imgui.VSliderInt('##b', imgui.ImVec2( 30, 200), slider_test, 0, 120, 10.0, '%f')

calling value of slider slider_test.v
setCarCruiseSpeed(car, slider_test.v) or setCarCruiseSpeed(car, slider_test)but i think first one is good.


btw anyone knows why errorchecking is not working with moonloader on atom? ctrl alt a is working fine but some options are off.
 

shanker

Well-known member
Joined
Sep 18, 2016
Messages
291
Reaction score
16
Location
Romania
veysileth said:
tested and working examples

Memory:
Code:
local memory = require "memory"

memory.read(0xB79494, 4, true)
memory.write(0xB79494, 1148829695 , 4, true)

Sliders
Code:
local slider_test = imgui.ImInt(25)

imgui.VSliderInt('##b', imgui.ImVec2( 30, 200), slider_test, 0, 120, 10.0, '%f')

calling value of slider slider_test.v
setCarCruiseSpeed(car, slider_test.v) or setCarCruiseSpeed(car, slider_test)but i think first one is good.


btw anyone knows why errorchecking is not working with moonloader on atom? ctrl alt a is working fine but some options are off.

i l try it ty for your atention

if the first example is about fast rotation, i solved it, i was so tired before, may be cause of that i didn't realise i was writing something else

[shcode=cpp]
local CPED = readMemory(0xB6F5F0, 4, virtualProtect)
CPED = CPED + 0x560
writeMemory(CPED, 4, 0x41a00000, 0) 
[/shcode]
 

shanker

Well-known member
Joined
Sep 18, 2016
Messages
291
Reaction score
16
Location
Romania
@veysileth , name of that anime? u r photo

@springfield


----------------
for guys who had the same problem as i had above there is an example how to write memory in float
[shcode=cpp]
if fast_rotation_on == 1 then
   local CPED = readMemory(0xB6F5F0, 4, virtualProtect)
   CPED = CPED + 0x560
   local result = isCharDead(PLAYER_PED) if result == false then
      memory.setfloat(CPED, fast_rotation_slider.v, 0) else
         repeat
         wait(0)
         local health = getCharHealth(PLAYER_PED) until health > 50
      end 
    end
end
[/shcode]
----------------

[shcode=cpp]
if activate_rob_on == 1 then
   for id = 0, 2400 do
      local is_exist = sampTextdrawIsExists(id)
      if is_exist == true then local string = sampTextdrawGetString(id) sampSendChat(string.format("%s", string)) end
    end
end[/shcode]

outputs null value please i cant figure out what's the problem
 

veysileth

Active member
Joined
Mar 23, 2017
Messages
85
Reaction score
6
https://www.facebook.com/AoiOgataArtwork/

sampSendChat(string.format("%s", string))

You can just use sampSendChat(string).

Code:
 for id = 0, 2400 do
local is_exist = sampTextdrawIsExists(id)
 if is_exist then 
local string = sampTextdrawGetString(id) 
sampSendChat(string) 
end 
end

is working fine on testserver
 

shanker

Well-known member
Joined
Sep 18, 2016
Messages
291
Reaction score
16
Location
Romania
veysileth said:
https://www.facebook.com/AoiOgataArtwork/

sampSendChat(string.format("%s", string))

You can just use sampSendChat(string).

Code:
 for id = 0, 2400 do
local is_exist = sampTextdrawIsExists(id)
 if is_exist then 
local string = sampTextdrawGetString(id) 
sampSendChat(string) 
end 
end

is working fine on testserver

in script i didn't did as i told in the example from above, here i just write it by my self instead of copy paste cuz atom sucks and it puts many sprawling spaces wrong

sooo the funny thing, it is working uaah 

[shcode=cpp]if is_exist == true then local string = sampTextdrawGetString(id) sampSendChat(string.format("%s", string)) end[/shcode]

the problem is, you can't read a pointer this way, same thing happens in cleo (sry if im wrong but may be that's the problem when u cant just use both examples from below)

[shcode=cpp]
0@ = get player nickname(1@)
chatmsg 0@ -1 // crashes
chatmsg "%s" -1 0@ // working
[/shcode] 

thank you agaaaain :D
 
Top