Jump to content

[HELP]


Recommended Posts

Hi! I want to make a script like this: When you press '2' the engine will start and the sound too. There is my script and have 2 problems: 

1.SCRIPT ERROR: OffEngine\server.lua:17: '<eof>' expected near 'end'
 ERROR: Loading script failed: OffEngine\server.lua:17: '<eof>' expected near 'end'

2. ERROR: Client (#ff8000Name) triggered serverside event motor_event, but event is not added serverside

EDIT: Error 1, server.lua:17 is the last 'end' from Server Side

There is my Script:

Server Side:

function motor_fonskiyon()
local arac = getPedOccupiedVehicle(source)
if arac then
local aracadi = getVehicleName(arac)
if getVehicleEngineState(arac) == false then
setVehicleEngineState(arac, true)
outputChatBox("Engine on. Car: ["..aracadi.."]", source, 0, 153, 51, true)
startSound = playSound("files/starter.mp3", false)
elseif getVehicleEngineState(arac) == true then
setVehicleEngineState(arac, false)
outputChatBox("Engine off. Car: ["..aracadi.."]", source, 0, 153, 51, true)
end
end
end
end
addEvent("motor_event", true)
addEventHandler("motor_event", getRootElement(), motor_fonskiyon)

Meta.XML

<meta>
<info author="Name" name="Engine" version="1" type="script"/>

<script src="client.lua" type="client" cache="false"/>
<script src="server.lua" type="server"/>
<file src="files/starter.mp3" />
</meta>

Client Side:

Quote


bindler = {

 motor = "2", --//Motor Oprit

}

bindKey(bindler.motor,"down",
function()
if getPedOccupiedVehicleSeat (localPlayer)== 0 then
triggerServerEvent("motor_event", getLocalPlayer())
end
end)
 

 

I would be grateful if you could help me! Thanks :) 

Link to comment
function motor_fonskiyon()
local arac = getPedOccupiedVehicle(source)
if arac then
local aracadi = getVehicleName(arac)
if getVehicleEngineState(arac) == false then
setVehicleEngineState(arac, true)
outputChatBox("Engine on. Car: ["..aracadi.."]", source, 0, 153, 51, true)
startSound = playSound("files/starter.mp3", false)
elseif getVehicleEngineState(arac) == true then
setVehicleEngineState(arac, false)
outputChatBox("Engine off. Car: ["..aracadi.."]", source, 0, 153, 51, true)
end
end
end
end
addEvent("motor_event", true)
addEventHandler("motor_event", getRootElement(), motor_fonskiyon)

Take away one "end"


Try

 

function motor_fonskiyon()
	local arac = getPedOccupiedVehicle(source)
	if arac then
		local aracadi = getVehicleName(arac)
		if getVehicleEngineState(arac) == false then
			setVehicleEngineState(arac, true)
			outputChatBox("Engine on. Car: ["..aracadi.."]", source, 0, 153, 51, true)
			startSound = playSound("files/starter.mp3", false)
		elseif getVehicleEngineState(arac) == true then
			setVehicleEngineState(arac, false)
			outputChatBox("Engine off. Car: ["..aracadi.."]", source, 0, 153, 51, true)
		end
	end
end
addEvent("motor_event", true)
addEventHandler("motor_event", getRootElement(), motor_fonskiyon)

 

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