MadMaximus Posted February 1, 2017 Share Posted February 1, 2017 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
LoPollo Posted February 1, 2017 Share Posted February 1, 2017 (edited) 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 February 1, 2017 by LoPollo 1 Link to comment
MadMaximus Posted February 1, 2017 Author Share Posted February 1, 2017 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
LoPollo Posted February 1, 2017 Share Posted February 1, 2017 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. 1 Link to comment
MadMaximus Posted February 1, 2017 Author Share Posted February 1, 2017 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
Bonsai Posted February 1, 2017 Share Posted February 1, 2017 Its not working because you need to rename the "onResourceStart" event to the clientside version "onClientResourceStart" at least. 1 Link to comment
MadMaximus Posted February 2, 2017 Author Share Posted February 2, 2017 1 hour ago, Bonsai said: Its not working because you need to rename the "onResourceStart" event to the clientside version "onClientResourceStart" at least. :O u bons why didn't u tell me when I ask before.. U nab -NM 1 Link to comment
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