Jump to content

Timiimit

Members
  • Posts

    142
  • Joined

  • Last visited

About Timiimit

  • Birthday 29/03/1913

Details

  • Gang
    [GFL]

Timiimit's Achievements

Poot-butt

Poot-butt (14/54)

0

Reputation

  1. i did: function checkLanding (hitElement, force, bodypart, colX, colY, colZ, normX, normY, normZ) if(source ~= veh)then return end local m = getElementMatrix(veh) local vecX, vecY, vecZ = m[3][1], m[3][2], m[3][3] local nRot = 0.05 if math.abs(vecX - normX) <= nRot and math.abs(vecY - normY) <= nRot and math.abs(vecZ - normZ) <= nRot then outputChatBox("landed like a boss!") end end and i get 0-2 outputs (depends on the speed) when i'm not even in the air yet (still on ramp or when ground angle changes) and 1-3 outputs when i land.
  2. this is what i got: function checkLanding (hitElement, force, bodypart, colX, colY, colZ, normX, normY, normZ) if(source ~= veh)then return end local m = getElementMatrix(veh) local vecX, vecY, vecZ = m[3][1], m[3][2], m[3][3] local nRot = 8 if not wasOnGround and (vecZ - normZ <= nRot) then outputChatBox("vZ: " .. vecZ .. ", normZ: " .. normZ) end end addEventHandler("onClientVehicleCollision", getRootElement(), checkLanding) wasOnGround is isVehicleOnGround of the previous frame. i thought that normZ is up vector of collision, but now i see that all normX, normY and normZ are direction. So how am i able to compare normX, Y and Z with ony one vecZ? (im not sure that i understand the picture here)
  3. I haven't learned matrices in school yet so i'm not sure how they work (all i know about them, is that they are table of numbers). Could anyone show me how you get the up vector of the vehicle and the up vector of the surface of collision (onClientVehicleCollision).
  4. Well the easiest way is still pretty hard! I'll try as soon as I'll be able to.
  5. Hello all! I haven't post for a very long time now mostly because i am using wiki . Does anyone know how to detect that vehicle landed on 4 wheels (not 0 XY rotation, but 0 XY rotation relative to the element that player landed on)? i have no clue how to even find element that vehicle landed on... please help!
  6. I have!! but don't know how to fix it!
  7. ok i figured it out! But i need to know how to calculate where is 1 unit infront of ped! And i have no idea how! help?!!
  8. Timiimit

    help fix bug!

    Hi! I must fix bug at map editor! look at this video to see what happens. you don't have to make comment if u know how to fix. You can make post here!!!
  9. help with working script!
  10. it can be deleted by anyone!
  11. ok! This is what i have: botPed = null function createBot() if (botPed == null ) then botPed = createPed( 312, 1989, -2190, 14, 180, 0, 180 ) outputConsole("Bot is in game!") else outputConsole("Bot already exists.") end end function deleteBot() if (botPed ~= null) then destroyElement( botPed ) outputConsole("Bot has been deleted.") botPed = null else outputConsole("No bot to remove.") end end function smartBotON() setPedAnimation( botPed, "ped", "run_player" ) -- detection event addEventHandler( "onClientRender", getRootElement(), detecting ) -- detecting event outputConsole( "Bot is now smart!" ) end function standBot() setPedAnimation( botPed ) outputConsole( "Bot is standing still." ) removeEventHandler( "onClientRender", getRootElement(), detecting ) end function detecting( element, dim ) -- detection hit -- if hit must do "botHit()" end function botTurn() if (botPed ~= null) then outputDebugString("Bot turned in random direction.") outputConsole("Bot turned in random direction.") setPedRotation(botPed, getPedRotation(botPed) + math.random(90, 270)) end end function botHit() outputDebugString("Bot detected obsticale infront of it.") outputConsole("Bot detected obsticale infront of it.") botTurn() end addCommandHandler( "smart", smartBotON ) addCommandHandler( "stand", standBot ) addCommandHandler( "botON", createBot ) addCommandHandler( "botOFF", deleteBot ) I really hope no one will copy this code! Is possible to delete topic?
×
×
  • Create New...