Jump to content

ERROR : Loading script failed: nos\nitro.lua:17: unexpected symbol near ')'


Jani1337

Recommended Posts

Hi !
I just downloaded a simple script that puts NOS into cars when u hold fire.
I wanted to make it so it only works for selected serials but now i get this error :
ERROR : Loading script failed: nos\nitro.lua:17: unexpected symbol near ')'
Please help ! 
Attached code bellow :)
Engedelyezettserial means AllowedSerials :D

engedelyezettserial = {
	[""]=true, -- NoOne
	[""]=true,  -- Mili
	["9BC41DB2DB129348886FB6A5603433F2"]=true, -- Jani
}

g_Me = getLocalPlayer( );
g_Root = getRootElement( );
g_ResRoot = getResourceRootElement( );

addEventHandler( "onClientResourceStart", g_ResRoot,
	function( )
	if engedelyezettserial[getPlayerSerial(thePlayer)] then
		bindKey( "vehicle_fire", "both", toggleNOS );
		bindKey( "vehicle_secondary_fire", "both", toggleNOS );
	end
)

function toggleNOS( key, state )
	local veh = getPedOccupiedVehicle( g_Me );
	if engedelyezettserial[getPlayerSerial(thePlayer)] then
	if veh and not isEditingPosition then
		if state == "up" then
			removeVehicleUpgrade( veh, 1010 );
			setControlState( "vehicle_fire", false );
		else
			addVehicleUpgrade( veh, 1010 );
		end
	end
end

 

Link to comment

You're missing an end to close the function.

engedelyezettserial = {
	[""]=true, -- NoOne
	[""]=true,  -- Mili
	["9BC41DB2DB129348886FB6A5603433F2"]=true, -- Jani
}

g_Me = getLocalPlayer( );
g_Root = getRootElement( );
g_ResRoot = getResourceRootElement( );

addEventHandler( "onClientResourceStart", g_ResRoot,
	function( )
      if engedelyezettserial[getPlayerSerial(thePlayer)] then
          bindKey( "vehicle_fire", "both", toggleNOS );
          bindKey( "vehicle_secondary_fire", "both", toggleNOS );
      end --end of If
    end --end of Function
)

function toggleNOS( key, state )
	local veh = getPedOccupiedVehicle( g_Me );
	if engedelyezettserial[getPlayerSerial(thePlayer)] then
	if veh and not isEditingPosition then
		if state == "up" then
			removeVehicleUpgrade( veh, 1010 );
			setControlState( "vehicle_fire", false );
		else
			addVehicleUpgrade( veh, 1010 );
		end
	end
end

Btw. getPlayerSerial is deprecated on the client side, see the wiki.

Link to comment
20 minutes ago, Jani1337 said:

Oh, i see. How could i make it work only for the selected staff members ?

local staffACLGroup = "admin" -- you can change this to whatever acl group you want
local playerAccount = getPlayerAccount(thePlayer) -- you need to pass the player object here
if (isGuestAccount(playerAccount) == false) then
    local accountName = getAccountName (playerAccount)
    if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( staffACLGroup ) ) then
        -- your code here
    end
end

You can use ACL functions.

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