sphinx-dev-oss Posted June 20, 2021 Posted June 20, 2021 Hi everyone! Someone did help me? I want warp the player into vehicle with hitmarker, but didn't work for me why? My Script (Server side): addEventHandler("onMarkerHit", resourceRoot, function(hitElement, mDim, thePlayer) if (mDim) then if (source == jobMarker) then if (getElementType(hitElement) == "player") then if not ( getElementData(hitElement, "jobVehicle") ) then local isVehicle = false; for i, spot in pairs(vehicleSpots) do local vehicleInSpot = getElementsWithinColShape(spot[4], "vehicle"); if not (#vehicleInSpot > 0) then local jobVehicle = createVehicle(deliveryVehicles[math.random(1)], spot[1], spot[2], spot[3]); setElementData(hitElement, "jobVehicle", jobVehicle); setElementRotation(jobVehicle, 0, 0, -90) local jobVehBlip = createBlipAttachedTo(jobVehicle, 55) warpPedIntoVehicle(thePlayer, jobVehicle) outputChatBox("[#1FDBB7Deixo#ffffff]: A járműved #00FF00készen#ffffff áll!", hitElement, 255, 255, 255, true); isVehicle = true; break; end end if not (isVehicle) then outputChatBox("[#1FDBB7Deixo#ffffff]:#FF0000 Nincs szabad hely.#ffffff Várj egy keveset!", hitElement, 255, 255, 255, true); end else outputChatBox("[#1FDBB7Deixo#ffffff]:#FF0000 Már van járműved!#ffffff Keresd meg és menj azzal!", hitElement, 255, 255, 255, true); end end end end end ); 1
RavenLoad Posted June 20, 2021 Posted June 20, 2021 What is /debugscript 3 saying? ------------------------------------------- Try this: warpPedIntoVehicle(thePlayer, jobVehicle, 0) Available client side from 1.3.1 (It will only work with client side vehicles and peds)
sphinx-dev-oss Posted June 20, 2021 Author Posted June 20, 2021 @RavenLoad It didn't work. debugscript say: WARNING: [DEIXO]\[JOBS]\dx_delivery\server.lua:28: Bad argument @ 'warpPedIntoVehicle' [Expected ped at argument 1, got nil]
RavenLoad Posted June 20, 2021 Posted June 20, 2021 Maybe with only player? warpPedIntoVehicle(player, jobVehicle) And mta Wiki say that it only work with client side not server side vehicle
sphinx-dev-oss Posted June 20, 2021 Author Posted June 20, 2021 it not work, but i try client side so client side, no error and i dont warp in vehicle
RavenLoad Posted June 20, 2021 Posted June 20, 2021 Or you can try it with an clientside lua and triggerClientEvent https://wiki.multitheftauto.com/wiki/TriggerClientEvent
sphinx-dev-oss Posted June 20, 2021 Author Posted June 20, 2021 so another one problem here. WARNING: [DEIXO]\[JOBS]\dx_delivery\server.lua:25: Bad argument @ 'triggerClientEvent' [Expected string at argument 1, got nil] Server side: addEventHandler("onMarkerHit", resourceRoot, function(hitElement, mDim, Player) if (mDim) then if (source == jobMarker) then if (getElementType(hitElement) == "player") then if not ( getElementData(hitElement, "jobVehicle") ) then local isVehicle = false; for i, spot in pairs(vehicleSpots) do local vehicleInSpot = getElementsWithinColShape(spot[4], "vehicle"); if not (#vehicleInSpot > 0) then local jobVehicle = createVehicle(deliveryVehicles[math.random(1)], spot[1], spot[2], spot[3]); --Trigger Client here --> triggerClientEvent(Player, "warpPlrTVeh") setElementData(hitElement, "jobVehicle", jobVehicle); setElementRotation(jobVehicle, 0, 0, -90) local jobVehBlip = createBlipAttachedTo(jobVehicle, 55) outputChatBox("[#1FDBB7Deixo#ffffff]: A járműved #00FF00készen#ffffff áll!", hitElement, 255, 255, 255, true); isVehicle = true; break; end end if not (isVehicle) then outputChatBox("[#1FDBB7Deixo#ffffff]:#FF0000 Nincs szabad hely.#ffffff Várj egy keveset!", hitElement, 255, 255, 255, true); end else outputChatBox("[#1FDBB7Deixo#ffffff]:#FF0000 Már van járműved!#ffffff Keresd meg és menj azzal!", hitElement, 255, 255, 255, true); end end end end end ); Client side: addEventHandler("warpPlrTVeh", localPlayer, function(localPlayer) warpPedIntoVehicle(localPlayer, "jobVehicle") end )
βurak Posted June 21, 2021 Posted June 21, 2021 (edited) hello you don't need to use event, change thePlayer to hitElement in your first code and of course delete thePlayer from the parameter warpPedIntoVehicle(hitElement, jobVehicle) Edited June 21, 2021 by Burak5312
sphinx-dev-oss Posted June 21, 2021 Author Posted June 21, 2021 @Burak5312 Thanks for help, and i try it It did it work! Thank you so much help @Burak5312and@RavenLoad
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