Jump to content

Movement Record Tool


Tengen

Recommended Posts

Recording = false 
Millisecond = 0 
EventTable = {} 
EventID = 1 
ControlTable = { "fire", "next_weapon", "previous_weapon", "forwards", "backwards", "left", "right", "zoom_in", "zoom_out", 
 "change_camera", "jump", "sprint", "look_behind", "crouch", "action", "walk", "aim_weapon", "conversation_yes", "conversation_no", 
 "group_control_forwards", "group_control_back", "enter_exit", "vehicle_fire", "vehicle_secondary_fire", "vehicle_left", "vehicle_right", 
 "steer_forward", "steer_back", "accelerate", "brake_reverse", "radio_next", "radio_previous", "radio_user_track_skip", "horn", "sub_mission", 
 "handbrake", "vehicle_look_left", "vehicle_look_right", "vehicle_look_behind", "vehicle_mouse_look", "special_control_left", "special_control_right", 
 "special_control_down", "special_control_up" } 
  
function ToggleRecording(Key) 
    if (Key == "F3") then 
        if not (Recording) then 
            Millisecond = 0 
            EventTable = {} 
            EventID = 1 
            Recording = true 
            outputChatBox("Recording Started!") 
        end 
    else 
        if (Recording) then 
            Recording = false 
            Millisecond = 0 
            EventTable = {} 
            EventID = 1 
            outputChatBox("Recording Stopped!") 
        end 
    end 
end 
bindKey("F3", "down", ToggleRecording) 
bindKey("F4", "down", ToggleRecording) 
  
function onClientPreRender() 
    if (Recording) then 
        Millisecond = Millisecond + 1 
        local CheckTable = {} 
        for ID, Control in ipairs(ControlTable) do 
            CheckTable[ID + 1] = getControlState(Control) 
        end 
        local AcquiredTable = EventTable[EventID - 1] 
        if (AcquiredTable) then 
            CheckTable[1] = AcquiredTable[1] 
            if not (AcquiredTable == CheckTable) then 
                AddToTable(CheckTable) 
            end 
        else 
            AddToTable(CheckTable) 
        end 
        outputChatBox(tostring(EventID)) 
    end 
end 
addEventHandler("onClientPreRender", root, onClientPreRender) 
  
function AddToTable(NewTable) 
    NewTable[1] = Millisecond 
    EventTable[EventID] = NewTable 
    EventID = EventID + 1 
end 

I can't figure out why the two compared tables always return as different (false) = line 44

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...