Jump to content

[HELP] <eof> problem


Peti930

Recommended Posts

Hi i have this script, and debugscript 3 says: error: <eof> expected near 'end". Can anyone help me?

 

 

function spoilernyit()  
	if getElementModel(theVeh) == 502 then
                local sX, sY, sZ = getVehicleComponentPosition(theVeh, "movspoiler_24.0_5200")
                    if sZ < 0.6 then
                        setVehicleComponentPosition(theVeh, "movspoiler_24.0_5200", sX, sY-0.004, sZ+0.005)
                    end
                    elseif sZ > 0.45 then
                        setVehicleComponentPosition(theVeh, "movspoiler_24.0_5200", sX, sY+0.008, sZ-0.01)
                    end
                end
            end
        end
    end
end
bindKey ( thePlayer, "Num_5", "down" , spoilernyit)

 

Link to comment
  • Moderators

Ne zárd le az IF-et, ha ELSEIF-et adsz meg.
 

                    if sZ < 0.6 then
                        setVehicleComponentPosition(theVeh, "movspoiler_24.0_5200", sX, sY-0.004, sZ+0.005)
                    elseif sZ > 0.45 then
                        setVehicleComponentPosition(theVeh, "movspoiler_24.0_5200", sX, sY+0.008, sZ-0.01)
                    end

 

Link to comment

 

function spoilernyit()
    local theVeh = getPedOccupiedVehicle( localPlayer )
	if getElementModel(theVeh) == 502 then
        local sX, sY, sZ = getVehicleComponentPosition(theVeh, "movspoiler_24.0_5200")
        if sZ < 0.6 then
            setVehicleComponentPosition(theVeh, "movspoiler_24.0_5200", sX, sY-0.004, sZ+0.005)
        end
        elseif sZ > 0.45 then
            setVehicleComponentPosition(theVeh, "movspoiler_24.0_5200", sX, sY+0.008, sZ-0.01)
        end
    end
end
bindKey ( "num_5", "down" , spoilernyit)

 

Edited by PatrykAdam
Link to comment

 

function spoilernyit()
    local theVeh = getPedOccupiedVehicle( localPlayer )
	if getElementModel(theVeh) == 502 then
        local sX, sY, sZ = getVehicleComponentPosition(theVeh, "movspoiler_24.0_5200")
        if sZ < 0.6 then
            setVehicleComponentPosition(theVeh, "movspoiler_24.0_5200", sX, sY-0.004, sZ+0.005)
        elseif sZ > 0.45 then
            setVehicleComponentPosition(theVeh, "movspoiler_24.0_5200", sX, sY+0.008, sZ-0.01)
        end
    end
end
bindKey ( "Num_5", "down" , spoilernyit)

 

Link to comment

Your indentation is completely messed up. Also, there's no component with the name of movspoiler_24.0_5200, but I guess you know what you're doing.

Also, note that theVeh has not been defined. If you want the current vehicle, add getPedOccupiedVehicle.

function spoilernyit( )
	if getElementModel( theVeh ) == 502 then
		local sX, sY, sZ = getVehicleComponentPosition( theVeh, "movspoiler_24.0_5200" )

		if sZ < 0.6 then
			setVehicleComponentPosition( theVeh, "movspoiler_24.0_5200", sX, sY - 0.004, sZ + 0.005 )
		elseif sZ > 0.45 then
			setVehicleComponentPosition( theVeh, "movspoiler_24.0_5200", sX, sY + 0.008, sZ - 0.01 )
		end
	end
end

bindKey( "num_5", "down", spoilernyit ) -- Removed thePlayer, since you don't have that on client-side

 

Edited by myonlake
Link to comment

can you get involved with this?

function spoilernyit()
            if getElementModel(theVeh) == 502 then
                local sX, sY, sZ = getVehicleComponentPosition(theVeh, "movspoiler_24.0_5200")
                if spd >= 100 then
                    if sZ < 0.6 then
                        setVehicleComponentPosition(theVeh, "movspoiler_24.0_5200", sX, sY-0.004, sZ+0.005)
                    end
                elseif spd < 100 then
                    if sZ > 0.45 then
                        setVehicleComponentPosition(theVeh, "movspoiler_24.0_5200", sX, sY+0.008, sZ-0.01)
                    end
                end
            elseif getElementModel(theVeh) == 506 then
                local sX, sY, sZ = getVehicleComponentPosition(theVeh, "movspoiler_23.5_1800")
                if spd >= 100 then
                    if sZ < 1.2 then
                        setVehicleComponentPosition(theVeh, "movspoiler_23.5_1800", sX, sY-0.006, sZ+0.005)
                    end
                elseif spd < 100 then
                    if sZ > 1 then
                        setVehicleComponentPosition(theVeh, "movspoiler_23.5_1800", sX, sY+0.012, sZ-0.01)
                    end
                end
            end
        end
    end
end
addEventHandler("onClientRender", root, spoilernyit)

 

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...