Jump to content

31cmTrueDamage

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by 31cmTrueDamage

  1. Thank you, sorry to bother, but what recommendations do you have to work better in multiplayer, i was hoping every player could do the stage and they're time would be outputed to chat so everyone can see.
  2. Hello, i am trying to make a simple rally stage mod where you create 2 markers, one for start and one for finish, that part is good, but i am trying to make a timer start when you pass the start marker and stop counting when you pass the finish marker, then it should print the time in chat. I started lua scripting today and used a bit of GPT just because all i knew was Java, so basically when i pass the start marker the Stage Started message doesn't show up, so i guess i am not getting the player position correctly maybe? not sure. The only code not inserted here are 3 functions to create the start, the finish and to clear all markers, so i guess is not needed. function checkStageProgress(player) if not startMarker or not finishMarker then return end local startX, startY, startZ = getElementPosition(startMarker) local finishX, finishY, finishZ = getElementPosition(finishMarker) local playerX, playerY, playerZ = getElementPosition(player) local distanceToStart = getDistanceBetweenPoints2D(startX, startY, playerX, playerY) if not raceInProgress and distanceToStart <= 3 then raceInProgress = true startTime = getTickCount() -- Start counting time outputChatBox("Stage started!", player) end if raceInProgress then local elapsedTime = (getTickCount() - startTime) / 1000 outputChatBox("Stage time: " .. elapsedTime .. " seconds.", player) end if raceInProgress and isElementWithinMarker(player, finishMarker) then local elapsedTime = (getTickCount() - startTime) / 1000 outputChatBox("Stage finished! Time: " .. elapsedTime .. " seconds.", player) raceInProgress = false end end
×
×
  • Create New...