Jump to content

[HELP]Vip Vehicles


Best-Killer1

Recommended Posts

i want add nitro to Vip Vehicle how pls

codes :

server-side :

local spawners = {  
    ['Free'] = { }, 
    ['Job'] = { } 
} 
local spawnedVehciles = { } 
function createFreeSpawner ( x, y, z, rz, sx, sy, sz ) 
    local i = #spawners['Free']+1 
    local z = z - 1 
    local sx, sy, sz = sx or x, sy or y, sz or z+1.5 
    local rz = rz or 0 
    spawners['Free'][i] = createMarker ( x, y, z, 'cylinder', 2, 255, 255, 255, 120 ) 
    setElementData ( spawners['Free'][i], "SpawnCoordinates", { sx, sy, sz, rz } ) 
    setElementData ( spawners['Free'][i], "SAEGVehicles:SpawnVehicleList", JobVehicles['Free'] ) 
    setElementData ( spawners['Free'][i], "SAEGVehicles:JobRestriction", false ) 
    addEventHandler ( "onMarkerHit", spawners['Free'][i], onSpawnerHit ) 
    return spawners['Free'][i] 
end 
  
function createJobSpawner ( job, x, y, z, colors, rz, sx, sy, sz ) 
    local i = #spawners['Job']+1 
    local z = z - 1 
    local sx, sy, sz = sx or x, sy or y, sz or z+1.5 
    local rz = rz or 0 
    local r, g, b = unpack ( colors ) 
    spawners['Job'][i] = createMarker ( x, y, z, 'cylinder', 2, r, g, b, 120 ) 
    setElementData ( spawners['Job'][i], "SpawnCoordinates", { sx, sy, sz, rz } ) 
    setElementData ( spawners['Job'][i], "SAEGVehicles:SpawnVehicleList", JobVehicles[job] ) 
    setElementData ( spawners['Job'][i], "SAEGVehicles:JobRestriction", tostring ( job ) ) 
    addEventHandler ( "onMarkerHit", spawners['Job'][i], onSpawnerHit ) 
    return spawners['Job'][i] 
end 
  
  
function onSpawnerHit ( p ) 
    local job = string.lower ( getElementData ( source, "SAEGVehicles:JobRestriction" ) or "false" ) 
    if ( job == 'false' ) then job = false end 
    local pJob =  string.lower ( getElementData ( p, "Job" ) or "" ) 
    if ( job ) then 
        if ( pJob ~= job ) then 
            exports['SAEGMessages']:sendClientMessage ( "This spawner is for the "..job.." job. You're not in the "..job.." job.", p, 255, 140, 40 ) 
            return 
        end 
    end 
     
    if ( getElementType ( p ) == 'player' and not isPedInVehicle ( p ) ) then 
        local list = getElementData ( source, "SAEGVehicles:SpawnVehicleList" ); 
        triggerClientEvent ( p, 'SAEGSpawners:ShowClientSpawner', p, list, source ) 
        triggerEvent ( "SAEGSpawners:onPlayerOpenSpawner", source, p ) 
    end 
end 
  
  
addEvent ( "SAEGSpawners:spawnVehicle", true ) 
addEventHandler ( "SAEGSpawners:spawnVehicle", root, function ( id, x, y, z, rz, job )  
    local c = exports['SAEGAntiRestart']:createPlayerVehicle ( source, id, x, y, z, rz, true, job ) 
end ) 
  
  
  
for i, v in pairs ( data ) do  
    if ( i == 'Free' ) then 
        for k, e in ipairs ( v ) do  
            createFreeSpawner ( unpack ( e ) ) 
        end 
    elseif ( i == 'Jobs' ) then 
        for k, e in ipairs ( v ) do  
            createJobSpawner ( unpack ( e ) ) 
        end 
    end 
end 
  
addEvent ( "SAEGSpawners:onPlayerOpenSpawner", true ) 

Client-Side :

local sx, sy  = guiGetScreenSize ( ) 
local rsx, rsy = sx / 1280, sy / 1024 
local window = guiCreateWindow( ( sx / 2 - ( rsx*354 ) / 2 ), ( sy / 2 - (rsy*400) / 2 ), (rsx*354), (rsy*400), "Spawners", false) 
local vehList = guiCreateGridList((rsx*9), (rsy*26), (rsx*335), (rsy*315), false, window) 
local btnSpawn = guiCreateButton((rsx*13), (rsy*346), (rsx*149), (rsy*43), "Spawn", false, window) 
local btnClose = guiCreateButton((rsx*195), (rsy*346), (rsx*149), (rsy*43), "Cancel", false, window) 
guiWindowSetSizable(window, false) 
guiSetVisible ( window, false ) 
guiGridListAddColumn(vehList, "Vehicle", 0.9) 
local marker = nil 
addEvent ( "SAEGSpawners:ShowClientSpawner", true ) 
addEventHandler ( "SAEGSpawners:ShowClientSpawner", root, function ( cars, mrker ) 
    if ( wasEventCancelled ( ) ) then    
        return 
    end 
     
    if ( not guiGetVisible ( window ) ) then  
        bindKey ( "space", "down", spawnClickingFunctions ) 
        showCursor ( true ) 
        guiSetVisible ( window, true ) 
        guiGridListClear ( vehList ) 
        addEventHandler ( 'onClientMarkerLeave', mrker, closeWindow ) 
        marker = mrker 
        job = getElementData ( marker, "SAEGVehicles:JobRestriction" ) 
        guiGridListSetItemText ( vehList, guiGridListAddRow ( vehList ), 1, "Free Vehicles", true, true ) 
        for i, v in ipairs ( cars ) do 
            local name = getVehicleNameFromModel ( v ) 
            local row = guiGridListAddRow ( vehList ) 
            guiGridListSetItemText ( vehList, row, 1, name, false, false ) 
            guiGridListSetItemData ( vehList, row, 1, v ) 
        end 
         
        if ( exports.SAEGVIP:isPlayerVIP ( ) ) then 
            local level = exports.SAEGVIP:getVipLevelFromName ( getElementData ( localPlayer, "VIP" ) ) 
            if ( level and level > 0 and VipVehicles [ level ] and #VipVehicles [ level ] > 0 ) then 
                guiGridListSetItemText ( vehList, guiGridListAddRow ( vehList ), 1, "VIP Vehicles", true, true ) 
                for i, v in pairs ( VipVehicles [ level ] ) do 
                    local name = getVehicleNameFromModel ( v ) 
                    local row = guiGridListAddRow ( vehList ) 
                    guiGridListSetItemText ( vehList, row, 1, name, false, false ) 
                    guiGridListSetItemData ( vehList, row, 1, v ) 
                end 
            end 
        end 
         
        guiGridListSetSelectedItem ( vehList, 0, 1 ) 
        addEventHandler ( "onClientGUIClick", btnSpawn, spawnClickingFunctions ) 
        addEventHandler ( "onClientGUIClick", btnClose, spawnClickingFunctions ) 
    end 
end ) 
  
  
function spawnClickingFunctions ( ) 
    if ( source == btnClose ) then 
        closeWindow ( localPlayer ) 
    elseif ( source == btnSpawn ) or getKeyState( "space" ) == true then 
        local row, col = guiGridListGetSelectedItem ( vehList ) 
        if ( row == -1 ) then 
            return exports['SAEGMessages']:sendClientMessage ( "Select a vehicle to be spawn.", 255, 255, 0 ) 
        end 
         
        local id = guiGridListGetItemData ( vehList, row, 1 ) 
        triggerServerEvent ( "SAEGSpawners:spawnVehicle", localPlayer, id, marker, true ) 
        closeWindow ( localPlayer ) 
    end 
end  
  
function closeWindow ( p ) 
    if ( not p or p == localPlayer ) then 
        removeEventHandler ( 'onClientMarkerLeave', marker, closeWindow ) 
        marker = nil 
        guiSetVisible ( window, false ) 
        showCursor ( false ) 
        guiGridListClear ( vehList ) 
        removeEventHandler ( "onClientGUIClick", btnSpawn, spawnClickingFunctions ) 
        removeEventHandler ( "onClientGUIClick", btnClose, spawnClickingFunctions ) 
        unbindKey ( "space", "down", spawnClickingFunctions ) 
    end 
end 
addEvent ( "SAEGSpawners:CloseWindow", true ) 
addEventHandler ( "SAEGSpawners:CloseWindow", root, closeWindow ) 

Link to comment

Try changing:

addEvent ( "SAEGSpawners:spawnVehicle", true ) 
addEventHandler ( "SAEGSpawners:spawnVehicle", root, function ( id, x, y, z, rz, job ) 
    local c = exports['SAEGAntiRestart']:createPlayerVehicle ( source, id, x, y, z, rz, true, job ) 
end ) 

To this:

addEvent ( "SAEGSpawners:spawnVehicle", true ) 
addEventHandler ( "SAEGSpawners:spawnVehicle", root, function ( id, x, y, z, rz, job ) 
    local c = exports['SAEGAntiRestart']:createPlayerVehicle ( source, id, x, y, z, rz, true, job ) 
    addVehicleUpgrade(c, 1010) 
end ) 

Link to comment
Try changing:
addEvent ( "SAEGSpawners:spawnVehicle", true ) 
addEventHandler ( "SAEGSpawners:spawnVehicle", root, function ( id, x, y, z, rz, job ) 
    local c = exports['SAEGAntiRestart']:createPlayerVehicle ( source, id, x, y, z, rz, true, job ) 
end ) 

To this:

addEvent ( "SAEGSpawners:spawnVehicle", true ) 
addEventHandler ( "SAEGSpawners:spawnVehicle", root, function ( id, x, y, z, rz, job ) 
    local c = exports['SAEGAntiRestart']:createPlayerVehicle ( source, id, x, y, z, rz, true, job ) 
    addVehicleUpgrade(c, 1010) 
end ) 

nitro work but to all vehicle not only to Vip Vehicles

Link to comment
I can't see anything related to VIPs in that server-side script...

sry omg this code

local sx, sy  = guiGetScreenSize ( ) 
local rsx, rsy = sx / 1280, sy / 1024 
local window = guiCreateWindow( ( sx / 2 - ( rsx*354 ) / 2 ), ( sy / 2 - (rsy*400) / 2 ), (rsx*354), (rsy*400), "Spawners", false) 
local vehList = guiCreateGridList((rsx*9), (rsy*26), (rsx*335), (rsy*315), false, window) 
local btnSpawn = guiCreateButton((rsx*13), (rsy*346), (rsx*149), (rsy*43), "Spawn", false, window) 
local btnClose = guiCreateButton((rsx*195), (rsy*346), (rsx*149), (rsy*43), "Cancel", false, window) 
guiWindowSetSizable(window, false) 
guiSetVisible ( window, false ) 
guiGridListAddColumn(vehList, "Vehicle", 0.9) 
local marker = nil 
addEvent ( "SAEGSpawners:ShowClientSpawner", true ) 
addEventHandler ( "SAEGSpawners:ShowClientSpawner", root, function ( cars, mrker ) 
    if ( wasEventCancelled ( ) ) then    
        return 
    end 
     
    if ( not guiGetVisible ( window ) ) then  
        bindKey ( "space", "down", spawnClickingFunctions ) 
        showCursor ( true ) 
        guiSetVisible ( window, true ) 
        guiGridListClear ( vehList ) 
        addEventHandler ( 'onClientMarkerLeave', mrker, closeWindow ) 
        marker = mrker 
        job = getElementData ( marker, "SAEGVehicles:JobRestriction" ) 
        guiGridListSetItemText ( vehList, guiGridListAddRow ( vehList ), 1, "Free Vehicles", true, true ) 
        for i, v in ipairs ( cars ) do 
            local name = getVehicleNameFromModel ( v ) 
            local row = guiGridListAddRow ( vehList ) 
            guiGridListSetItemText ( vehList, row, 1, name, false, false ) 
            guiGridListSetItemData ( vehList, row, 1, v ) 
        end 
         
        if ( exports.SAEGVIP:isPlayerVIP ( ) ) then 
            local level = exports.SAEGVIP:getVipLevelFromName ( getElementData ( localPlayer, "VIP" ) ) 
            if ( level and level > 0 and VipVehicles [ level ] and #VipVehicles [ level ] > 0 ) then 
                guiGridListSetItemText ( vehList, guiGridListAddRow ( vehList ), 1, "VIP Vehicles", true, true ) 
                for i, v in pairs ( VipVehicles [ level ] ) do 
                    local name = getVehicleNameFromModel ( v ) 
                    local row = guiGridListAddRow ( vehList ) 
                    guiGridListSetItemText ( vehList, row, 1, name, false, false ) 
                    guiGridListSetItemData ( vehList, row, 1, v ) 
                end 
            end 
        end 
         
        guiGridListSetSelectedItem ( vehList, 0, 1 ) 
        addEventHandler ( "onClientGUIClick", btnSpawn, spawnClickingFunctions ) 
        addEventHandler ( "onClientGUIClick", btnClose, spawnClickingFunctions ) 
    end 
end ) 
  
  
function spawnClickingFunctions ( ) 
    if ( source == btnClose ) then 
        closeWindow ( localPlayer ) 
    elseif ( source == btnSpawn ) or getKeyState( "space" ) == true then 
        local row, col = guiGridListGetSelectedItem ( vehList ) 
        if ( row == -1 ) then 
            return exports['SAEGMessages']:sendClientMessage ( "Select a vehicle to be spawn.", 255, 255, 0 ) 
        end 
         
        local id = guiGridListGetItemData ( vehList, row, 1 ) 
        triggerServerEvent ( "SAEGSpawners:spawnVehicle", localPlayer, id, marker, true ) 
        closeWindow ( localPlayer ) 
    end 
end  
  
function closeWindow ( p ) 
    if ( not p or p == localPlayer ) then 
        removeEventHandler ( 'onClientMarkerLeave', marker, closeWindow ) 
        marker = nil 
        guiSetVisible ( window, false ) 
        showCursor ( false ) 
        guiGridListClear ( vehList ) 
        removeEventHandler ( "onClientGUIClick", btnSpawn, spawnClickingFunctions ) 
        removeEventHandler ( "onClientGUIClick", btnClose, spawnClickingFunctions ) 
        unbindKey ( "space", "down", spawnClickingFunctions ) 
    end 
end 
addEvent ( "SAEGSpawners:CloseWindow", true ) 
addEventHandler ( "SAEGSpawners:CloseWindow", root, closeWindow ) 
  

Link to comment
Get the element data of vip and check it then set Netro

here right ?

data = { 
    -- Free: { x, y, z [, rz=0, sx=x, sy=y, sz=y ] } 
    ['Free'] = { 
        { 1538.88, -1686.07, 13.55, 90  }, 
        { 1188.35, -1331.75, 13.56 }, 
        { 2034.61, -1437.47, 17.32, 140 }, 
        { 1374.35, 416.79, 19.78, 68.7 },  
        { 1624.37, 1817.87, 10.82 }, 
        { 2578.49, 1978.19, 10.82, -90 }, 
        { -331.47, 1063.28, 19.74, -90 }, 
        { -1504.19, 2533.95, 55.69, 90 }, 
        { -2641.08, 620.4, 14.45, 90 }, 
        { -2206.39, -2299.49, 30.63, 324 }, 
        { -1568.97, 653.7, 7.19, 180 }, 
        { 2242.02, 26.46, 26.44 } 
    }, 
    ---- END OF FREE -- Start of Jobs -- 
     
    -- { job, x, y, z, { r, g, b } [, rz=0, sx=x, sy=y, sz=y ] } 
    ['Jobs'] = { 
        { "Criminal", 2138.91, -1727.17, 13.54, { 255, 50, 50 }, -90 }, 
        { "Criminal", 1619.44, -1515.73, 13.58, { 255, 50, 50 }, 180 }, 
        { "Criminal", -1850.41, 587.29, 35.16, { 255, 50, 50 }, 0 }, 
        { "Criminal", -2530.29, -602.73, 132.56, { 255, 50, 50 }, 180 }, 
        { "Criminal", 1055.93, 2161.46, 10.82, { 255, 50, 50 }, 90 }, 
        { "Criminal", 2449.5, 1328.18, 10.82, { 255, 50, 50 }, 0 }, 
         
        { "Mechanic", 2283.34, -2350.81, 13.55, { 255, 255, 0 }, 41.5 }, 
        { "Mechanic", -1705.72, 389.96, 7.18, { 255, 255, 0 }, 230.3 }, 
        { "Mechanic", 1657.99, 2195.29, 10.82, { 255, 255, 0 }, 90 }, 
         
        { "Medic", 1179.02, -1339.01, 13.86, { 0, 255, 255 }, -90 }, 
        { "Medic", 1179.02, -1309, 13.86, { 0, 255, 255 }, -90 }, 
        { "Medic",  1590.05, 1820.54, 10.82, { 0, 255, 255 }, 0 }, 
         
        { "Police Officer", 1555.09, -1610.62, 13.38, { 0, 100, 255 }, 180 }, 
        { "Police Officer", 1565, -1610.62, 13.38, { 0, 100, 255 }, 180 }, 
        { "Police Officer", 1575, -1610.62, 13.38, { 0, 100, 255 }, 180 }, 
        { "Police Officer", -1612.39, 674.73, 7.19, { 0, 100, 255 }, 180 }, 
        { "Police Officer", -1606, 674.73, 7.19, { 0, 100, 255 }, 180 }, 
        { "Police Officer", -1600.5, 674.73, 7.19, { 0, 100, 255 }, 180 }, 
        { "Police Officer", -1594.2, 674.73, 7.19, { 0, 100, 255 }, 180 }, 
        { "Police Officer", -1587.7, 674.73, 7.19, { 0, 100, 255 }, 180 }, 
        { "Police Officer", 2251.78, 2477.21, 10.82, { 0, 100, 255 }, 180 }, 
        { "Police Officer", 2256.34, 2477.21, 10.82, { 0, 100, 255 }, 180 }, 
        { "Police Officer", 2259.96, 2477.21, 10.82, { 0, 100, 255 }, 180 }, 
        { "Police Officer", 2269.49, 2477.21, 10.82, { 0, 100, 255 }, 180 }, 
        { "Police Officer", 2273.05, 2477.21, 10.82, { 0, 100, 255 }, 180 }, 
        { "Police Officer", 2277.39, 2477.21, 10.82, { 0, 100, 255 }, 180 }, 
        { "Police Officer", 2281.58, 2477.21, 10.82, { 0, 100, 255 }, 180 }, 
         
        { "Fisherman", 2103.36, -103.16, 2.26, { 255, 255, 0 }, 116.2, 2100.68, -96.94, 1.3 }, 
         
        { "Detective", 1569.99, -1710.21, 5.89, { 0, 120, 255 }, 0 }, 
        { "Detective", 1574.21, -1710.33, 5.89, { 0, 120, 255 }, 0 }, 
        { "Detective", 1578.35, -1710.6, 5.89,  { 0, 120, 255 }, 0 }, 
        { "Detective", 2251.78, 2443.35, 10.82, { 0, 120, 255 }, 0 }, 
        { "Detective", 2256.34, 2443.35, 10.82, { 0, 120, 255 }, 0 }, 
        { "Detective", 2259.96, 2443.35, 10.82, { 0, 120, 255 }, 0 }, 
        { "Detective", 2269.49, 2443.35, 10.82, { 0, 120, 255 }, 0 }, 
        { "Detective", 2273.05, 2443.35, 10.82, { 0, 120, 255 }, 0 }, 
        { "Detective", 2277.39, 2443.35, 10.82, { 0, 120, 255 }, 0 }, 
        { "Detective", 2281.58, 2443.35, 10.82, { 0, 120, 255 }, 0 }, 
        { "Detective", -1606, 651, 7.19, { 0, 120, 255 }, 0 }, 
        { "Detective", -1600.5, 651, 7.19, { 0, 120, 255 }, 0 }, 
        { "Detective", -1594.2, 651, 7.19, { 0, 120, 255 }, 0 }, 
        { "Detective", -1587.7, 651, 7.19, { 0, 120, 255 }, 0 }, 
        { "Detective", -1581, 651, 7.19, { 0, 120, 255 }, 0 }, 
         
        { "Pilot", 1983.21, -2301.92, 13.55, { 255, 255, 0 }, 90 }, 
        { "Pilot", -1243.48, -26.32, 14.15, { 255, 255, 0 }, 131 }, 
        { "Pilot", -1257.59, -12.07, 14.15, { 255, 255, 0 }, 131 }, 
        { "Pilot",1638.02, 1548.39, 10.8, { 255, 255, 0 }, 50 }, 
         
        { "Stunter", 1945.67, -1378, 18.58, { 200, 200, 0 }, 90 }, 
    } 
     
} 
  
JobVehicles = { 
    ['Free'] = { 468, 457, 412 }, 
    ['Criminal'] = { 405, 412, 457, 461 }, 
    ['Mechanic'] = { 525, 552, 443 }, 
    ['Police Officer'] = { 596, 597, 598, 599 }, 
    ['Medic'] = { 416 }, 
    ['Fisherman'] = { 453 }, 
    ['Detective'] = { 596, 597, 598, 599, 402, 475, 496 }, 
    ['Pilot'] = { 511, 512, 513, 519, 593 }, 
    ['Stunter'] = { 481, 509, 510, 461, 471 } 
} 
  
VipVehicles = {  
    [0] = { }, -- None 
    [1] = { 522, }, -- Bronze 
    [2] = { 522, 560, }, -- Silver 
    [3] = { 522, 560, 411, }, -- gold 
    [4] = { 411, 522, 560, 546, } -- premium 
} 
  
  

Link to comment

No, they're just tables

Copy this code replace it with server side, it should works

local spawners = { 
    ['Free'] = { }, 
    ['Job'] = { } 
} 
local spawnedVehciles = { } 
function createFreeSpawner ( x, y, z, rz, sx, sy, sz ) 
    local i = #spawners['Free']+1 
    local z = z - 1 
    local sx, sy, sz = sx or x, sy or y, sz or z+1.5 
    local rz = rz or 0 
    spawners['Free'][i] = createMarker ( x, y, z, 'cylinder', 2, 255, 255, 255, 120 ) 
    setElementData ( spawners['Free'][i], "SpawnCoordinates", { sx, sy, sz, rz } ) 
    setElementData ( spawners['Free'][i], "SAEGVehicles:SpawnVehicleList", JobVehicles['Free'] ) 
    setElementData ( spawners['Free'][i], "SAEGVehicles:JobRestriction", false ) 
    addEventHandler ( "onMarkerHit", spawners['Free'][i], onSpawnerHit ) 
    return spawners['Free'][i] 
end 
  
function createJobSpawner ( job, x, y, z, colors, rz, sx, sy, sz ) 
    local i = #spawners['Job']+1 
    local z = z - 1 
    local sx, sy, sz = sx or x, sy or y, sz or z+1.5 
    local rz = rz or 0 
    local r, g, b = unpack ( colors ) 
    spawners['Job'][i] = createMarker ( x, y, z, 'cylinder', 2, r, g, b, 120 ) 
    setElementData ( spawners['Job'][i], "SpawnCoordinates", { sx, sy, sz, rz } ) 
    setElementData ( spawners['Job'][i], "SAEGVehicles:SpawnVehicleList", JobVehicles[job] ) 
    setElementData ( spawners['Job'][i], "SAEGVehicles:JobRestriction", tostring ( job ) ) 
    addEventHandler ( "onMarkerHit", spawners['Job'][i], onSpawnerHit ) 
    return spawners['Job'][i] 
end 
   
function onSpawnerHit ( p ) 
    local job = string.lower ( getElementData ( source, "SAEGVehicles:JobRestriction" ) or "false" ) 
    if ( job == 'false' ) then job = false end 
    local pJob =  string.lower ( getElementData ( p, "Job" ) or "" ) 
    if ( job ) then 
        if ( pJob ~= job ) then 
            exports['SAEGMessages']:sendClientMessage ( "This spawner is for the "..job.." job. You're not in the "..job.." job.", p, 255, 140, 40 ) 
            return 
        end 
    end 
     
    if ( getElementType ( p ) == 'player' and not isPedInVehicle ( p ) ) then 
        local list = getElementData ( source, "SAEGVehicles:SpawnVehicleList" ); 
        triggerClientEvent ( p, 'SAEGSpawners:ShowClientSpawner', p, list, source ) 
        triggerEvent ( "SAEGSpawners:onPlayerOpenSpawner", source, p ) 
    end 
end 
   
addEvent ( "SAEGSpawners:spawnVehicle", true ) 
addEventHandler ( "SAEGSpawners:spawnVehicle", root, function ( id, x, y, z, rz, job ) 
    local c = exports['SAEGAntiRestart']:createPlayerVehicle ( source, id, x, y, z, rz, true, job ) 
     if ( exports.SAEGVIP:isPlayerVIP ( ) ) then 
    addVehicleUpgrade(c, 1010) 
    end 
end ) 
   
for i, v in pairs ( data ) do 
    if ( i == 'Free' ) then 
        for k, e in ipairs ( v ) do 
            createFreeSpawner ( unpack ( e ) ) 
        end 
    elseif ( i == 'Jobs' ) then 
        for k, e in ipairs ( v ) do 
            createJobSpawner ( unpack ( e ) ) 
        end 
    end 
end 
  
addEvent ( "SAEGSpawners:onPlayerOpenSpawner", true ) 

Link to comment
No, they're just tables

Copy this code replace it with server side, it should works

local spawners = { 
    ['Free'] = { }, 
    ['Job'] = { } 
} 
local spawnedVehciles = { } 
function createFreeSpawner ( x, y, z, rz, sx, sy, sz ) 
    local i = #spawners['Free']+1 
    local z = z - 1 
    local sx, sy, sz = sx or x, sy or y, sz or z+1.5 
    local rz = rz or 0 
    spawners['Free'][i] = createMarker ( x, y, z, 'cylinder', 2, 255, 255, 255, 120 ) 
    setElementData ( spawners['Free'][i], "SpawnCoordinates", { sx, sy, sz, rz } ) 
    setElementData ( spawners['Free'][i], "SAEGVehicles:SpawnVehicleList", JobVehicles['Free'] ) 
    setElementData ( spawners['Free'][i], "SAEGVehicles:JobRestriction", false ) 
    addEventHandler ( "onMarkerHit", spawners['Free'][i], onSpawnerHit ) 
    return spawners['Free'][i] 
end 
  
function createJobSpawner ( job, x, y, z, colors, rz, sx, sy, sz ) 
    local i = #spawners['Job']+1 
    local z = z - 1 
    local sx, sy, sz = sx or x, sy or y, sz or z+1.5 
    local rz = rz or 0 
    local r, g, b = unpack ( colors ) 
    spawners['Job'][i] = createMarker ( x, y, z, 'cylinder', 2, r, g, b, 120 ) 
    setElementData ( spawners['Job'][i], "SpawnCoordinates", { sx, sy, sz, rz } ) 
    setElementData ( spawners['Job'][i], "SAEGVehicles:SpawnVehicleList", JobVehicles[job] ) 
    setElementData ( spawners['Job'][i], "SAEGVehicles:JobRestriction", tostring ( job ) ) 
    addEventHandler ( "onMarkerHit", spawners['Job'][i], onSpawnerHit ) 
    return spawners['Job'][i] 
end 
   
function onSpawnerHit ( p ) 
    local job = string.lower ( getElementData ( source, "SAEGVehicles:JobRestriction" ) or "false" ) 
    if ( job == 'false' ) then job = false end 
    local pJob =  string.lower ( getElementData ( p, "Job" ) or "" ) 
    if ( job ) then 
        if ( pJob ~= job ) then 
            exports['SAEGMessages']:sendClientMessage ( "This spawner is for the "..job.." job. You're not in the "..job.." job.", p, 255, 140, 40 ) 
            return 
        end 
    end 
     
    if ( getElementType ( p ) == 'player' and not isPedInVehicle ( p ) ) then 
        local list = getElementData ( source, "SAEGVehicles:SpawnVehicleList" ); 
        triggerClientEvent ( p, 'SAEGSpawners:ShowClientSpawner', p, list, source ) 
        triggerEvent ( "SAEGSpawners:onPlayerOpenSpawner", source, p ) 
    end 
end 
   
addEvent ( "SAEGSpawners:spawnVehicle", true ) 
addEventHandler ( "SAEGSpawners:spawnVehicle", root, function ( id, x, y, z, rz, job ) 
    local c = exports['SAEGAntiRestart']:createPlayerVehicle ( source, id, x, y, z, rz, true, job ) 
     if ( exports.SAEGVIP:isPlayerVIP ( ) ) then 
    addVehicleUpgrade(c, 1010) 
    end 
end ) 
   
for i, v in pairs ( data ) do 
    if ( i == 'Free' ) then 
        for k, e in ipairs ( v ) do 
            createFreeSpawner ( unpack ( e ) ) 
        end 
    elseif ( i == 'Jobs' ) then 
        for k, e in ipairs ( v ) do 
            createJobSpawner ( unpack ( e ) ) 
        end 
    end 
end 
  
addEvent ( "SAEGSpawners:onPlayerOpenSpawner", true ) 

Nitro Work for all players not only for vip's palyers

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