Sign in to follow this  
Jani1337

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

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

 

Share this post


Link to post

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.

Share this post


Link to post
9 minutes ago, MIKI785 said:

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

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

Share this post


Link to post
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.

Share this post


Link to post

One problem with ACL. I use MySql accounting...

6 minutes ago, Jani1337 said:

One problem with ACL. I use MySql accounting...

Thats why i wanted serial...

Share this post


Link to post

i'm 100% sure you don't know anything what u are doing. Asking help for a leaked scripts (Another topic).. Why do you have a server if you don't know :~ ?

Share this post


Link to post
17 hours ago, TheMOG said:

i'm 100% sure you don't know anything what u are doing. Asking help for a leaked scripts (Another topic).. Why do you have a server if you don't know :~ ?

"leaked" ok

Share this post


Link to post

Kindo weird to have something like that already and dont know what you are doing.

How ever using serials for permissions is just a really inefficient way to handle it.

  • Like 1

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.