Jani1337 Posted June 12, 2018 Share Posted June 12, 2018 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 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
MIKI785 Posted June 12, 2018 Share Posted June 12, 2018 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
Jani1337 Posted June 12, 2018 Author Share Posted June 12, 2018 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 ? Link to comment
Saml1er Posted June 12, 2018 Share Posted June 12, 2018 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
Jani1337 Posted June 12, 2018 Author Share Posted June 12, 2018 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... Link to comment
itHyperoX Posted June 12, 2018 Share Posted June 12, 2018 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 :~ ? Link to comment
Jani1337 Posted June 13, 2018 Author Share Posted June 13, 2018 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 Link to comment
MisterQuestions Posted June 13, 2018 Share Posted June 13, 2018 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. 1 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