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


Author Topic: LUA Time Lock  (Read 10933 times)

0 Members and 2 Guests are viewing this topic.

Offline xbetstyler

  • Jr. Member
  • **
  • Posts: 14
    • View Profile
Re: LUA Time Lock
« Reply #30 on: April 24, 2013, 04:30:51 AM »
You can check this Madman's tutor:

What you will have to do is edit a library script and force that script to load the modified script you made.

One way to do this is to edit the stimecycle.lua which is a library script.

Library scripts are certain scripts that stay loaded all the time in the game.....stimecycle.lua, libplayer.lua, libped.lua, bdorm.lua, main.lua, mainmap.lua and a few others are library scripts.

To add a external script to a library script you need to edit at the beginning of a script and add:

ImportScript("ArcRace1.lua")

That line will add the external script which in this case is the Arcade Machine in the boys dorm.

You will also need to launch the external script which has to be done in key parts of the script. This can be launching the script only once or launch it any number of times and it should work.

To launch a imported script you need to use:

LaunchScript("ArcRace1.lua") This is the arcade machine in the boys dorm as per our example for importing the script.

what you need to do is compile the modified STimecycle.lua to STimeCycle.lur and replace the original file.

Example:

           
Code: [Select]
ImportScript("ArcRace1.lua")

main = function()
  repeat
    Wait(1000)
  until not Alive
end
 
F_AttendedClass = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    return
  end
  SetSkippedClass(false)
  PlayerSetPunishmentPoints(0)
end
 
F_MissedClass = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    return
  end
  SetSkippedClass(true)
  StatAddToInt(166)
end
 
F_AttendedCurfew = function()
  if not PedInConversation(gPlayer) and not MissionActive() then
    TextPrintString("You got home in time for curfew", 4)
  end
end
 
F_MissedCurfew = function()
  if not PedInConversation(gPlayer) and not MissionActive() then
    TextPrint("TM_TIRED5", 4, 2)
  end
end
 
F_StartClass = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    return
  end
  F_RingSchoolBell()
  local l_6_0 = PlayerGetPunishmentPoints() + GetSkippingPunishment()
end
 
F_EndClass = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    return
  end
  F_RingSchoolBell()
end
 
F_StartMorning = function()
  F_UpdateTimeCycle()
  LaunchScript("ArcRace1.lua")
end
 
F_EndMorning = function()
  F_UpdateTimeCycle()
  LaunchScript("ArcRace1.lua")
end
 
F_StartLunch = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    F_UpdateTimeCycle()
    return
  end
  F_UpdateTimeCycle()
  LaunchScript("ArcRace1.lua")
end
 
F_EndLunch = function()
  F_UpdateTimeCycle()
  LaunchScript("ArcRace1.lua")
end
 
F_StartAfternoon = function()
  F_UpdateTimeCycle()
  LaunchScript("ArcRace1.lua")
end
 
F_EndAfternoon = function()
  F_UpdateTimeCycle()
  LaunchScript("ArcRace1.lua")
end
 
F_StartEvening = function()
  F_UpdateTimeCycle()
  LaunchScript("ArcRace1.lua")
end
 
F_EndEvening = function()
  F_UpdateTimeCycle()
  LaunchScript("ArcRace1.lua")
end
 
F_StartCurfew_SlightlyTired = function()
  F_UpdateTimeCycle()
  LaunchScript("ArcRace1.lua")
end
 
F_StartCurfew_Tired = function()
  F_UpdateTimeCycle()
  LaunchScript("ArcRace1.lua")
end
 
F_StartCurfew_MoreTired = function()
  F_UpdateTimeCycle()
  LaunchScript("ArcRace1.lua")
end
 
F_StartCurfew_TooTired = function()
  F_UpdateTimeCycle()
  LaunchScript("ArcRace1.lua")
end
 
F_EndCurfew_TooTired = function()
  F_UpdateTimeCycle()
  LaunchScript("ArcRace1.lua")
end
 
F_EndTired = function()
  F_UpdateTimeCycle()
  LaunchScript("ArcRace1.lua")
end
 
F_Nothing = function()
end
 
F_ClassWarning = function()
  if IsMissionCompleated("3_08") and not IsMissionCompleated("3_08_PostDummy") then
    return
  end
  local l_23_0 = math.random(1, 2)
end
 
F_UpdateTimeCycle = function()
  if not IsMissionCompleated("1_B") then
    local l_24_0 = GetCurrentDay(false)
    if l_24_0 < 0 or l_24_0 > 2 then
      SetCurrentDay(0)
    end
  end
  F_UpdateCurfew()
end
 
F_UpdateCurfew = function()
  local l_25_0 = shared.gCurfewRules
  if not l_25_0 then
    l_25_0 = F_CurfewDefaultRules
  end
  l_25_0()
end
 
F_CurfewDefaultRules = function()
  local l_26_0 = ClockGet()
  if l_26_0 >= 23 or l_26_0 < 7 then
    shared.gCurfew = true
  else
    shared.gCurfew = false
  end
end
 
« Last Edit: April 24, 2013, 04:37:56 AM by www.Esai.cn »