Trevor1 Posted December 31, 2016 Share Posted December 31, 2016 (edited) how i can spawn car with key any function or any thing for do it pls Spawner_c.lua Quote 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), "SACG:RPG Vehicle", false) local vehList = guiCreateGridList((rsx*9), (rsy*26), (rsx*335), (rsy*315), false, window) local btnSpawn = guiCreateButton((rsx*9), (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(vehid, "id", 0.9) guiGridListAddColumn(vehList, "Vehicle", 0.9) local marker = nil addEvent ( "NGSpawners:ShowClientSpawner", true ) addEventHandler ( "NGSpawners:ShowClientSpawner", root, function ( cars, mrker ) if ( wasEventCancelled ( ) ) then return end if ( not guiGetVisible ( window ) ) then bindKey ( "num_1", "down", spawnClickingFunctions ) bindKey ( "num_2", "down", spawnClickingFunctions ) showCursor ( true ) guiSetVisible ( window, true ) guiGridListClear ( vehList ) addEventHandler ( 'onClientMarkerLeave', mrker, closeWindow ) marker = mrker job = getElementData ( marker, "NGVehicles: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.NGVIP:isPlayerVIP ( ) ) then local level = exports.NGVIP: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( "num_1" ) == true then local row, col = guiGridListGetSelectedItem ( vehList ) if ( row == -1 ) then return exports['NGMessages']:sendClientMessage ( "Select a vehicle to be spawn.", 255, 255, 0 ) end function af(button, press) if button == "1" and press == true then triggerServerEvent("bo", resourceRoot) end end local id = guiGridListGetItemData ( vehList, row, 1 ) triggerServerEvent ( "NGSpawners: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 ( "num_1", "down", spawnClickingFunctions ) unbindKey ( "num_2", "down", spawnClickingFunctions ) end end addEvent ( "NGSpawners:CloseWindow", true ) addEventHandler ( "NGSpawners:CloseWindow", root, closeWindow ) Spawner_s.lua Quote 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'] = createMarker ( x, y, z, 'cylinder', 2, 255, 255, 255, 120 ) setElementData ( spawners['Free'], "SpawnCoordinates", { sx, sy, sz, rz } ) setElementData ( spawners['Free'], "NGVehicles:SpawnVehicleList", JobVehicles['Free'] ) setElementData ( spawners['Free'], "NGVehicles:JobRestriction", false ) addEventHandler ( "onMarkerHit", spawners['Free'], onSpawnerHit ) return spawners['Free']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'] = createMarker ( x, y, z, 'cylinder', 2, r, g, b, 120 ) setElementData ( spawners['Job'], "SpawnCoordinates", { sx, sy, sz, rz } ) setElementData ( spawners['Job'], "NGVehicles:SpawnVehicleList", JobVehicles[job] ) setElementData ( spawners['Job'], "NGVehicles:JobRestriction", tostring ( job ) ) addEventHandler ( "onMarkerHit", spawners['Job'], onSpawnerHit ) return spawners['Job']end function onSpawnerHit ( p ) local job = string.lower ( getElementData ( source, "NGVehicles: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['NGMessages']: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, "NGVehicles:SpawnVehicleList" ); triggerClientEvent ( p, 'NGSpawners:ShowClientSpawner', p, list, source ) triggerEvent ( "NGSpawners:onPlayerOpenSpawner", source, p ) endend addEvent ( "NGSpawners:spawnVehicle", true )addEventHandler ( "NGSpawners:spawnVehicle", root, function ( id, x, y, z, rz, job ) local c = exports['NGAntiRestart']: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 endend addEvent ( "NGSpawners:onPlayerOpenSpawner", true ) Edited December 31, 2016 by Trevor1 Link to comment
Dimos7 Posted December 31, 2016 Share Posted December 31, 2016 what do you mean spawn create? for key it item you can create or data a player has for that vehicle Link to comment
Trevor1 Posted December 31, 2016 Author Share Posted December 31, 2016 1 minute ago, Dimos7 said: what do you mean spawn create? for key it item you can create or data a player has for that vehicle when i press 1 i will spawn sanchez and when i prees 2 i spawn cady like that.. Link to comment
Dimos7 Posted December 31, 2016 Share Posted December 31, 2016 you mean create a vehicle when a player click a button right then you need createVehicle Link to comment
Trevor1 Posted December 31, 2016 Author Share Posted December 31, 2016 36 minutes ago, Dimos7 said: you mean create a vehicle when a player click a button right then you need createVehicle i want to like that http://imgur.com/a/dolnv Link to comment
Snow-Man Posted December 31, 2016 Share Posted December 31, 2016 As far as I know there is no support to people using leaked scripts. NG resources, if you need help about it ask xXMADEXx Link to comment
Trevor1 Posted December 31, 2016 Author Share Posted December 31, 2016 19 minutes ago, Snow-Man said: As far as I know there is no support to people using leaked scripts. NG resources, if you need help about it ask xXMADEXx how i can contact him give me his skype or fb Link to comment
Snow-Man Posted December 31, 2016 Share Posted December 31, 2016 Chech his Topic about NG resources I can't give you, because he don't want to share his fbk and skype PM Him Link to comment
koragg Posted January 1, 2017 Share Posted January 1, 2017 18 hours ago, Snow-Man said: As far as I know there is no support to people using leaked scripts. Well I found Nerd-Gaming's resources on github so I don't think that's leaked? (it's open-source?) Link to comment
Best-Killer Posted January 1, 2017 Share Posted January 1, 2017 11 hours ago, koragg said: Well I found Nerd-Gaming's resources on github so I don't think that's leaked? (it's open-source?) it's open-source 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