Quantcast

Jump to content

» «
Photo

MoonLoader — Development

35 replies to this topic
BH Team
  • BH Team

    FYP

  • Members
  • Joined: 08 Aug 2011
  • Russia

#31

Posted 22 November 2017 - 09:32 PM

I have a question about this,

 

  • 'moonloader\resource' - for all the resources used by scripts (textures, models, etc)

 

So it's possible to load models from \resource right? If so,could you show me a quick example of that.I'm a bit lost on how to do it.

No, it's just a standard directory to put all the script's resources, currently MoonLoader doesn't have native functionality to load custom models.


Sanmodder
  • Sanmodder

    Fan script

  • Members
  • Joined: 11 Sep 2017
  • Poland

#32

Posted 04 December 2017 - 06:28 PM

I wanted to do my first lua script
trainer with 5 commands
but I do not want to act and where to look for opcodes
and how to make it come back fo label
and what are the keys
I once repaired such a trainer for gta 4
but it was
ready source
I know that I did a lot of things wrong
I'm still learning
but I know very well on cleo script
help me

script_name("first lua trainer")
script_authors("fan script")
script_version_number(1)
script_description("first lua")

--- Config
local bar_color = 0
local bar_pos = 84.0
local selected_items = 1

    setGxtEntry("key_1", 	"add text")			--> null
	setGxtEntry("key_2", 	"add text")			--> null
	setGxtEntry("key_3", 	"add text")			--> null
	setGxtEntry("key_4", 	"add text")			--> null
	setGxtEntry("key_5", 	"add text")			--> null

--- Main
function main()
  while true do
    wait(0)
    if isPlayerPlaying(playerHandle) then
    if isButtonPressed(playerHandle, 15) then -- sprint 
    break
    end
  end
end
end
setPlayerControl(playerHandle, false)

function main()

while true do

wait(5)
drawRect (float 90.0, 201.0 float, float 139.0, float 271.0, int y, int g, b int, int)
drawRect (float 90.0, 79.0 float, float 140.0, float 1.0, int y, int g, b int, int)
drawRect (float 90.0, 327.0 float, float 139.0, float 1.0, int y, int g, b int, int)
setTextColour(255, 255, 255, 255)
setTextScale(0.3, 0.8)
setTextDropshadow(50, 50, 255, 255)
displayText(23.0, 80.0, 'key_1')
setTextColour(255, 255, 255, 255)
setTextScale(0.3, 0.8)
setTextDropshadow(50, 50, 255, 255)
displayText(23.0, 89.0, 'key_2')
setTextColour(255, 255, 255, 255)
setTextScale(0.3, 0.8)
setTextDropshadow(50, 50, 255, 255)
displayText(23.0, 98.0, 'key_3')
setTextColour(255, 255, 255, 255)
setTextScale(0.3, 0.8)
setTextDropshadow(50, 50, 255, 255)
displayText(23.0, 107.0, 'key_4')
setTextColour(255, 255, 255, 255)
setTextScale(0.3, 0.8)
setTextDropshadow(50, 50, 255, 255)
displayText(23.0, 116.0, 'key_5')
drawRect (float 90.0, bar_pos float, float 140.0, float 1.0, int y, int bar_color, b int, int)
bar_color + 1
if
   bar_color > 255 then
   bar_color = 0
end   
if  
  isButtonPressed(playerHandle, 16) then
    if
    selected_items == 5
    then
    wait(45)
    selected_items = 1
    bar_pos = 84.0
    return
    end
    wait(45)
    selected_items + 1
    bar_pos + 9.0
    return
end
if
  isButtonPressed(playerHandle, 16) then
    if
    selected_items == 1
    then
    wait(45)
    selected_items = 5
    bar_pos = 120.0
    return
    end
    wait(45)
    selected_items - 1
    bar_pos - 9.0
    return
end  
if
  isButtonPressed(playerHandle, 17) then
    setPlayerControl(PLAYER_HANDLE, true)
    return 
end
if
  selected_items == 1 then
    if
    isButtonPressed(playerHandle, 16) then
    wait(5)
    return  
  end
end
 if
  selected_items == 2 then
    if
    isButtonPressed(playerHandle, 16) then
    wait(5)
    return
  end
end 
if
  selected_items == 3 then
    if
    isButtonPressed(playerHandle, 16) then
    wait(5)
    return
  end
end
 if
  selected_items == 4 then
    if
    isButtonPressed(playerHandle, 16) then
    wait(5)
    return
  end
end 
 if
  selected_items == 5 then
    if
    isButtonPressed(playerHandle, 16) then
    wait(5)
    return  
  end
end 
end
end
  • Delatom likes this

jayd00
  • jayd00

    Rat

  • Members
  • Joined: 24 May 2008

#33

Posted 29 December 2017 - 11:56 PM

I'm confused with -As Pack- animation sequence, for some reason this code doesn't work:

script_name("testAnim")
script_moonloader(025)
require 'lib.moonloader'
local vk = require 'lib.vkeys'
local anim = {
	pack = "DANCING",
	--+-- JUMP animations
	danceA  = "DNCE_M_A",
	danceB   = "DAN_LOOP_A",
	danceC  = "DNCE_M_D",
}
function loadAnimation(string)
	if not hasAnimationLoaded(string) then
		requestAnimation(string)
		loadAllModelsNow()
	end
end

function main()
	while true do
		if isPlayerPlaying(playerHandle) and wasKeyPressed(vk.VK_B) and wasKeyPressed(vk.VK_N) then
			loadAnimation(anim.pack)
			local taskDance = openSequenceTask()
			taskPlayAnimNonInterruptable(-1, anim.danceA, anim.pack, 4.0, false, true, true, false, -1)
			taskPlayAnimNonInterruptable(-1, anim.danceB, anim.pack, 4.0, false, true, true, false, -1)
			taskPlayAnimNonInterruptable(-1, anim.danceC, anim.pack, 4.0, false, true, true, false, -1)
			setSequenceToRepeat(taskDance, true)
			closeSequenceTask(taskDance)
			performSequenceTask(playerPed, taskDance)
			printString("dancing...", 1000)
			wait(1500)
			repeat
				wait(0)
			until wasKeyPressed(vk.VK_M)
			clearSequenceTask(taskDance)
			clearCharTasks(playerPed)
			printString("STOP...", 1000)
			wait(1500)
		end
		wait(0)
	end
end

But if I use a simple animation it works:

function main()
	while true do
		if isPlayerPlaying(playerHandle) and wasKeyPressed(vk.VK_B) and wasKeyPressed(vk.VK_N) then
			loadAnimation(anim.pack)
			taskPlayAnimNonInterruptable(playerPed, anim.danceB, anim.pack, 16.0, true, true, true, false, -1)
			printString("dancing...", 1000)
			wait(1500)
			repeat
				wait(0)
			until wasKeyPressed(vk.VK_M)
			clearCharTasks(playerPed)
			printString("STOP...", 1000)
			wait(1500)
		end
		wait(0)
	end
end

am I wrong? there is something in lua that I have to know about this?

thanks  :cookie:  :cookie: 
  • Sanmodder likes this

Reameb
  • Reameb

  • Members
  • Joined: 08 Sep 2014
  • Mexico

#34

Posted 4 weeks ago

Ok so i have been trying to do this project i have in mind and it needs pickups.

 

Have been making it in cleo and talked to silent, he said that pickups created with cleo stay on the savegame, even after removing the script, so i made the script again, this time in lua, and it happens again, does anyone know a way to avoid this?


goodidea82
  • goodidea82

    SA Modder

  • Members
  • Joined: 13 Jun 2013
  • Germany

#35

Posted 2 weeks ago Edited by goodidea82, 2 weeks ago.

In cleo I did it the following, probably you can do it in lua the same.
Spoiler

BH Team
  • BH Team

    FYP

  • Members
  • Joined: 08 Aug 2011
  • Russia

#36

Posted A day ago

Ok so i have been trying to do this project i have in mind and it needs pickups.
 
Have been making it in cleo and talked to silent, he said that pickups created with cleo stay on the savegame, even after removing the script, so i made the script again, this time in lua, and it happens again, does anyone know a way to avoid this?

I'll try to figure out how to disable auto saving of script entities. For now, yes, as goodidea82 said, the only way to prevent that is to destroy unwanted stuff during game saving.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users