Fantanic Posted February 12, 2014 Share Posted February 12, 2014 (edited) Hello , I wanna lock the cars from .map file (like if u place the cars with map editor) that they will be locked to the team given in the script. So it got to get the vehicles from .map and then lock the vehicles to team? but how? Greetings Edited February 12, 2014 by Guest Link to comment
Anubhav Posted February 12, 2014 Share Posted February 12, 2014 You can create vehicles with LUA. Do it will it to make it easy. Some functions which will help you getPlayerTeam createVehicle setVehicleLocked Link to comment
Fantanic Posted February 12, 2014 Author Share Posted February 12, 2014 I never asked to create vehicles in lua better read the description next time i asked for locking a car in .map files Link to comment
myonlake Posted February 12, 2014 Share Posted February 12, 2014 You cannot lock vehicles in map files. You have to manually load the map file and spawn the vehicles in Lua and make your own custom attribute for locked state. Link to comment
Fantanic Posted February 12, 2014 Author Share Posted February 12, 2014 is there anyway to make it faster? since i got to copy and paste the coords all the time to the file Link to comment
Karuzo Posted February 12, 2014 Share Posted February 12, 2014 (edited) You could use Funsteins Converter to convert the .map file to a LUA file. http://cemgokmen.com/converter/ Edited February 12, 2014 by Guest Link to comment
FuriouZ Posted February 12, 2014 Share Posted February 12, 2014 is there anyway to make it faster?since i got to copy and paste the coords all the time to the file Yes, use ETL https://community.multitheftauto.com/index.php?p= ... ls&id=6778 Link to comment
Fantanic Posted February 12, 2014 Author Share Posted February 12, 2014 Thank you , im going to use ETL (seems its the best for me) You could use Funsteins Converter to convert the .map file to a LUA file. http://cemgokmen.com/converter/ i dont get this one by the way Link to comment
Fantanic Posted February 12, 2014 Author Share Posted February 12, 2014 Any idea why this doesnt work if i got multiple cars on the same name? : vehicle9 = createVehicle(448,2097.8999000,-1801.8000500,13.1000000,88.0000000,132,4,15)-- //Pizzaboy vehicle9 = createVehicle(448,2097.6999500,-1800.0000000,13.1000000,87.9950000,132,4,15)-- //Pizzaboy vehicle9 = createVehicle(448,2097.6001000,-1798.0999800,13.1000000,87.9950000,132,4,15)-- //Pizzaboy vehicle9 = createVehicle(448,2097.5000000,-1796.0000000,13.1000000,87.9950000,132,4,15)-- //Pizzaboy vehicle9 = createVehicle(448,2097.6999500,-1793.4000200,13.1000000,87.9950000,132,4,15)-- //Pizzaboy vehicle9 = createVehicle(416,2036.0000000,-1426.9000200,17.3000000,0.0000000,245,245,15)-- //Ambulance vehicle9 = createVehicle(416,2036.1999500,-1437.1999500,17.6000000,0.0000000,245,245,15)-- //Ambulance vehicle9 = createVehicle(416,2018.5000000,-1409.9000200,17.3000000,272.2500000,245,245,15)-- //Ambulance vehicle9 = createVehicle(427,1530.7099600,-1645.5000000,6.1000000,180.0000000,-1,-1,15)-- //Enforcer vehicle9 = createVehicle(427,1538.6992200,-1645.5000000,6.1000000,180.0000000,-1,-1,15)-- //Enforcer vehicle9 = createVehicle(490,1543.8994100,-1663.0996100,6.2000000,90.0000000,-1,-1,15)-- //FBI Rancher vehicle9 = createVehicle(490,1543.8994100,-1667.5000000,6.2000000,90.0000000,-1,-1,15)-- //FBI Rancher vehicle9 = createVehicle(490,1543.8994100,-1655.0996100,6.2000000,90.0000000,-1,-1,15)-- //FBI Rancher vehicle9 = createVehicle(490,1543.8994100,-1659.1992200,6.2000000,90.0000000,-1,-1,15)-- //FBI Rancher vehicle9 = createVehicle(596,1590.9000200,-1708.5999800,5.7000000,0.0000000,-1,-1,15)-- //Police Car (LSPD) vehicle9 = createVehicle(596,1587.0000000,-1708.5999800,5.7000000,0.0000000,-1,-1,15)-- //Police Car (LSPD) vehicle9 = createVehicle(596,1583.0999800,-1708.5999800,5.7000000,0.0000000,-1,-1,15)-- //Police Car (LSPD) vehicle9 = createVehicle(596,1594.9000200,-1708.5999800,5.7000000,0.0000000,-1,-1,15)-- //Police Car (LSPD) vehicle9 = createVehicle(596,1599.8000500,-1684.3000500,5.7000000,90.0000000,-1,-1,15)-- //Police Car (LSPD) vehicle9 = createVehicle(596,1599.8000500,-1688.0000000,5.7000000,90.0000000,-1,-1,15)-- //Police Car (LSPD) vehicle9 = createVehicle(596,1599.8000500,-1691.5999800,5.7000000,90.0000000,-1,-1,15)-- //Police Car (LSPD) vehicle9 = createVehicle(596,1599.8000500,-1695.9000200,5.7000000,90.0000000,-1,-1,15)-- //Police Car (LSPD) vehicle9 = createVehicle(402,1063.0999800,-1758.5000000,13.4000000,90.0000000,105,30,15)-- //Buffalo vehicle9 = createVehicle(402,1062.5999800,-1737.6999500,13.4000000,90.0000000,105,30,15)-- //Buffalo vehicle9 = createVehicle(402,1063.0000000,-1767.0000000,13.3000000,90.0000000,105,30,15)-- //Buffalo vehicle9 = createVehicle(559,311.7000100,-1808.8000500,4.2000000,0.0000000,170,173,15)-- //Jester vehicle9 = createVehicle(424,318.0000000,-1808.1999500,4.3000000,0.0000000,81,84,15)-- //BF Injection vehicle9 = createVehicle(416,1179.8000500,-1338.9000200,14.1000000,270.0000000,245,245,15)-- //Ambulance vehicle9 = createVehicle(416,1179.1999500,-1309.4000200,14.1000000,270.0000000,245,245,15)-- //Ambulance vehicle9 = createVehicle(420,1674.8000500,-1097.4000200,23.8000000,90.0000000,215,142,15)-- //Taxi vehicle9 = createVehicle(420,1674.8000500,-1102.0999800,23.8000000,90.0000000,215,142,15)-- //Taxi vehicle9 = createVehicle(420,1674.8000500,-1106.9000200,23.8000000,90.0000000,215,142,15)-- //Taxi vehicle9 = createVehicle(420,1674.8000500,-1115.5000000,23.8000000,90.0000000,215,142,15)-- //Taxi vehicle9 = createVehicle(420,1674.8000500,-1125.0000000,23.8000000,90.0000000,215,142,15)-- //Taxi vehicle9 = createVehicle(438,1674.8000500,-1111.4000200,24.1000000,90.0000000,215,142,15)-- //Cabbie vehicle9 = createVehicle(438,1674.8000500,-1120.3000500,24.1000000,90.0000000,215,142,15)-- //Cabbie vehicle9 = createVehicle(438,1674.8000500,-1129.3000500,24.1000000,90.0000000,215,142,15)-- //Cabbie vehicle9 = createVehicle(550,2148.5000000,-1194.1999500,23.8000000,270.0000000,124,28,15)-- //Sunrise vehicle9 = createVehicle(550,2148.6001000,-1179.9000200,23.7000000,270.0000000,124,28,15)-- //Sunrise vehicle9 = createVehicle(576,2161.6001000,-1187.5999800,23.6000000,270.0000000,32,32,15)-- //Tornado vehicle9 = createVehicle(576,2162.1001000,-1196.9000200,23.6000000,270.0000000,32,32,15)-- //Tornado vehicle9 = createVehicle(487,2078.6001000,-1430.9000200,48.6000000,90.0000000,251,3,15)-- //Maverick vehicle9 = createVehicle(487,2078.3999000,-1412.8000500,48.6000000,90.0000000,251,3,15)-- //Maverick function lockPrivate( player, seat, jacked ) if ( source == vehicle9 ) then local account = getPlayerAccount( player ) local accountName = ( account and getAccountName ( account ) or "" ) if not( accountName == "admin" ) then cancelEvent() outputChatBox("This vehicle is locked for following users:Jonas13362 ", player, 255, 0, 0, false) else end end end addEventHandler ( "onVehicleStartEnter", getRootElement(), lockPrivate ) -----Made by Alen141(ingame name:Jimboy)------ -----Special thanks to : Solidsnake14(ingame name:Castillo)----- -----Visit SAUR Utopia RPG, IP: 128.204.203.103:22003----- -----Feel free to edit script on your own----- -----Don't remove credits----- Link to comment
myonlake Posted February 12, 2014 Share Posted February 12, 2014 Because they have to have another variable name. The variable is always replaced when you define the variable again. local vehicles = { } addEventHandler( "onResourceStart", resourceRoot, function( ) table.insert( vehicles, createVehicle(448, 2097.8999000, -1801.8000500, 13.1000000, 88.0000000, 132, 4, 15 ) ) -- Pizzaboy table.insert( vehicles, createVehicle(448, 2097.6999500, -1800.0000000, 13.1000000, 87.9950000, 132, 4, 15 ) ) -- Pizzaboy table.insert( vehicles, createVehicle(448, 2097.6001000, -1798.0999800, 13.1000000, 87.9950000, 132, 4, 15 ) ) -- Pizzaboy table.insert( vehicles, createVehicle(448, 2097.5000000, -1796.0000000, 13.1000000, 87.9950000, 132, 4, 15 ) ) -- Pizzaboy table.insert( vehicles, createVehicle(448, 2097.6999500, -1793.4000200, 13.1000000, 87.9950000, 132, 4, 15 ) ) -- Pizzaboy table.insert( vehicles, createVehicle(416, 2036.0000000, -1426.9000200, 17.3000000, 0.0000000, 245, 245, 15 ) ) -- Ambulance table.insert( vehicles, createVehicle(416, 2036.1999500, -1437.1999500, 17.6000000, 0.0000000, 245, 245, 15 ) ) -- Ambulance table.insert( vehicles, createVehicle(416, 2018.5000000, -1409.9000200, 17.3000000, 272.2500000, 245, 245, 15 ) ) -- Ambulance table.insert( vehicles, createVehicle(427, 1530.7099600, -1645.5000000, 6.1000000, 180.0000000, -1, -1, 15 ) ) -- Enforcer table.insert( vehicles, createVehicle(427, 1538.6992200, -1645.5000000, 6.1000000, 180.0000000, -1, -1, 15 ) ) -- Enforcer table.insert( vehicles, createVehicle(490, 1543.8994100, -1663.0996100, 6.2000000, 90.0000000, -1, -1, 15 ) ) -- FBI Rancher table.insert( vehicles, createVehicle(490, 1543.8994100, -1667.5000000, 6.2000000, 90.0000000, -1, -1, 15 ) ) -- FBI Rancher table.insert( vehicles, createVehicle(490, 1543.8994100, -1655.0996100, 6.2000000, 90.0000000, -1, -1, 15 ) ) -- FBI Rancher table.insert( vehicles, createVehicle(490, 1543.8994100, -1659.1992200, 6.2000000, 90.0000000, -1, -1, 15 ) ) -- FBI Rancher table.insert( vehicles, createVehicle(596, 1590.9000200, -1708.5999800, 5.7000000, 0.0000000, -1, -1, 15 ) ) -- Police Car (LSPD) table.insert( vehicles, createVehicle(596, 1587.0000000, -1708.5999800, 5.7000000, 0.0000000, -1, -1, 15 ) ) -- Police Car (LSPD) table.insert( vehicles, createVehicle(596, 1583.0999800, -1708.5999800, 5.7000000, 0.0000000, -1, -1, 15 ) ) -- Police Car (LSPD) table.insert( vehicles, createVehicle(596, 1594.9000200, -1708.5999800, 5.7000000, 0.0000000, -1, -1, 15 ) ) -- Police Car (LSPD) table.insert( vehicles, createVehicle(596, 1599.8000500, -1684.3000500, 5.7000000, 90.0000000, -1, -1, 15 ) ) -- Police Car (LSPD) table.insert( vehicles, createVehicle(596, 1599.8000500, -1688.0000000, 5.7000000, 90.0000000, -1, -1, 15 ) ) -- Police Car (LSPD) table.insert( vehicles, createVehicle(596, 1599.8000500, -1691.5999800, 5.7000000, 90.0000000, -1, -1, 15 ) ) -- Police Car (LSPD) table.insert( vehicles, createVehicle(596, 1599.8000500, -1695.9000200, 5.7000000, 90.0000000, -1, -1, 15 ) ) -- Police Car (LSPD) table.insert( vehicles, createVehicle(402, 1063.0999800, -1758.5000000, 13.4000000, 90.0000000, 105, 30, 15 ) ) -- Buffalo table.insert( vehicles, createVehicle(402, 1062.5999800, -1737.6999500, 13.4000000, 90.0000000, 105, 30, 15 ) ) -- Buffalo table.insert( vehicles, createVehicle(402, 1063.0000000, -1767.0000000, 13.3000000, 90.0000000, 105, 30, 15 ) ) -- Buffalo table.insert( vehicles, createVehicle(559, 311.7000100, -1808.8000500, 4.2000000, 0.0000000, 170, 173, 15 ) ) -- Jester table.insert( vehicles, createVehicle(424, 318.0000000, -1808.1999500, 4.3000000, 0.0000000, 81, 84, 15 ) ) -- BF Injection table.insert( vehicles, createVehicle(416, 1179.8000500, -1338.9000200, 14.1000000, 270.0000000, 245, 245, 15 ) ) -- Ambulance table.insert( vehicles, createVehicle(416, 1179.1999500, -1309.4000200, 14.1000000, 270.0000000, 245, 245, 15 ) ) -- Ambulance table.insert( vehicles, createVehicle(420, 1674.8000500, -1097.4000200, 23.8000000, 90.0000000, 215, 142, 15 ) ) -- Taxi table.insert( vehicles, createVehicle(420, 1674.8000500, -1102.0999800, 23.8000000, 90.0000000, 215, 142, 15 ) ) -- Taxi table.insert( vehicles, createVehicle(420, 1674.8000500, -1106.9000200, 23.8000000, 90.0000000, 215, 142, 15 ) ) -- Taxi table.insert( vehicles, createVehicle(420, 1674.8000500, -1115.5000000, 23.8000000, 90.0000000, 215, 142, 15 ) ) -- Taxi table.insert( vehicles, createVehicle(420, 1674.8000500, -1125.0000000, 23.8000000, 90.0000000, 215, 142, 15 ) ) -- Taxi table.insert( vehicles, createVehicle(438, 1674.8000500, -1111.4000200, 24.1000000, 90.0000000, 215, 142, 15 ) ) -- Cabbie table.insert( vehicles, createVehicle(438, 1674.8000500, -1120.3000500, 24.1000000, 90.0000000, 215, 142, 15 ) ) -- Cabbie table.insert( vehicles, createVehicle(438, 1674.8000500, -1129.3000500, 24.1000000, 90.0000000, 215, 142, 15 ) ) -- Cabbie table.insert( vehicles, createVehicle(550, 2148.5000000, -1194.1999500, 23.8000000, 270.0000000, 124, 28, 15 ) ) -- Sunrise table.insert( vehicles, createVehicle(550, 2148.6001000, -1179.9000200, 23.7000000, 270.0000000, 124, 28, 15 ) ) -- Sunrise table.insert( vehicles, createVehicle(576, 2161.6001000, -1187.5999800, 23.6000000, 270.0000000, 32, 32, 15 ) ) -- Tornado table.insert( vehicles, createVehicle(576, 2162.1001000, -1196.9000200, 23.6000000, 270.0000000, 32, 32, 15 ) ) -- Tornado table.insert( vehicles, createVehicle(487, 2078.6001000, -1430.9000200, 48.6000000, 90.0000000, 251, 3, 15 ) ) -- Maverick table.insert( vehicles, createVehicle(487, 2078.3999000, -1412.8000500, 48.6000000, 90.0000000, 251, 3, 15 ) ) -- Maverick end ) function isVehicleOnList( vehicle ) if ( not isElement( vehicle ) ) or ( getElementType( vehicle ) ~= "vehicle" ) then return false end for _,vehicle_ in pairs( vehicles ) do if ( vehicle_ == vehicle ) then return true end end return false end addEventHandler( "onVehicleStartEnter", root, function( player ) if ( isVehicleOnList( source ) ) then local accountName = ( getPlayerAccount( player ) and not isGuestAccount( getPlayerAccount( player ) ) and getAccountName( getPlayerAccount( player ) ) or "" ) if ( accountName ~= "admin" ) then cancelEvent( ) outputChatBox( "This vehicle is locked for following users: Jonas13362", player, 255, 0, 0, false ) end end end ) Link to comment
Fantanic Posted February 12, 2014 Author Share Posted February 12, 2014 Dont i have to add ; setElementData(isVehicleOnList, "class", "Paramedic") this if i want to lock it all to 'Paramedic' classe? Link to comment
myonlake Posted February 12, 2014 Share Posted February 12, 2014 (edited) Well, you can do it this way too. local vehicles = { emergency = { createVehicle( 416, 2036.0000000, -1426.9000200, 17.3000000, 0.0000000, 245, 245, 15 ), -- Ambulance createVehicle( 416, 2036.1999500, -1437.1999500, 17.6000000, 0.0000000, 245, 245, 15 ), -- Ambulance createVehicle( 416, 2018.5000000, -1409.9000200, 17.3000000, 272.2500000, 245, 245, 15 ), -- Ambulance createVehicle( 416, 1179.8000500, -1338.9000200, 14.1000000, 270.0000000, 245, 245, 15 ), -- Ambulance createVehicle( 416, 1179.1999500, -1309.4000200, 14.1000000, 270.0000000, 245, 245, 15 ) -- Ambulance }, police = { createVehicle( 427, 1530.7099600, -1645.5000000, 6.1000000, 180.0000000, -1, -1, 15 ), -- Enforcer createVehicle( 427, 1538.6992200, -1645.5000000, 6.1000000, 180.0000000, -1, -1, 15 ), -- Enforcer createVehicle( 490, 1543.8994100, -1663.0996100, 6.2000000, 90.0000000, -1, -1, 15 ), -- FBI Rancher createVehicle( 490, 1543.8994100, -1667.5000000, 6.2000000, 90.0000000, -1, -1, 15 ), -- FBI Rancher createVehicle( 490, 1543.8994100, -1655.0996100, 6.2000000, 90.0000000, -1, -1, 15 ), -- FBI Rancher createVehicle( 490, 1543.8994100, -1659.1992200, 6.2000000, 90.0000000, -1, -1, 15 ), -- FBI Rancher createVehicle( 596, 1590.9000200, -1708.5999800, 5.7000000, 0.0000000, -1, -1, 15 ), -- Police Car (LSPD) createVehicle( 596, 1587.0000000, -1708.5999800, 5.7000000, 0.0000000, -1, -1, 15 ), -- Police Car (LSPD) createVehicle( 596, 1583.0999800, -1708.5999800, 5.7000000, 0.0000000, -1, -1, 15 ), -- Police Car (LSPD) createVehicle( 596, 1594.9000200, -1708.5999800, 5.7000000, 0.0000000, -1, -1, 15 ), -- Police Car (LSPD) createVehicle( 596, 1599.8000500, -1684.3000500, 5.7000000, 90.0000000, -1, -1, 15 ), -- Police Car (LSPD) createVehicle( 596, 1599.8000500, -1688.0000000, 5.7000000, 90.0000000, -1, -1, 15 ), -- Police Car (LSPD) createVehicle( 596, 1599.8000500, -1691.5999800, 5.7000000, 90.0000000, -1, -1, 15 ), -- Police Car (LSPD) createVehicle( 596, 1599.8000500, -1695.9000200, 5.7000000, 90.0000000, -1, -1, 15 ) -- Police Car (LSPD) }, admin = { createVehicle( 487, 2078.6001000, -1430.9000200, 48.6000000, 90.0000000, 251, 3, 15 ), -- Maverick createVehicle( 487, 2078.3999000, -1412.8000500, 48.6000000, 90.0000000, 251, 3, 15 ) -- Maverick }, taxi = { createVehicle( 420, 1674.8000500, -1097.4000200, 23.8000000, 90.0000000, 215, 142, 15 ), -- Taxi createVehicle( 420, 1674.8000500, -1102.0999800, 23.8000000, 90.0000000, 215, 142, 15 ), -- Taxi createVehicle( 420, 1674.8000500, -1106.9000200, 23.8000000, 90.0000000, 215, 142, 15 ), -- Taxi createVehicle( 420, 1674.8000500, -1115.5000000, 23.8000000, 90.0000000, 215, 142, 15 ), -- Taxi createVehicle( 420, 1674.8000500, -1125.0000000, 23.8000000, 90.0000000, 215, 142, 15 ), -- Taxi createVehicle( 438, 1674.8000500, -1111.4000200, 24.1000000, 90.0000000, 215, 142, 15 ), -- Cabbie createVehicle( 438, 1674.8000500, -1120.3000500, 24.1000000, 90.0000000, 215, 142, 15 ), -- Cabbie createVehicle( 438, 1674.8000500, -1129.3000500, 24.1000000, 90.0000000, 215, 142, 15 ) -- Cabbie }, everyone = { createVehicle( 448, 2097.8999000, -1801.8000500, 13.1000000, 88.0000000, 132, 4, 15 ), -- Pizzaboy createVehicle( 448, 2097.6999500, -1800.0000000, 13.1000000, 87.9950000, 132, 4, 15 ), -- Pizzaboy createVehicle( 448, 2097.6001000, -1798.0999800, 13.1000000, 87.9950000, 132, 4, 15 ), -- Pizzaboy createVehicle( 448, 2097.5000000, -1796.0000000, 13.1000000, 87.9950000, 132, 4, 15 ), -- Pizzaboy createVehicle( 448, 2097.6999500, -1793.4000200, 13.1000000, 87.9950000, 132, 4, 15 ), -- Pizzaboy createVehicle( 402, 1063.0999800, -1758.5000000, 13.4000000, 90.0000000, 105, 30, 15 ), -- Buffalo createVehicle( 402, 1062.5999800, -1737.6999500, 13.4000000, 90.0000000, 105, 30, 15 ), -- Buffalo createVehicle( 402, 1063.0000000, -1767.0000000, 13.3000000, 90.0000000, 105, 30, 15 ), -- Buffalo createVehicle( 559, 311.7000100, -1808.8000500, 4.2000000, 0.0000000, 170, 173, 15 ), -- Jester createVehicle( 424, 318.0000000, -1808.1999500, 4.3000000, 0.0000000, 81, 84, 15 ), -- BF Injection createVehicle( 550, 2148.5000000, -1194.1999500, 23.8000000, 270.0000000, 124, 28, 15 ), -- Sunrise createVehicle( 550, 2148.6001000, -1179.9000200, 23.7000000, 270.0000000, 124, 28, 15 ), -- Sunrise createVehicle( 576, 2161.6001000, -1187.5999800, 23.6000000, 270.0000000, 32, 32, 15 ), -- Tornado createVehicle( 576, 2162.1001000, -1196.9000200, 23.6000000, 270.0000000, 32, 32, 15 ) -- Tornado } } addEventHandler( "onResourceStart", resourceRoot, function( ) for classID,classData in pairs( vehicles ) do for _,vehicle in pairs( classData ) do setElementData( vehicle, "class", classID, false ) end end end ) function isVehicleOnList( vehicle ) if ( not isElement( vehicle ) ) or ( getElementType( vehicle ) ~= "vehicle" ) or ( not getElementData( vehicle, "class" ) ) then return false end for _,vehicle_ in pairs( vehicles[ getElementData( vehicle, "class" ) ] ) do if ( vehicle_ == vehicle ) then return true end end return false end addEventHandler( "onVehicleStartEnter", root, function( player, seat ) if ( seat ~= 0 ) then return end local className = getElementData( source, "class" ) local aclGroup = aclGetGroup( className ) if ( isVehicleOnList( source ) ) and ( className ) and ( className ~= "everyone" ) and ( aclGroup ) then local account = ( ( getPlayerAccount( player ) and not isGuestAccount( getPlayerAccount( player ) ) ) and getPlayerAccount( player ) or false ) if ( not account ) or ( account and not isObjectInACLGroup( "user." .. getAccountName( account ), aclGroup ) ) then cancelEvent( ) outputChatBox( "This vehicle is locked for following group: " .. className .. ".", player, 255, 0, 0, false ) end end end ) Note, that this checks if the account is in the ACL group of the vehicle category. You have to make an ACL group for each vehicle category individually in acl.xml file, or then make your own check for vehicle categories (e.g. if the player's class element data is the same as the vehicle category). Edited February 12, 2014 by Guest Link to comment
Fantanic Posted February 12, 2014 Author Share Posted February 12, 2014 wait im totaly confused now (i used other code as u seen) so what i have to do so it only checks if hes in the class and not in the ACL and also i wanna add ; if ( seat ~= 0 ) then edit it doesnt seem to lock also Link to comment
myonlake Posted February 12, 2014 Share Posted February 12, 2014 Copy the code again, I suppose it should work now, forgot to edit the isVehicleOnList function to match the new table structure. I added the seat check as well. Let me know if it still doesn't work, should though. About the class check, not sure what you use; if you use element data for player class, then remove the variable for aclGroup and the condition for isObjectInACLGroup, and add the element data match check there. If the class is not the same as the vehicle's, then cancel the event. The following event should do the trick for element data matching. addEventHandler( "onVehicleStartEnter", root, function( player, seat ) if ( seat ~= 0 ) then return end local className = getElementData( source, "class" ) if ( isVehicleOnList( source ) ) and ( className ) and ( className ~= "everyone" ) then local account = ( ( getPlayerAccount( player ) and not isGuestAccount( getPlayerAccount( player ) ) ) and getPlayerAccount( player ) or false ) if ( not account ) or ( not getElementData( player, "class" ) ) or ( account and getElementData( player, "class" ) ~= className ) then cancelEvent( ) outputChatBox( "This vehicle is locked for following group: " .. className .. ".", player, 255, 0, 0, false ) end end end ) Link to comment
Bssol Posted February 12, 2014 Share Posted February 12, 2014 https://wiki.multitheftauto.com/wiki/Element/VehicleThere is a data called "locked", set it to true to make the vehicle locked for example: "vehicle (Stallion) (1)" model="439" posX="1836.7196044922" posY="-1854.3317871094" posZ="13.389747619629" rotX="0" rotY="0" rotZ="180" locked="true"> I don't know if this data works or not, try it and reply Link to comment
myonlake Posted February 12, 2014 Share Posted February 12, 2014 Aha, apparently there is such attribute then. Didn't find that earlier. There's just one problem though, loading automatically from a map file doesn't categorize the vehicles into teams, that's why it's better to create the vehicles in Lua. Link to comment
Fantanic Posted February 16, 2014 Author Share Posted February 16, 2014 Any Idea how to get it working for 'Limo Driver' for example? it doesnt read the name if there are any spaces example : Limo Driver = { createVehicle( 416, 2036.0000000, -1426.9000200, 17.3000000, 0.0000000, 245, 245, 15 ), -- Ambulance createVehicle( 416, 2036.1999500, -1437.1999500, 17.6000000, 0.0000000, 245, 245, 15 ), -- Ambulance createVehicle( 416, 2018.5000000, -1409.9000200, 17.3000000, 272.2500000, 245, 245, 15 ), -- Ambulance createVehicle( 416, 1179.8000500, -1338.9000200, 14.1000000, 270.0000000, 245, 245, 15 ), -- Ambulance createVehicle( 416, 1179.1999500, -1309.4000200, 14.1000000, 270.0000000, 245, 245, 15 ) -- Ambulance }, (just copied emergency a second) It creates the limos but doesnt loc them Link to comment
myonlake Posted February 16, 2014 Share Posted February 16, 2014 You cannot have spaces like that. You have to do it this way to apply spaces. ["Limo Driver"] = { createVehicle( 416, 2036.0000000, -1426.9000200, 17.3000000, 0.0000000, 245, 245, 15 ), -- Ambulance createVehicle( 416, 2036.1999500, -1437.1999500, 17.6000000, 0.0000000, 245, 245, 15 ), -- Ambulance createVehicle( 416, 2018.5000000, -1409.9000200, 17.3000000, 272.2500000, 245, 245, 15 ), -- Ambulance createVehicle( 416, 1179.8000500, -1338.9000200, 14.1000000, 270.0000000, 245, 245, 15 ), -- Ambulance createVehicle( 416, 1179.1999500, -1309.4000200, 14.1000000, 270.0000000, 245, 245, 15 ) -- Ambulance }, 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