Genius Posted May 26, 2012 Posted May 26, 2012 When i take job then car is spawned but i cant get in the vehicle /debugscript 3 nothing Can someone fix it pls! carjacker = createMarker( 2055.6, -1769.3, 13.5,"cylinder",1.5,0,0,0,0 ) local carjackerTable = { {826,858.9,12}; {579.9,1220.2,11.7}; {65,-275,1.5}; {1673.6, -37.6,3.5}; {-540.6,-497.7,25.5}; {2783.8,-2418.2,13.6}; } function unpackCarjacker () return unpack ( carjackerTable [ math.random ( #carjackerTable ) ] ) end function createCarrou (hitPlayer) if hitPlayer and hitPlayer == localPlayer then x, y, z = unpackCarjacker() carBlip = createBlipAttachedTo ( vehicle, 32 ) vehicle = createVehicle ( 541,x, y, z ) addEventHandler ( "onClientVehicleEnter", vehicle, carHit ) end end addEventHandler ( "onClientMarkerHit", carjacker, createCarrou ) function carHit ( hitPlayer ) carmarker = createMarker( 0,0,0, "cylinder", 3, 250, 250, 90 ) addEventHandler ("onClientMarkerHit", carmarker, functio ) end function functio ( hitElement ) if ( not isPedInVehicle ( localPlayer ) and hitElement == localPlayer ) then triggerServerEvent ( "carmoney", localPlayer ) destroyElement ( vehicle ) destroyElement ( carBlip ) destroyElement ( marker ) createRoute() end end function functi () cancelEvent () end addEventHandler ( "onClientPedDamage", resourceRoot, functi ) MTA Scripter. If you want scripter PM me and i will accept every job for fair price.
kaos057 Posted May 26, 2012 Posted May 26, 2012 put line 22 before line 21. if that doesnt work comment out line 23 and see if that allows you to enter. I think switching the lines should work though because you are trying to use the variable "vehicle" before it is assigned.
Genius Posted May 26, 2012 Author Posted May 26, 2012 I made that but dont work MTA Scripter. If you want scripter PM me and i will accept every job for fair price.
Jaysds1 Posted May 26, 2012 Posted May 26, 2012 try this: carjacker = createMarker( 2055.6, -1769.3, 13.5,"cylinder",1.5,0,0,0,0 ) local carjackerTable = { {826,858.9,12}; {579.9,1220.2,11.7}; {65,-275,1.5}; {1673.6, -37.6,3.5}; {-540.6,-497.7,25.5}; {2783.8,-2418.2,13.6}; } function createCarrou (hitPlayer) if getElementType(hitPlayer)=="player" and hitPlayer == localPlayer then x, y, z = unpack ( carjackerTable [ math.random ( #carjackerTable ) ] ) vehicle = createVehicle ( 541,x, y, z ) carBlip = createBlipAttachedTo ( vehicle, 32 ) --create a blip after the car is created addEventHandler ( "onClientVehicleEnter", vehicle, carHit ) end end addEventHandler ( "onClientMarkerHit", carjacker, createCarrou ) function carHit ( hitPlayer ) carmarker = createMarker( 0,0,0, "cylinder", 3, 250, 250, 90 ) addEventHandler ("onClientMarkerHit", carmarker, functio ) end function functio ( hitElement ) if ( hitElement == localPlayer ) then if(not isPedInVehicle ( localPlayer ))then triggerServerEvent ( "carmoney", localPlayer ) destroyElement ( vehicle ) destroyElement ( carBlip ) destroyElement ( marker ) createRoute() end end end function functi () cancelEvent () end addEventHandler ( "onClientPedDamage",root, functi ) --it's root not resource root My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
Genius Posted May 26, 2012 Author Posted May 26, 2012 Dont work Jaysds1 MTA Scripter. If you want scripter PM me and i will accept every job for fair price.
Jaysds1 Posted May 26, 2012 Posted May 26, 2012 try stopping the resource and see if you could enter the vehicle My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
Genius Posted May 26, 2012 Author Posted May 26, 2012 try stopping the resource and see if you could enter the vehicle I can enter the vehicle. MTA Scripter. If you want scripter PM me and i will accept every job for fair price.
Jaysds1 Posted May 26, 2012 Posted May 26, 2012 Did you restart the resource with the current script I gave you? My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
Genius Posted May 26, 2012 Author Posted May 26, 2012 Did you restart the resource with the current script I gave you? Yes MTA Scripter. If you want scripter PM me and i will accept every job for fair price.
Jaysds1 Posted May 26, 2012 Posted May 26, 2012 (edited) ok, try this: carjacker = createMarker( 2055.6, -1769.3, 13.5,"cylinder",1.5,0,0,0,0 ) local carjackerTable = { {826,858.9,12}, --if your making another line of table, use a comma , if your ending the table, then use that semicolon {579.9,1220.2,11.7}, {65,-275,1.5}, {1673.6, -37.6,3.5}, {-540.6,-497.7,25.5}, {2783.8,-2418.2,13.6}; } function createCarrou (hitPlayer) if(getElementType(hitPlayer)=="player")and(hitPlayer==localPlayer)then local x, y, z = unpack ( carjackerTable [ math.random ( #carjackerTable ) ] ) vehicle = createVehicle ( 541,x, y, z ) carBlip = createBlipAttachedTo ( vehicle, 32 ) --create a blip after the car is created setElementData(hitPlayer,"Car",vehicle) end end addEventHandler ( "onClientMarkerHit", carjacker, createCarrou ) function carHit (player) if(getElementData(player,"Car")==source)then carmarker = createMarker( 0,0,0, "cylinder", 3, 250, 250, 90 ) addEventHandler ("onClientMarkerHit", carmarker, functio ) end end addEventHandler ( "onClientVehicleEnter",root, carHit ) function functio ( hitElement ) if ( hitElement == localPlayer ) then triggerServerEvent ( "carmoney", localPlayer ) destroyElement ( vehicle ) destroyElement ( carBlip ) destroyElement ( marker ) createRoute() end end addEventHandler ( "onClientPedDamage",root, cancelEvent) --it's root not resource root Edited May 26, 2012 by Guest My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
Genius Posted May 26, 2012 Author Posted May 26, 2012 Dont work MTA Scripter. If you want scripter PM me and i will accept every job for fair price.
Jaysds1 Posted May 26, 2012 Posted May 26, 2012 I've edited it again, try it My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
Genius Posted May 26, 2012 Author Posted May 26, 2012 I've edited it again, try it Again dont work MTA Scripter. If you want scripter PM me and i will accept every job for fair price.
kaos057 Posted May 26, 2012 Posted May 26, 2012 you sure theres not any other scripts that have anything canceling the onClientVehicleEnter event?
Genius Posted May 26, 2012 Author Posted May 26, 2012 you sure theres not any other scripts that have anything canceling the onClientVehicleEnter event? Yes MTA Scripter. If you want scripter PM me and i will accept every job for fair price.
Genius Posted May 26, 2012 Author Posted May 26, 2012 now in /debugscript said me addEventHandler "onClientVehicleDamage" with this function already handled MTA Scripter. If you want scripter PM me and i will accept every job for fair price.
Jaysds1 Posted May 26, 2012 Posted May 26, 2012 Post your Meta.xml and if you have any other scripts with this resource, I suggest posting it now, and for sure I know this isn't the full script My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
TAPL Posted May 26, 2012 Posted May 26, 2012 You can't enter any vehicle that created from client side, you have to create it server side.
Jaysds1 Posted May 26, 2012 Posted May 26, 2012 Where did this info came from? My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
Castillo Posted May 26, 2012 Posted May 26, 2012 Jaysd, what TAPL said is correct, if you try to, you'll notice that you cannot enter on them. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
TAPL Posted May 26, 2012 Posted May 26, 2012 Where did this info came from? from wiki https://wiki.multitheftauto.com/wiki/CreateVehicle Note: Vehicles (and other elements) created client-side are only seen by the client that created them, aren't synced and players cannot enter them. They are essentially for display only.
Jaysds1 Posted May 26, 2012 Posted May 26, 2012 oh, ok EDIT: Genuis, put this Server Sided: carjacker = createMarker( 2055.6, -1769.3, 13.5,"cylinder",1.5,0,0,0,0 ) local carjackerTable = { {826,858.9,12}, {579.9,1220.2,11.7}, {65,-275,1.5}, {1673.6, -37.6,3.5}, {-540.6,-497.7,25.5}, {2783.8,-2418.2,13.6}; } function createCarrou (hitPlayer) if (getElementType(hitPlayer)=="player") then local x, y, z = unpack ( carjackerTable [ math.random ( #carjackerTable ) ] ) vehicle = createVehicle ( 541,x, y, z ) carBlip = createBlipAttachedTo ( vehicle, 32 ) --create blip after the vehicle is created addEventHandler ( "onVehicleEnter", vehicle, carHit ) end end addEventHandler ( "onMarkerHit", carjacker, createCarrou ) function carHit(enterer) carmarker = createMarker( 0,0,0, "cylinder", 3, 250, 250, 90 ) addEventHandler ("onMarkerHit", carmarker, functio ) end function functio ( hitElement ) if ( getElementType(hitElement) == "player" ) then triggerEvent ( "carmoney", source ) destroyElement ( vehicle ) destroyElement ( carBlip ) destroyElement ( marker ) createRoute() --not sure what your going to do with this end end addEventHandler ( "onPedDamage", root, cancelEvent ) My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
Genius Posted May 26, 2012 Author Posted May 26, 2012 Solidsnake14 helped me by PM MTA Scripter. If you want scripter PM me and i will accept every job for fair price.
Jaysds1 Posted May 26, 2012 Posted May 26, 2012 ok, if you need any help with this script, remember to post it here instead of making another topic My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
Genius Posted May 26, 2012 Author Posted May 26, 2012 Ok np man MTA Scripter. If you want scripter PM me and i will accept every job for fair price.
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