Jump to content

Synced Ball


stumpy

Recommended Posts

Hello,

is there any way to make a synced Ball? I´ve tried to sync the beachball (ID: 1598) but on getElementPostition(beachball), i got the spankoords back, not the actuelly postition.

Or ist there any other way to make a synced ball, maybe like the Neon Carball Script?

Regards

Link to comment

i´ve tried both, but it´s on client and server the same.

Now i tried to make this with moveObject, but i don´t know how i get the direction for movement.

This is my example, maybe anybody can help me with this function.

  
function onDozerCollision(hit,force,bodyPart,colX,colY,colZ,normX,normY,normZ,hitForce,model) 
    if getElementModel(hit) == 1598 then 
        local x,y,z = getElementPosition(hit) 
        moveObject(hit,5000,x,y,z,0,0,0,"OutQuad") 
    end 
end 
addEventHandler("onClientVehicleCollision", getRootElement(),onDozerCollision) 

Link to comment

yes i know, but i can trigger the moveObject Function to server. For example:

Client:

function onDozerCollision(hit,force,bodyPart,colX,colY,colZ,normX,normY,normZ,hitForce,model) 
    if getElementModel(hit) == 1598 then 
        local x,y,z = getElementPosition(hit) 
        triggerServerEvent("moveBall_S",getLocalPlayer(),hit,x,y,t) 
    end 
end 
addEventHandler("onClientVehicleCollision", getRootElement(),onDozerCollision) 
  

Server:

  
function moveBall_S_func(ball,x,y,z) 
    moveObject(ball,5000,x,y,z,0,0,0,"OutQuad") 
end 
addEvent("moveBall_S",true) 
addEventHandler("moveBall_S",getRootElement(),moveBall_S_func) 

But i´ve problems with the calculation of the movement direction.

Thanks for your help!

Link to comment

As far as I know Neon Carball uses an invisible car that has the same size as the ball (so that the ball seems to have its own physics which you can modify via setModelHandling/setVehicleHandling).

As an alternative you can try to play around with setObjectMass and dynamic objects. Everything else (setElementVelocity etc.) would require pretty much efford.

Link to comment

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