MrKAREEM Posted February 16, 2018 Posted February 16, 2018 Hello Guis I Want Make Carball Testing So What The Codes That I Need? I Whish Any one Help Me
raynner Posted February 17, 2018 Posted February 17, 2018 SetGarageOpen getGaragePosition getGarageSize createColCuboid
^iiEcoo'x_) Posted February 17, 2018 Posted February 17, 2018 15 minutes ago, raynner said: SetGarageOpen getGaragePosition getGarageSize createColCuboid ?????????????????????????????
raynner Posted February 17, 2018 Posted February 17, 2018 9 minutes ago, DABL said: ????????????????????????????? Car Ball dont is to use Garage Car balls ?
MrKAREEM Posted February 19, 2018 Author Posted February 19, 2018 On ١٧/٢/٢٠١٨ at 02:31, raynner said: Car Ball dont is to use Garage Car balls ? As Neon carball?
MrKAREEM Posted May 5, 2018 Author Posted May 5, 2018 On ١٧/٢/٢٠١٨ at 02:31, raynner said: Car Ball dont is to use Garage Car balls ? I Want Know How To Move The Ball When The Ped Hit it With The Car Do You Know ?
JustinMTA Posted May 5, 2018 Posted May 5, 2018 6 hours ago, MrKAREEM said: I Want Know How To Move The Ball When The Ped Hit it With The Car Do You Know ? The ball isn't an object, it's a vehicle with a spherical shape and custom .col file. 1
MrKAREEM Posted October 8, 2018 Author Posted October 8, 2018 (edited) i have an problem when i shoot the ball it fall down and didnot bumb on ground any help pls Edited October 8, 2018 by Dutchman101 removed useless nickmentions
MisterQuestions Posted October 8, 2018 Posted October 8, 2018 Learn some maths and create your own physics, detect once it hits ground then apply force to make it bounce. 2
Gordon_G Posted October 8, 2018 Posted October 8, 2018 Could you just reduce your signature @MrKAREEM ? it's painful to hide it manually thanks. 1 1
MrKAREEM Posted October 9, 2018 Author Posted October 9, 2018 20 hours ago, MisterQuestions said: Learn some maths and create your own physics, detect once it hits ground then apply force to make it bounce. any example pls ?? 1
MrKAREEM Posted October 13, 2018 Author Posted October 13, 2018 ok whats problem here or how let it falls ?? -- client -- addEvent("onCarballPosUpdate", true) addEvent("onClientVehicleCollision", true) local hit_ball = function(hitElement, force) if(isPedInVehicle(localPlayer)) then setVehicleDamageProof(getPedOccupiedVehicle(localPlayer), true) end if(hitElement) and (getElementDimension(hitElement) == getElementDimension(localPlayer)) then if(isBall(hitElement)) then local x, y, z = getElementPosition(hitElement) local throw = false local s = playSound3D("kick.mp3", x, y, z, false) setElementDimension(s, getElementDimension(hitElement)) setSoundMaxDistance(s, 100) setSoundVolume(s, 0.5) x, y, z = getElementVelocity(hitElement) if(force > 500) then throw = true end if(force > 100) then force = 100 end local nx, ny, nz = x*(force/30), y*(force/30), z+((force/300)*1.01) if(source == getPedOccupiedVehicle(localPlayer)) then x, y, z = getElementPosition(hitElement) triggerServerEvent("onCarballBallUpdate", localPlayer, hitElement, x, y, z, nx, ny, nz) if(throw == true) then end end setElementVelocity(hitElement, nx, ny, nz) end end end addEventHandler("onClientVehicleCollision", getRootElement(), hit_ball) isBall = function(ball) return getElementData(ball, "ball") end local sync_ball = function(last_syncher, ball, x, y, z, x2, y2, z2) if(last_syncher ~= localPlayer) then setElementPosition(ball, x, y, z) setElementVelocity(ball, x2, y2, z2) end end addEventHandler("onCarballPosUpdate", getRootElement(), sync_ball) -- server -- Ball = {} addCommandHandler('ball', function(player) if isElement(Ball[player]) then return outputChatBox('u have one', source) end local x,y,z = getElementPosition(player) Ball[player] = createObject(2912, x + 3, y, z) outputChatBox('done', player) setElementData(Ball[player], 'ball', true) end) addEvent('onCarballBallUpdate',true) local carball_update = function(ball, x, y, z, x2, y2, z2) triggerClientEvent("onCarballPosUpdate", getRootElement(), source, ball, x, y, z, x2, y2, z2) end addEventHandler("onCarballBallUpdate", getRootElement(), carball_update) any one help me resource 97% completely
MisterQuestions Posted October 15, 2018 Posted October 15, 2018 I don't think that will even set a direction to ball
MrKAREEM Posted October 15, 2018 Author Posted October 15, 2018 7 hours ago, MisterQuestions said: I don't think that will even set a direction to ball how to get that ?? and how to apply physics to ball or object ?? if there was functions or what give me pls ?? and i want learn can some one help me ?? or give me code and help me pls
MisterQuestions Posted October 19, 2018 Posted October 19, 2018 I did the same mistake as you time ago.
MrKAREEM Posted October 20, 2018 Author Posted October 20, 2018 17 hours ago, MisterQuestions said: I did the same mistake as you time ago. -- "ball" is the ball element -- "vehicle" is the vehicle element that collided with the ball local x, y, z = getElementPosition(ball) local x2, y2, z2 = getElementPosition(vehicle) local velX, velY, velZ = getElementVelocity(vehicle) local vel = math.sqrt(velX*velX + velY*velY + velZ*velZ) -- equal to getDistanceBetweenPoints3D(0, 0, 0, velX, velY, velZ) local dirX, dirY, dirZ = x - x2, y - y2, z - z2 local dist = math.sqrt(dirX*dirX + dirY*dirY + dirZ*dirZ) -- equal to getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) dirX, dirY, dirZ = dirX / dist, dirY / dist, dirZ / dist -- To change velocity of the ball now, i guess you might want to do: -- setElementVelocity(ball, dirX * vel, dirY * vel, dirZ * vel) thats work ?? 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now