-- name: AgeVerificationMod v1.1 -- description: Adds an very effective age-verification system to sm64ex-coop by testing the attention span of each player after joining. Every player needs to keep L,R,Z,A,B and D-Left or the corresponding keyboard buttons pressed (Keybindings) down (To prevent them doing something else with their hands in the meantime) for a random amount of seconds between 30s and 60s without a single frame interuption while also not moving to get verified. Any mistake will cause the timer to reset and restart local maxTimeLeft = math.random(900, 1800) local maxInfoTime = 30 local verified = false local timeLeft = nil local infoTime = nil local posX = nil local posY = nil local posZ = nil function on_mario_update(m) if m.playerIndex == 0 then if verified == false then if (timeLeft == nil) then timeLeft = maxTimeLeft infoTime = maxInfoTime posX = m.pos.x posY = m.pos.y posZ = m.pos.z end infoTime = infoTime - 1 if (infoTime < 1) then infoTime = maxInfoTime if timeLeft == maxTimeLeft then djui_chat_message_create("\\#ff8080\\You need to verify that you are old enough to play on this server!\nTo verify your age, you need to pass an attention span test!\nDon't move and keep following buttons pressed down until you will receive a success popup (The amount of time will be randomly set between 30s and 60s): L,R,Z,A,B and D-Pad Left!\nIf this message is shown red, than you are not holding the buttons correctly down. If this message is shown green, you are doing it correctly!") else djui_chat_message_create("\\#80ff80\\You need to verify that you are old enough to play on this server!\nTo verify your age, you need to pass an attention span test!\nDon't move and keep following buttons pressed down until you will receive a success popup (The amount of time will be randomly set between 30s and 60s): L,R,Z,A,B and D-Pad Left!\nIf this message is shown red, than you are not holding the buttons correctly down. If this message is shown green, you are doing it correctly!") end end if (posX ~= m.pos.x or posY ~= m.pos.y or posZ ~= m.pos.z) then timeLeft = maxTimeLeft m.pos.x = posX m.pos.y = posY m.pos.z = posZ else if (m.controller.buttonDown & L_TRIG) ~= 0 and (m.controller.buttonDown & R_TRIG) ~= 0 and (m.controller.buttonDown & Z_TRIG) ~= 0 and (m.controller.buttonDown & A_BUTTON) ~= 0 and (m.controller.buttonDown & B_BUTTON) ~= 0 and (m.controller.buttonDown & L_JPAD) ~= 0 then timeLeft = timeLeft - 1 m.pos.x = posX m.pos.y = posY m.pos.z = posZ else timeLeft = maxTimeLeft posX = m.pos.x posY = m.pos.y posZ = m.pos.z end if timeLeft < 1 then verified = true djui_popup_create("\\#ff40ff\\AGE-VERIFICATION SUCCESSFUL!\n\\#ffff40\\YOU CAN MOVE NOW!", 1) end end end end end function on_before_set_mario_action(m, a) if m.playerIndex == 0 and verified == false then return 1 end end function on_allow_interact(m, o, i) if m.playerIndex == 0 and verified == false then return false end end function on_chat_message(m, s) if m.playerIndex == 0 and verified == false then return false end end function on_allow_hazard_surface(m, i) if m.playerIndex == 0 and verified == false then return false end end function on_before_phys_step(m, i) if m.playerIndex == 0 and verified == false then return 9 end end hook_event(HOOK_MARIO_UPDATE, on_mario_update) hook_event(HOOK_BEFORE_SET_MARIO_ACTION, on_before_set_mario_action) hook_event(HOOK_ALLOW_INTERACT, on_allow_interact) hook_event(HOOK_ON_CHAT_MESSAGE, on_chat_message) hook_event(HOOK_ALLOW_HAZARD_SURFACE, on_allow_hazard_surface) hook_event(HOOK_BEFORE_PHYS_STEP, on_before_phys_step)