harryh Posted March 29, 2017 Share Posted March 29, 2017 I wrote this script to create water but I get no errors and nothing happens. local aw1 = {} local aw2 = {} local aw3 = {} local aw4 = {} function createAllWater() --x, y, z theWater = createWater(609, 151, -100, 609, -606, -100, 1527, 129, 4, 1527, -533, 4) setWaterLevel(theWater, 1) if theWater then print("Water is work") print(theWater) end end addEventHandler( "onClientResourceStart", getRootElement(), createAllWater ) function helpwater() outputChatBox( "aw1 = bottom left" ) outputChatBox( "aw2 = bottom right" ) outputChatBox( "aw3 = top right" ) outputChatBox( "aw4 = top left" ) end addCommandHandler("helpmew", helpwater) function addwater1(player, cmd) local x, y, z = getElementPosition( player ) table.insert(aw1, x) table.insert(aw1, y) table.insert(aw1, z) outputChatBox( "Position 1 set" ) end addCommandHandler( "aw1", addwater1) function addwater2(player, cmd) if aw1[1] == nil then outputChatBox( "Use in order please. /aw1 /aw2 /aw3 [/aw4] optional." ) else local x, y, z = getElementPosition( player ) table.insert(aw2, x) table.insert(aw2, y) table.insert(aw2, z) outputChatBox( "Position 2 set" ) end end addCommandHandler( "aw2", addwater2) function addwater3(player, cmd) if aw2[1] == nil then print("/aw1 /aw2 /aw3 /aw4") else local x, y, z = getElementPosition( player ) table.insert(aw3, x) table.insert(aw3, y) table.insert(aw3, z) print(x) print(y) print(z) outputChatBox( "Position 3 set" ) end end addCommandHandler( "aw3", addwater3) function addwater4(player, cmd) local x, y, z = getElementPosition( player ) table.insert(aw4, x) table.insert(aw4, y) table.insert(aw4, z) outputChatBox( "Position 4 set" ) end addCommandHandler( "aw4", addwater4) function completeWater(player, cmd) if aw1[1] == nil then outputChatBox("Need to do first 3. /aw1 /aw2 /aw3 ") aw1 = {} aw2 = {} aw3 = {} aw4 = {} elseif aw4[1] == nil then outputChatBox("Triangle Maded.") createWater( aw1[1], aw1[2], aw1[3], aw2[1], aw2[2], aw2[3], aw3[1], aw3[2], aw3[3]) aw1 = {} aw2 = {} aw3 = {} aw4 = {} else Awater = createWater( 0,0,0,0,0,0,0,0,0,0,0,0) setWaterVertexPosition( water, 1, aw1[1], aw1[2], aw1[3] ) setWaterVertexPosition( water, 2, aw2[1], aw2[2], aw2[3] ) setWaterVertexPosition( water, 3, aw3[1], aw3[2], aw3[3] ) setWaterVertexPosition( water, 4, aw4[1], aw4[2], aw4[3] ) outputChatBox("Square Maded.") aw1 = {} aw2 = {} aw3 = {} aw4 = {} end end addCommandHandler("awc", completeWater) Link to comment
Blaawee Posted March 29, 2017 Share Posted March 29, 2017 You're mixing client and server functions together. Link to comment
harryh Posted March 30, 2017 Author Share Posted March 30, 2017 no error just no water they are shared so it doesn't matter are in both Link to comment
Master_MTA Posted March 30, 2017 Share Posted March 30, 2017 (edited) 1 hour ago, harryh said: no error just no water they are shared so it doesn't matter are in both you should review the addCommandHandler parameters in client side u use localplayer it's not like server side in the client side the first parameters is command name Edited March 30, 2017 by Master_MTA Link to comment
Administrators Lpsd Posted March 30, 2017 Administrators Share Posted March 30, 2017 (edited) Serverside: local aw1 = {} local aw2 = {} local aw3 = {} local aw4 = {} function createAllWater() --x, y, z theWater = createWater(609, 151, -100, 609, -606, -100, 1527, 129, 4, 1527, -533, 4) setWaterLevel(1, theWater) if theWater then print("Water is work") print(theWater) end end addEventHandler( "onResourceStart", getRootElement(), createAllWater ) function helpwater() outputChatBox( "aw1 = bottom left" ) outputChatBox( "aw2 = bottom right" ) outputChatBox( "aw3 = top right" ) outputChatBox( "aw4 = top left" ) end addCommandHandler("helpmew", helpwater) function addwater1(player, cmd) local x, y, z = getElementPosition( player ) table.insert(aw1, x) table.insert(aw1, y) table.insert(aw1, z) print(x) print(y) print(z) outputChatBox( "Position 1 set" ) end addCommandHandler( "aw1", addwater1) function addwater2(player, cmd) if aw1[1] == nil then outputChatBox( "Use in order please. /aw1 /aw2 /aw3 [/aw4] optional." ) else local x, y, z = getElementPosition( player ) table.insert(aw2, x) table.insert(aw2, y) table.insert(aw2, z) print(x) print(y) print(z) outputChatBox( "Position 2 set" ) end end addCommandHandler( "aw2", addwater2) function addwater3(player, cmd) if aw2[1] == nil then print("/aw1 /aw2 /aw3 /aw4") else local x, y, z = getElementPosition( player ) table.insert(aw3, x) table.insert(aw3, y) table.insert(aw3, z) print(x) print(y) print(z) outputChatBox( "Position 3 set" ) end end addCommandHandler( "aw3", addwater3) function addwater4(player, cmd) local x, y, z = getElementPosition( player ) table.insert(aw4, x) table.insert(aw4, y) table.insert(aw4, z) print(x) print(y) print(z) outputChatBox( "Position 4 set" ) end addCommandHandler( "aw4", addwater4) function completeWater(player, cmd) if aw1[1] == nil then outputChatBox("Need to do first 3. /aw1 /aw2 /aw3 ") aw1 = {} aw2 = {} aw3 = {} aw4 = {} elseif aw4[1] == nil then outputChatBox("Triangle Maded.") local thisWater = createWater( aw1[1], aw1[2], aw1[3], aw2[1], aw2[2], aw2[3], aw3[1], aw3[2], aw3[3]) triggerClientEvent ( getRootElement(), "setWater", getRootElement(), thisWater ) aw1 = {} aw2 = {} aw3 = {} aw4 = {} else local thisWater = createWater( aw1[1], aw1[2], aw1[3], aw2[1], aw2[2], aw2[3], aw3[1], aw3[2], aw3[3], aw4[1], aw4[2], aw4[3]) triggerClientEvent ( getRootElement(), "setWater", getRootElement(), thisWater ) outputChatBox("Square Maded.") aw1 = {} aw2 = {} aw3 = {} aw4 = {} end end addCommandHandler("awc", completeWater) Clientside: function setWaterHeight(water) setWaterLevel(water, 20) end addEvent("setWater", true) addEventHandler("setWater", getRootElement(), setWaterHeight) Only works for the triangle water though. Square isn't working. I'll update if I find out why. Change '20' on the clientside script for the height you want. Edited March 30, 2017 by LopSided_ 1 Link to comment
harryh Posted April 3, 2017 Author Share Posted April 3, 2017 On 30/03/2017 at 17:54, LopSided_ said: Serverside: local aw1 = {} local aw2 = {} local aw3 = {} local aw4 = {} function createAllWater() --x, y, z theWater = createWater(609, 151, -100, 609, -606, -100, 1527, 129, 4, 1527, -533, 4) setWaterLevel(1, theWater) if theWater then print("Water is work") print(theWater) end end addEventHandler( "onResourceStart", getRootElement(), createAllWater ) function helpwater() outputChatBox( "aw1 = bottom left" ) outputChatBox( "aw2 = bottom right" ) outputChatBox( "aw3 = top right" ) outputChatBox( "aw4 = top left" ) end addCommandHandler("helpmew", helpwater) function addwater1(player, cmd) local x, y, z = getElementPosition( player ) table.insert(aw1, x) table.insert(aw1, y) table.insert(aw1, z) print(x) print(y) print(z) outputChatBox( "Position 1 set" ) end addCommandHandler( "aw1", addwater1) function addwater2(player, cmd) if aw1[1] == nil then outputChatBox( "Use in order please. /aw1 /aw2 /aw3 [/aw4] optional." ) else local x, y, z = getElementPosition( player ) table.insert(aw2, x) table.insert(aw2, y) table.insert(aw2, z) print(x) print(y) print(z) outputChatBox( "Position 2 set" ) end end addCommandHandler( "aw2", addwater2) function addwater3(player, cmd) if aw2[1] == nil then print("/aw1 /aw2 /aw3 /aw4") else local x, y, z = getElementPosition( player ) table.insert(aw3, x) table.insert(aw3, y) table.insert(aw3, z) print(x) print(y) print(z) outputChatBox( "Position 3 set" ) end end addCommandHandler( "aw3", addwater3) function addwater4(player, cmd) local x, y, z = getElementPosition( player ) table.insert(aw4, x) table.insert(aw4, y) table.insert(aw4, z) print(x) print(y) print(z) outputChatBox( "Position 4 set" ) end addCommandHandler( "aw4", addwater4) function completeWater(player, cmd) if aw1[1] == nil then outputChatBox("Need to do first 3. /aw1 /aw2 /aw3 ") aw1 = {} aw2 = {} aw3 = {} aw4 = {} elseif aw4[1] == nil then outputChatBox("Triangle Maded.") local thisWater = createWater( aw1[1], aw1[2], aw1[3], aw2[1], aw2[2], aw2[3], aw3[1], aw3[2], aw3[3]) triggerClientEvent ( getRootElement(), "setWater", getRootElement(), thisWater ) aw1 = {} aw2 = {} aw3 = {} aw4 = {} else local thisWater = createWater( aw1[1], aw1[2], aw1[3], aw2[1], aw2[2], aw2[3], aw3[1], aw3[2], aw3[3], aw4[1], aw4[2], aw4[3]) triggerClientEvent ( getRootElement(), "setWater", getRootElement(), thisWater ) outputChatBox("Square Maded.") aw1 = {} aw2 = {} aw3 = {} aw4 = {} end end addCommandHandler("awc", completeWater) Clientside: function setWaterHeight(water) setWaterLevel(water, 20) end addEvent("setWater", true) addEventHandler("setWater", getRootElement(), setWaterHeight) Only works for the triangle water though. Square isn't working. I'll update if I find out why. Change '20' on the clientside script for the height you want. Still doesnt work anyone ? 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