Jump to content

Move Object from client side


MadMaximus

Recommended Posts

Hey guys. I'm new to lua. I found a way to move objects from server side. But when I upload it to the server it doesn't work. Because server doesn't support server side scripting. So can you guys please tell me how to move an object from client side. So can you please provide me a full script which can move an object from client. Thank you.

function omg_brigemove()
  omg3228 = createObject(3095, 1779.900390625, -7523, 0, 0, 0, 0)
  omgMoveomg3228(1)
  omg3604 = createObject(994, 1776.7001953125, -7527.3999023438, 0.60000002384186, 0, 0, 0)
  omgMoveomg3604(1)
  omg7312 = createObject(994, 1776.6999511719, -7518.6499023438, 0.60000002384186, 0, 0, 0)
  omgMoveomg7312(1)
end

function omgMoveomg3228(point)
  if point == 1 then
    moveObject(omg3228, 2000, 1779.9000244141, -7491.7001953125, 0, 0, 0, 0)
    setTimer(omgMoveomg3228, 2000, 1, 2)
  elseif point == 2 then
    moveObject(omg3228, 2000, 1779.900390625, -7523, 0, 0, 0, 0)
    setTimer(omgMoveomg3228, 2000, 1, 1)
  end
end

function omgMoveomg3604(point)
  if point == 1 then
    moveObject(omg3604, 2000, 1776.7001953125, -7496, 0.60000002384186, 0, 0, 0)
    setTimer(omgMoveomg3604, 2000, 1, 2)
  elseif point == 2 then
    moveObject(omg3604, 2000, 1776.7001953125, -7527.3999023438, 0.60000002384186, 0, 0, 0)
    setTimer(omgMoveomg3604, 2000, 1, 1)
  end
end

function omgMoveomg7312(point)
  if point == 1 then
    moveObject(omg7312, 2000, 1776.7001953125, -7487.3999023438, 0.60000002384186, 0, 0, 0)
    setTimer(omgMoveomg7312, 2000, 1, 2)
  elseif point == 2 then
    moveObject(omg7312, 2000, 1776.6999511719, -7518.6499023438, 0.60000002384186, 0, 0, 0)
    setTimer(omgMoveomg7312, 2000, 1, 1)
  end
end

addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), omg_brigemove)


 

Link to comment
29 minutes ago, MadMaximus said:

Because server doesn't support server side scripting

...

i think you are missing something

Are you asking to do something clientside because you need it or because you think what you said (which is wrong)?

I'm asking this because if it's possible it's better doing it serverside

 

PS: getResourceRootElement(getThisResource()) = resourceRoot

PS: Why shouldn't the script work?

Edited by LoPollo
  • Like 1
Link to comment
5 minutes ago, LoPollo said:

...

i think you are missing something

Are you asking to do something clientside because you need it or because u think what you said (which is wrong)?

I'm asking this because if it's possible it's better doing it serverside

I need to do it in client side. Because the owner said scripts need to be in clientside to work. Maybe because they don't allow the users to access the sever side functions or something..

Link to comment
54 minutes ago, MadMaximus said:

don't allow the users to access the sever side functions

Indeed server functions have that name for the reason they are available only serverside.

By the way, all the function you used in the script are shared, so they are available both clientside and serverside. That script can run in both sides, so what's the problem? Are there errors? I don't understand what's the problem.

PS: in this forum, the function inside code blocks are highlighted: blue -> shared, red -> client, yellow/orange -> server. If you have doubts, the fastest way to know in which side the function is available is searching at wiki.

  • Like 1
Link to comment
3 hours ago, LoPollo said:

Indeed server functions have that name for the reason they are available only serverside.

By the way, all the function you used in the script are shared, so they are available both clientside and serverside. That script can run in both sides, so what's the problem? Are there errors? I don't understand what's the problem.

PS: in this forum, the function inside code blocks are highlighted: blue -> shared, red -> client, yellow/orange -> server. If you have doubts, the fastest way to know in which side the function is available is searching at wiki.

As I said before I'm new to lua. So I don't know how to call the script as a client. 

I have to call it as the sever <script src="moveobj.lua" type="server"></script> to run the script.

<script src="moveobj.lua" type="client"></script> is not working thats the problem.

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