CobbTheWarriorsRPG Posted May 13, 2013 Share Posted May 13, 2013 hello i am making this script,When you click on the button you get a vehicle but they doesnt work see the code client.lua function vehicle(thePlayer) local x,y,z = getElementPosition(thePlayer) veh = createVehicle(449, x,y,z) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , vehicle, false) hope you can help me Link to comment
iPrestege Posted May 13, 2013 Share Posted May 13, 2013 1- The create vehicle on the client side is a fake vehicle 2- thePlayer not defined should to be a localPlayer element . Link to comment
xXMADEXx Posted May 13, 2013 Share Posted May 13, 2013 Make sure you know how the client side scripts work... function vehicle() if (source==GUIEditor_Button[1]) then local x,y,z = getElementPosition(localPlayer) veh = createVehicle(449, x,y,z) end end addEventHandler("onClientGUIClick", root , vehicle) Link to comment
CobbTheWarriorsRPG Posted May 14, 2013 Author Share Posted May 14, 2013 All thank you,but i have a question,in the vehicle on client side its a fake vehicle,How can i make the server side? I am learning but is a chaos trying to learn whit my bad english,Can you explain me? thanks (Y) Link to comment
iPrestege Posted May 14, 2013 Share Posted May 14, 2013 -- # Client Side triggerServerEvent -- # Server Side addEvent addEventHandler getElementPosition createVehicle Link to comment
CobbTheWarriorsRPG Posted May 14, 2013 Author Share Posted May 14, 2013 So the serverside must be like this server.lua function createvehicle() if (source==GUIEditor_Button[1]) then local x,y,z = getElementPosition(localPlayer) veh = createVehicle(449, x,y,z) end end addEvent( "onClick", true ) addEventHandler("onClientGUIClick", root , vehicle) client.lua function createVehicle () triggerServerEvent ( "onClick", getLocalPlayer() ) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , createVehicle, false) Link to comment
iPrestege Posted May 14, 2013 Share Posted May 14, 2013 (edited) -- # Server Side function vehicle( ) local x,y,z = getElementPosition(source) veh = createVehicle(449, x,y,z) end addEvent( "onClick", true ) addEventHandler("onClick", root , vehicle) -- # Client Side function triggerToServer ( ) triggerServerEvent ( "onClick", getLocalPlayer() ) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , triggerToServer, false) Edited May 14, 2013 by Guest Link to comment
CobbTheWarriorsRPG Posted May 14, 2013 Author Share Posted May 14, 2013 Thanks a lot,But the vehicle doesnt spawn Link to comment
iPrestege Posted May 14, 2013 Share Posted May 14, 2013 Oh,Fuck copy it again forget something ! Link to comment
CobbTheWarriorsRPG Posted May 14, 2013 Author Share Posted May 14, 2013 Nope Dont apear the vehicle Link to comment
iPrestege Posted May 14, 2013 Share Posted May 14, 2013 Lol no am not nope you know what's the problem? The entered vehicle id it is not exist ! ! Link to comment
CobbTheWarriorsRPG Posted May 14, 2013 Author Share Posted May 14, 2013 hahahaha sheet its 448 ! A lot of thanks Mr.Prestege 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