Jump to content

starting a script on the 3 2 1 GO


Faw[Ful]

Recommended Posts

Posted

This script start when the map start , but it is possible to start it exactly after the 3 2 1 GO in race (after the GO) when the player can move, because the server wait for the other players and because of that waiting time is always different. :

function createBomb1() 
  setTimer(createExplosion, 8000, 1, 337.13577270508, -2672.0153808594, 39.778259277344, 2 ) 
    setTimer(createExplosion, 8000, 1, 326.68267822266, -2671.3786621094, 39.778259277344, 2 ) 
  setTimer(createExplosion, 8000, 1, 326.19787597656, -2681.62109375, 39.778259277344, 2 ) 
  setTimer(createExplosion, 8000, 1, 336.29052734375, -2682.634765625, 39.778259277344, 2 ) 
end 
  
addEventHandler("onMapStarting", getResourceRootElement(getThisResource()), createBomb1) 
  
function slowmo1 (player) 
setTimer(setGameSpeed,8000,1,0.3) 
setTimer(setGameSpeed,10000,1,1) 
end 
  
addEventHandler("onMapStarting", getResourceRootElement(getThisResource()), slowmo1) 
  
function createBomb2() 
  setTimer(createExplosion, 19000, 1, 370.1022644043, -2715.5942382813, 39.778259277344, 2 ) 
    setTimer(createExplosion, 19000, 1, 371.42962646484, -2706.2380371094, 39.778259277344, 2 ) 
  setTimer(createExplosion, 19000, 1, 381.72714233398, -2705.4663085938, 39.778259277344, 2 ) 
  setTimer(createExplosion, 19000, 1, 381.18441772461, -2716.8752441406, 39.778259277344, 2 ) 
end 
  
addEventHandler("onMapStarting", getResourceRootElement(getThisResource()), createBomb2) 
  
function slowmo2 (player) 
setTimer(setGameSpeed,19000,1,0.3) 
setTimer(setGameSpeed,21000,1,1) 
end 
  
addEventHandler("onMapStarting", getResourceRootElement(getThisResource()), slowmo2) 
  
function createBomb3() 
  setTimer(createExplosion, 28000, 1, 375.88031005859, -2655.0949707031, 39.778259277344, 2 ) 
    setTimer(createExplosion, 28000, 1, 377.40100097656, -2667.4272460938, 39.778259277344, 2 ) 
  setTimer(createExplosion, 28000, 1, 388.40686035156, -2667.9453125, 39.778259277344, 2 ) 
  setTimer(createExplosion, 28000, 1, 387.88250732422, -2656.8972167969, 39.778259277344, 2 ) 
end 
  
addEventHandler("onMapStarting", getResourceRootElement(getThisResource()), createBomb3) 
  
function slowmo3 (player) 
setTimer(setGameSpeed,28000,1,0.3) 
setTimer(setGameSpeed,30000,1,1) 
end 
  
addEventHandler("onMapStarting", getResourceRootElement(getThisResource()), slowmo3) 
  
  
  
function omg_rot() 
  roue1 = createObject(2372, 333.17449951172, -2712.9213867188, 33.903285980225, 0, 0, 0) 
  omgMoveroue1(1) 
  roue7 = createObject(2052, 406.34017944336, -2740.7580566406, 34.834205627441, 0, 0, 0) 
  omgMoveroue7(1) 
  roue6 = createObject(2052, 384.79470825195, -2716.4147949219, 34.834205627441, 0, 0, 0) 
  omgMoveroue6(1) 
  roue5 = createObject(2052, 379.76644897461, -2749.7158203125, 34.834205627441, 0, 0, 0) 
  omgMoveroue5(1) 
  roue2 = createObject(2372, 367.12335205078, -2669.2465820313, 33.303340911865, 0, 0, 0) 
  omgMoveroue2(1) 
  roue8 = createObject(2052, 408.68197631836, -2684.7224121094, 34.834205627441, 0, 0, 0) 
  omgMoveroue8(1) 
  roue3 = createObject(2052, 308.14709472656, -2750.2890625, 34.834205627441, 0, 0, 0) 
  omgMoveroue3(1) 
  roue10 = createObject(2052, 313.23291015625, -2650.1105957031, 34.834205627441, 0, 0, 0) 
  omgMoveroue10(1) 
  roue9 = createObject(2052, 402.79202270508, -2643.3493652344, 34.834205627441, 0, 0, 0) 
  omgMoveroue9(1) 
  roue4 = createObject(2052, 342.90881347656, -2757.10546875, 34.834205627441, 0, 0, 0) 
  omgMoveroue4(1) 
end 
  
function omgMoveroue1(point) 
    moveObject(roue1, 3000, 333.17449951172, -2712.9213867188, 33.903285980225, 0, 0, 360) 
    setTimer(moveObject, 3000, 0, roue1, 3000, 333.17449951172, -2712.9213867188, 33.903285980225, 0, 0, 360) 
end 
  
function omgMoveroue7(point) 
    moveObject(roue7, 800, 406.34017944336, -2740.7580566406, 34.834205627441, 0, 0, 360) 
    setTimer(moveObject, 800, 0, roue7, 800, 406.34017944336, -2740.7580566406, 34.834205627441, 0, 0, 360) 
end 
  
function omgMoveroue6(point) 
    moveObject(roue6, 1000, 384.79470825195, -2716.4147949219, 34.834205627441, 0, 0, -360) 
    setTimer(moveObject, 1000, 0, roue6, 1000, 384.79470825195, -2716.4147949219, 34.834205627441, 0, 0, -360) 
end 
  
function omgMoveroue5(point) 
    moveObject(roue5, 500, 379.76644897461, -2749.7158203125, 34.834205627441, 0, 0, -360) 
    setTimer(moveObject, 500, 0, roue5, 500, 379.76644897461, -2749.7158203125, 34.834205627441, 0, 0, -360) 
end 
  
function omgMoveroue2(point) 
    moveObject(roue2, 3000, 367.12335205078, -2669.2465820313, 33.303340911865, 0, 0, -360) 
    setTimer(moveObject, 3000, 0, roue2, 3000, 367.12335205078, -2669.2465820313, 33.303340911865, 0, 0, -360) 
end 
  
function omgMoveroue8(point) 
    moveObject(roue8, 800, 408.68197631836, -2684.7224121094, 34.834205627441, 0, 0, -360) 
    setTimer(moveObject, 800, 0, roue8, 800, 408.68197631836, -2684.7224121094, 34.834205627441, 0, 0, -360) 
end 
  
function omgMoveroue3(point) 
    moveObject(roue3, 800, 308.14709472656, -2750.2890625, 34.834205627441, 0, 0, -360) 
    setTimer(moveObject, 800, 0, roue3, 800, 308.14709472656, -2750.2890625, 34.834205627441, 0, 0, -360) 
end 
  
function omgMoveroue10(point) 
    moveObject(roue10, 1000, 313.23291015625, -2650.1105957031, 34.834205627441, 0, 0, -360) 
    setTimer(moveObject, 1000, 0, roue10, 1000, 313.23291015625, -2650.1105957031, 34.834205627441, 0, 0, -360) 
end 
  
function omgMoveroue9(point) 
    moveObject(roue9, 800, 402.79202270508, -2643.3493652344, 34.834205627441, 0, 0, 360) 
    setTimer(moveObject, 800, 0, roue9, 800, 402.79202270508, -2643.3493652344, 34.834205627441, 0, 0, 360) 
end 
  
function omgMoveroue4(point) 
    moveObject(roue4, 800, 342.90881347656, -2757.10546875, 34.834205627441, 0, 0, 360) 
    setTimer(moveObject, 800, 0, roue4, 800, 342.90881347656, -2757.10546875, 34.834205627441, 0, 0, 360) 
end 
  
addEventHandler("onMapStarting", getResourceRootElement(getThisResource()), omg_rot) 
  
  
function omg_rot() 
  epic1 = createObject(2918, 330.650390625, -2676.7880859375, 154.40269470215, 0, 0, 0) 
  omgMoveepic1(1) 
  epic3 = createObject(2918, 383.44787597656, -2660.5300292969, 213.66796875, 0, 0, 0) 
  omgMoveepic3(1) 
  epic2 = createObject(2918, 377.0383605957, -2711.1281738281, 185.08781433105, 0, 0, 0) 
  omgMoveepic2(1) 
end 
  
function omgMoveepic1(point) 
  if point == 1 then 
    moveObject(epic1, 8000, 330.65069580078, -2676.7880859375, 48.497566223145, 0, 0, 0) 
    setTimer(omgMoveepic1, 8000, 1, 2) 
  elseif point == 2 then 
    -- OBJECT STOP 
  end 
end 
  
function omgMoveepic3(point) 
  if point == 1 then 
    moveObject(epic3, 1000, 383.44787597656, -2660.5300292969, 186.65783691406, 0, 0, 0) 
    setTimer(omgMoveepic3, 1000+19000, 1, 2) 
  elseif point == 2 then 
    moveObject(epic3, 8000, 383.44787597656, -2660.5300292969, 48.697608947754, 0, 0, -140) 
    setTimer(omgMoveepic3, 8000, 1, 3) 
  elseif point == 3 then 
    -- OBJECT STOP 
  end 
end 
  
function omgMoveepic2(point) 
  if point == 1 then 
    moveObject(epic2, 1000, 377.0383605957, -2711.1281738281, 177.83781433105, 0, 0, 0) 
    setTimer(omgMoveepic2, 1000+10000, 1, 2) 
  elseif point == 2 then 
    moveObject(epic2, 8000, 377.0383605957, -2711.1281738281, 48.817588806152, 0, 0, 0) 
    setTimer(omgMoveepic2, 8000, 1, 3) 
  elseif point == 3 then 
    -- OBJECT STOP 
  end 
end 
  
addEventHandler("onMapStarting", getResourceRootElement(getThisResource()), omg_rot) 

Posted
  
addEvent("onRaceStateChanging",true) 
addEventHandler("onRaceStateChanging", getRootElement(),function ( state ) 
   if (state == "Running") then 
      --paste your stuff here 
   end 
end) 
  

if i remember there is also a state called "MidMapVote" - vhen someone is trying to vote for a nother map, after the vote is cancled state is changong to "Running" so it may be a litle problem...

the state when the contdown is starting (before it dysplay 3) is "GridCountdown"

Posted

@Wojak: So we'll check how many times the Running state has been started.

  
local times = 0   
addEvent("onRaceStateChanging",true) 
addEventHandler("onRaceStateChanging", getRootElement(),function ( state ) 
   if (state == "Running") then 
      times = times + 1 
      if (times == 1) then   
           --paste your stuff here 
      end 
   end 
end) 
  

Should work since the script will revert the times variable to 0 everytime the map resource is started

Posted
@Wojak: So we'll check how many times the Running state has been started.
  
local times = 0   
addEvent("onRaceStateChanging",true) 
addEventHandler("onRaceStateChanging", getRootElement(),function ( state ) 
   if (state == "Running") then 
      times = times + 1 
      if (times == 1) then   
           --paste your stuff here 
      end 
   end 
end) 
  

Should work since the script will revert the times variable to 0 everytime the map resource is started

This part:

  
times = times + 1 
if (times == 1) then   
end 
  

Is totally pointless and unnecessary, think a bit how it can be anything less than 1.

Besides, "Running" state is set only once(when cars get unfrozen) while this resource is running.

Posted

@FFS-Racing: nope, it's also set when a votemap comes down to "Don't change" .

So counting how many times 'running' has been set and using it only the first time fixes this matter

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...