News: Welcome back to Bullworth! If you haven't already, you will need to reset your password..


Author Topic: Lua Script  (Read 1594 times)

0 Members and 1 Guest are viewing this topic.

Offline AlphaTech

  • LostInSpace
  • Sr. Member
  • ***
  • Posts: 758
  • Gender: Male
  • The name's AlphaTECH, whatca need help with?! :)
    • View Profile
Lua Script
« on: April 15, 2014, 10:27:52 PM »
How do I make the if PedInRectangle code happen more than once not repeating but say
Code: [Select]
if PedInRectangle then
PedSetInfiniteSprint
if PedInRectangle then
PedCreateXYZ

The code repeats itself but the lua script never lets me use me functions more than once with this code it is always one instance.
« Last Edit: February 27, 2015, 06:31:54 PM by LostInSpace »

Offline c00ld0c26

  • The D0c
  • Can't Get Enough
  • *****
  • Posts: 5,137
  • Gender: Male
  • Just a dood doing dood things.
    • View Profile
    • My channel.
Re: Lua Script
« Reply #1 on: April 15, 2014, 10:30:23 PM »
Re run the main function like.

if PedInRectangle(BLAHBLAH) then
CODES
Main()


when you rerun the main function, it should let you do it more then once.

Offline AlphaTech

  • LostInSpace
  • Sr. Member
  • ***
  • Posts: 758
  • Gender: Male
  • The name's AlphaTECH, whatca need help with?! :)
    • View Profile
Re: Lua Script
« Reply #2 on: April 15, 2014, 10:39:19 PM »
It never lets me repeat the code though it usually says something like repeat or until needed near end or something like that. I put the line of code where it says its needed and it never repeats the code. Can you give me an example script of the if PedInRectangle code being used more than once. Thanks it will help allot.

Offline c00ld0c26

  • The D0c
  • Can't Get Enough
  • *****
  • Posts: 5,137
  • Gender: Male
  • Just a dood doing dood things.
    • View Profile
    • My channel.
Re: Lua Script
« Reply #3 on: April 15, 2014, 11:09:18 PM »
I can make one here.

Code: [Select]
MissionSetup = function()
AreaTransitionXYZ(.....)
PlayerSetHealth(.......)
end

Test = function()
if PedInRectangle(.........) then
main()
end
end

MissionCleanUp = function()
end

main = function()
repeat
Test()
Wait(0)
until not Alive
end

Offline AlphaTech

  • LostInSpace
  • Sr. Member
  • ***
  • Posts: 758
  • Gender: Male
  • The name's AlphaTECH, whatca need help with?! :)
    • View Profile
Re: Lua Script
« Reply #4 on: April 16, 2014, 11:14:09 AM »
It's still not letting me repeat the If PedInRectangle code it doesn't repeat at all. Any suggestions?