Jump to content

[HELP] warpPedIntoVehicle error


BenceDev

Recommended Posts

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
);

 

  • Like 1
Link to comment

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(hitElementmDimPlayer)
        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 > 0then
                                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, 00, -90)
                                local jobVehBlip = createBlipAttachedTo(jobVehicle, 55)
                                outputChatBox("[#1FDBB7Deixo#ffffff]: A járműved #00FF00készen#ffffff áll!", hitElement, 255255255true);
                                isVehicle = true;
                                break;
                            end
                        end
                        
                        if not (isVehicle) then
                            outputChatBox("[#1FDBB7Deixo#ffffff]:#FF0000 Nincs szabad hely.#ffffff Várj egy keveset!", hitElement, 255255255true);
                        end
                    else
                        outputChatBox("[#1FDBB7Deixo#ffffff]:#FF0000 Már van járműved!#ffffff Keresd meg és menj azzal!", hitElement, 255255255true);
                    end
                end
            end
        end
    end
);


Client side:

addEventHandler("warpPlrTVeh", localPlayer,
    function(localPlayer)
        warpPedIntoVehicle(localPlayer, "jobVehicle")
    end
)
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...