Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Basic of Console Commands
- -- Main function:
- function main()
- while not SystemIsReady() or AreaIsLoading() do
- Wait(0)
- end
- CreateThread("SYSTEM_Console")
- end
- -- Thread:
- SYSTEM_Console = function()
- local gData = {
- Mode = 1,Select = 1
- Alphabet = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"," "},
- Command = {
- -- {command,function,{function arguments}}:
- {"Welcome",ForceStartMission,{"1_01"}},
- {"Final",ForceStartMission,{"6_B"}},
- {"PunishmentPoints",DisablePunishmentSystem,{false}}, -- Toggle
- }
- },
- while true do
- if IsButtonBeingPressed(4,0) then
- PlayerSetControl(0)
- local PrintOut,ReBuild,Typing = "",false,{}
- repeat
- if IsButtonBeingPressed(1,0) then
- gData.Select = gData.Select + 1
- if gData.Select > table.getn(gData.Alphabet) then gData.Select = 1 end
- elseif IsButtonBeingPressed(0,0) then
- gData.Select = gData.Select - 1
- if gData.Select < 1 then gData.Select = table.getn(gData.Alphabet) end
- end
- if IsButtonBeingPressed(7,0) then
- table.insert(Typing,gData.Alphabet[gData.Select])
- ReBuild = true
- elseif IsButtonBeingPressed(2,0) then
- if table.getn(Typing) > 0 then
- table.remove(Typing,table.getn(Typing))
- if table.getn(Typing) > 0 then
- ReBuild = true
- else
- PrintOut = ""
- end
- end
- end
- if ReBuild then
- local Current = 0
- while true do
- Current = Current + 1
- if Current > table.getn(Typing) then
- break
- else
- if Current > 1 then
- PrintOut = PrintOut..""..Typing[Current]
- else
- PrintOut = Typing[Current]
- end
- end
- end
- ReBuilds = false
- end
- TextPrintString("> "..PrintOut.."\n\n| "..gData.Alphabet[gData.Select].." |",0,1)
- if IsButtonBeingPressed(14,0) then
- -- Default command, launch script:
- if string.find(PrintOut,".lua",-4) then
- LaunchScript(PrintOut)
- end
- -- Default command, starting mission:
- for Mission_ID = 0,261 do
- if tonumber(PrintOut) == Mission_ID then
- ForceStartMissionIndex(tonumber(PrintOut))
- end
- end
- -- Custom command:
- for i,code in ipairs(gData.Command) do
- if PrintOut == code[1] then
- -- If toggle:
- for Arg = 1,table.getn(code[3]) do
- if type(code[3][Arg]) == "boolean" then
- code[3][Arg] = not code[3][Arg]
- end
- end
- -- Run command:
- code[2](unpack(code[3]))
- end
- end
- end
- Wait(0)
- until IsButtonBeingPressed(4,0)
- PlayerSetControl(1)
- end
- Wait(0)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment