RaceXtreme Posted September 1, 2010 Share Posted September 1, 2010 Hey gice, im new here in the forum. Who dont know me im RaceXtreme and i play MTA about 3.5 years. So... Im trying to do a server-side script that change the gravity of the car when the player hits the marker. When this happend the player will run on the wall of the build. I did a code here and i want to know if it is correct: local Marker = createMarker ( 724.4444, -3318.2453, 322.6392, "cylinder", 5, 255, 140, 0, 255 ) function MarkerHit ( player ) local veh = getPedOccupiedVehicle(player) if (veh) then setVehicleGravity ( veh, 734.1802, -3325.3698, 339.8891 ) end end addEventHandler( "onMarkerHit", Marker, MarkerHit ) Thx gice Link to comment
Castillo Posted September 1, 2010 Share Posted September 1, 2010 setVehicleGravity dosn't exist, check wiki again for gravity functions. Link to comment
RaceXtreme Posted September 1, 2010 Author Share Posted September 1, 2010 Here: https://wiki.multitheftauto.com/wiki/SetVehicleGravity Link to comment
Castillo Posted September 1, 2010 Share Posted September 1, 2010 Here: https://wiki.multitheftauto.com/wiki/SetVehicleGravity oh sorry, my bad i didn't saw it. Link to comment
RaceXtreme Posted September 1, 2010 Author Share Posted September 1, 2010 Can you help mee plzzz. Link to comment
Castillo Posted September 1, 2010 Share Posted September 1, 2010 Can you help mee plzzz. Hmmm, i think this function its only client side and that would mean that won't work at server side script. Link to comment
dzek (varez) Posted September 1, 2010 Share Posted September 1, 2010 even heard about Debugging ? This throws error for sure, and you just can't miss it! setVehicleGravity is client-side server side setVehicleGravity: -- server side code function setVehicleGravity(veh, x,y,z) if (isElement(veh) and getElementType(veh)=='vehicle' and x~=nil and y~=nil and z~=nil) then triggerClientEvent(getRootElement(), "setVehGrav", veh, x, y, z) return true else return false end end -- client side code: addEvent("setVehGrav", true) addEventHandler("setVehGrav", getRootElement(), function(x,y,z) setVehicleGravity(source,x,y,z) end ) after you put this code, you can use setVehicleGravity server side Link to comment
RaceXtreme Posted September 1, 2010 Author Share Posted September 1, 2010 Thats anything wrong on my code? ( Only to be sure ) And thx Another thing... I tryied to run this code on race resource but it didnt work, bacause when i hit the marker dont happend nothing. On the server side works but on client i tryied the same code but with some changes. The marker creats but when i hit it dont happend anything. function markerHit ( thePlayer ) if (thePlayer==getLocalPlayer()) then outputChatBox ( "Hello?" ) -- This happend local veh = getPedOccupiedVehicle( player ) setVehicleGravity ( veh, 734.1802, -3325.3698, 339.8891 ) -- But this no. And it is on client-side. end end addEventHandler( "onClientResourceStart", resourceRoot, startclient ) I want that the car runs on the wall but it dosent works. Link to comment
dzek (varez) Posted September 1, 2010 Share Posted September 1, 2010 734.1802, -3325.3698, 339.8891 --- wtf is this? these values probably will crash clients. check wiki page for more info 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