Peti930 Posted May 10, 2018 Share Posted May 10, 2018 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 Patrick Posted May 10, 2018 Moderators Share Posted May 10, 2018 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
Peti930 Posted May 10, 2018 Author Share Posted May 10, 2018 [igazítottam/ im corrigated ] Now it says: WARNING: spoileruj/sp.lua:1: Bad argument @ 'bindKey' [Expected string at argument 1, got nil] Link to comment
PatrykAdam Posted May 10, 2018 Share Posted May 10, 2018 (edited) 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 May 10, 2018 by PatrykAdam Link to comment
Peti930 Posted May 10, 2018 Author Share Posted May 10, 2018 'end' expected near <eof> :C Link to comment
PatrykAdam Posted May 10, 2018 Share Posted May 10, 2018 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
Peti930 Posted May 10, 2018 Author Share Posted May 10, 2018 again, end expected near <eof> Link to comment
myonlake Posted May 10, 2018 Share Posted May 10, 2018 (edited) 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 May 10, 2018 by myonlake Link to comment
PatrykAdam Posted May 10, 2018 Share Posted May 10, 2018 9 minutes ago, Peti930 said: again, end expected near <eof> Not possible. Link to comment
Peti930 Posted May 10, 2018 Author Share Posted May 10, 2018 (edited) client or server sided?xd i been lost the line Edited May 10, 2018 by Peti930 Link to comment
myonlake Posted May 10, 2018 Share Posted May 10, 2018 Just now, Peti930 said: client or server sided?xd getVehicleComponentPosition and setVehicleComponentPosition are client-side functions, this code must be run client-side, obviously. Link to comment
Peti930 Posted May 10, 2018 Author Share Posted May 10, 2018 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
itHyperoX Posted May 11, 2018 Share Posted May 11, 2018 I'm sure this is not your code. If you don't know what you can use on server / client side, you can not make a moving spoiler script :). 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