Jump to content

Car locks from .map file + Car lock problem?


Fantanic

Recommended Posts

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 by Guest
Link to comment

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

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

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 by Guest
Link to comment

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

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

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

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