Bully-Board

Bully Modding Section => Modding Questions/Help => Modding Questions/Help Archives => Topic started by: AlphaTech on April 15, 2014, 10:27:52 PM

Title: Lua Script
Post by: AlphaTech 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.
Title: Re: Lua Script
Post by: c00ld0c26 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.
Title: Re: Lua Script
Post by: AlphaTech 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.
Title: Re: Lua Script
Post by: c00ld0c26 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
Title: Re: Lua Script
Post by: AlphaTech 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?