aL.Kfo Posted July 31, 2015 Share Posted July 31, 2015 (edited) فية مشكلة ان نزلت موتر مايختفي الثاني ابية اذا نزل الموتر الاول يختفي الثاني .. شوف اخر 4 اسطر بالكود جربتها ماضبط ويعطيكم العافيةة .. --------------------------------------- --SCRIPT NAME: Vehicle Spawners --START OF DEVELOPMENT: Thursday, January 1st, 2015. 12:15PM GMT + 1 --END OF DEVELOPMENT: Thursday, January 1st, 2015. 22:03PM GMT + 1 --PURPOSE: Intended for Roleplay Servers --DEVELOPER: Danz2001 aka Danzy --COPYRIGHTED MEANING YOU CAN EDIT THIS SCRIPT TO YOUR LIKING AS LONG AS YOU KEEP THE CREDITS --------------------------------------- addEvent("spawnSelectedVehicle", true) function spawnSelectedVehicle (selectedVehicle, cost) x, y, z = getElementPosition(source) _, _, rz = getElementRotation(source) vehID = getVehicleModelFromName(selectedVehicle) getVehicleNameFromModel(selectedVehicle) vehicle = createVehicle(vehID, x, y, z) setElementRotation(vehicle, _, _, rz) takePlayerMoney(source, cost) warpPedIntoVehicle(source, vehicle) setVehicleColor(vehicle, 255, 255, 255) end addEventHandler("spawnSelectedVehicle", root, spawnSelectedVehicle) function destroySpawnedVehicle () if not isElement(vehicle) then return outputChatBox("Error: No spawned vehicle", source, 255, 0, 0) end speedx, speedy, speedz = getElementVelocity(vehicle) vehiclespeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) kph = vehiclespeed * 180 mph = vehiclespeed * 111.847 if mph > 6 then outputChatBox("You must move under 6 MPH (10 KPH), you are at "..math.floor(mph).." MPH ("..math.floor(kph).." KPH)", source, 255, 255, 0) return false end if isElement(vehicle) then destroyElement(vehicle) outputChatBox("Destroyed your spawned vehicle, thank you", source, 0, 255, 0) end end addCommandHandler("dsv", destroySpawnedVehicle) function getspeed (player) veh = getPedOccupiedVehicle(player) speedx, speedy, speedz = getElementVelocity(veh) vehiclespeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) kph = vehiclespeed * 180 mph = vehiclespeed * 111.847 outputChatBox("My Speed: "..math.floor(mph).." MPH ("..math.floor(kph).." KPH)", player, 0, 255, 0) end addCommandHandler("speed", getspeed) function velocity () setAircraftMaxVelocity(1.5) end addEventHandler("onResourceStart", resourceRoot, velocity) addEventHandler("onPlayerQuit",root,function() if vehicle then if isElement( vehicle ) then destroyElement(vehicle) end vehicle = nil end end) Edited July 31, 2015 by Guest Link to comment
H25 Posted July 31, 2015 Share Posted July 31, 2015 --------------------------------------- --SCRIPT NAME: Vehicle Spawners --START OF DEVELOPMENT: Thursday, January 1st, 2015. 12:15PM GMT + 1 --END OF DEVELOPMENT: Thursday, January 1st, 2015. 22:03PM GMT + 1 --PURPOSE: Intended for Roleplay Servers --DEVELOPER: Danz2001 aka Danzy --COPYRIGHTED MEANING YOU CAN EDIT THIS SCRIPT TO YOUR LIKING AS LONG AS YOU KEEP THE CREDITS --------------------------------------- VehicleTable = { {":O", 0}, {"Mountain Bike", 0}, {"Bike", 0}, {"BMX", 0}, {"Moonbeam", 0}, {"Sanchez", 0}, } local markers = { {1187.96, -1338.06, 12.57}, {2002.68, -1445.04, 12.56}, {1625.59, 1820.37, 9.82}, } gridlist = {} window = {} button = {} label = {} column = {} addEventHandler("onClientResourceStart", resourceRoot, function() local screenW, screenH = guiGetScreenSize() window[1] = guiCreateWindow((screenW - 348) / 2, (screenH - 393) / 2, 348, 393, "nil Vehicle Spawner", false) guiWindowSetSizable(window[1], false) guiSetVisible(window[1], false) button[1] = guiCreateButton(9, 357, 115, 26, "Spawn: nil", false, window[1]) guiSetFont(button[1], "default-bold-small") button[2] = guiCreateButton(223, 357, 115, 26, "Cancel", false, window[1]) guiSetFont(button[2], "default-bold-small") gridlist[1] = guiCreateGridList(11, 29, 327, 284, false, window[1]) column[1] = guiGridListAddColumn(gridlist[1], "Available Vehicles", 0.5) column[2] = guiGridListAddColumn(gridlist[1], "Cost", 0.5) label[1] = guiCreateLabel(10, 318, 328, 29, "To spawn a vehicle simply select it from the gridlist and\npress \"Spawn\", you will pay the specified cost", false, window[1]) guiSetFont(label[1], "default-bold-small") guiLabelSetColor(label[1], 0, 255, 0) for i, v in ipairs (VehicleTable) do row = guiGridListAddRow(gridlist[1]) guiGridListSetItemText(gridlist[1], row, column[1], v[1], false, false) guiGridListSetItemText(gridlist[1], row, column[2], v[2], false, false) end end ) addEventHandler("onClientGUIClick", guiRoot, function () row = guiGridListGetSelectedItem(gridlist[1]) if source == button[1] then if row and row ~= -1 then selectedVehicle = guiGridListGetItemText(gridlist[1], row, column[1]) cost = guiGridListGetItemText(gridlist[1], row, column[2]) triggerServerEvent("spawnSelectedVehicle", localPlayer, selectedVehicle, cost) guiSetVisible(window[1], false) showCursor(false) end elseif source == button[2] then guiSetVisible(window[1], false) showCursor(false) elseif row and row ~= -1 then selectedVehicle = guiGridListGetItemText(gridlist[1], row, column[1]) guiSetText(button[1], "Spawn: "..selectedVehicle) end end ) function createMarkersAroundHospitals () for i, v in ipairs(markers) do local x, y, z = unpack(v) marker = createMarker(x, y, z, "cylinder", 2, 255, 255, 255, 100) addEventHandler("onClientMarkerHit", marker, function(hitElement) if hitElement == localPlayer then guiSetVisible(window[1], true) showCursor(true) area = getZoneName(getElementPosition(localPlayer)) guiSetText(window[1], area.." Vehicle Spawner") if getPedOccupiedVehicle(localPlayer) then outputChatBox("Get out of your vehicle to use the spawner", 255, 0, 0) guiSetVisible(window[1], false) showCursor(false) end end end) end end addEventHandler("onClientResourceStart", resourceRoot, createMarkersAroundHospitals) local vehicle = {} addEventHandler("onPlayerQuit",root,function() if vehicle[source] then if isElement( vehicle[source] ) then destroyElement(vehicle[source]) end vehicle[source] = nil end end) انت مو ضايف جدول vehicle + حط متغير السيارة عند الانشاء vehicle[source] واذا بياخذ سيارة سو نفس طريقة الخروج من السيرفر و onPlayerQuit لازم تحطه في السيرفر Link to comment
aL.Kfo Posted July 31, 2015 Author Share Posted July 31, 2015 يعطيك العافية بس نفس الشي لا نزلت موتر الثاني مايختفي Link to comment
aL.Kfo Posted July 31, 2015 Author Share Posted July 31, 2015 (edited) هذا هو معليش صححوة : ) --------------------------------------- --SCRIPT NAME: Vehicle Spawners --START OF DEVELOPMENT: Thursday, January 1st, 2015. 12:15PM GMT + 1 --END OF DEVELOPMENT: Thursday, January 1st, 2015. 22:03PM GMT + 1 --PURPOSE: Intended for Roleplay Servers --DEVELOPER: Danz2001 aka Danzy --COPYRIGHTED MEANING YOU CAN EDIT THIS SCRIPT TO YOUR LIKING AS LONG AS YOU KEEP THE CREDITS --------------------------------------- addEvent("spawnSelectedVehicle", true) function spawnSelectedVehicle (selectedVehicle, cost) x, y, z = getElementPosition(source) _, _, rz = getElementRotation(source) vehID = getVehicleModelFromName(selectedVehicle) getVehicleNameFromModel(selectedVehicle) vehicle = createVehicle(vehID, x, y, z) setElementRotation(vehicle, _, _, rz) takePlayerMoney(source, cost) warpPedIntoVehicle(source, vehicle) setVehicleColor(vehicle, 255, 255, 255) end addEventHandler("spawnSelectedVehicle", root, spawnSelectedVehicle) function destroySpawnedVehicle () if not isElement(vehicle) then return outputChatBox("Error: No spawned vehicle", source, 255, 0, 0) end speedx, speedy, speedz = getElementVelocity(vehicle) vehiclespeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) kph = vehiclespeed * 180 mph = vehiclespeed * 111.847 if mph > 6 then outputChatBox("You must move under 6 MPH (10 KPH), you are at "..math.floor(mph).." MPH ("..math.floor(kph).." KPH)", source, 255, 255, 0) return false end if isElement(vehicle) then destroyElement(vehicle) outputChatBox("Destroyed your spawned vehicle, thank you", source, 0, 255, 0) end end addCommandHandler("dsv", destroySpawnedVehicle) function getspeed (player) veh = getPedOccupiedVehicle(player) speedx, speedy, speedz = getElementVelocity(veh) vehiclespeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) kph = vehiclespeed * 180 mph = vehiclespeed * 111.847 outputChatBox("My Speed: "..math.floor(mph).." MPH ("..math.floor(kph).." KPH)", player, 0, 255, 0) end addCommandHandler("speed", getspeed) function velocity () setAircraftMaxVelocity(1.5) end addEventHandler("onPlayerQuit",root,function() if vehicle then if isElement( vehicle ) then destroyElement(vehicle) end vehicle = nil end end) addEventHandler("onResourceStart", resourceRoot, velocity) end) Edited July 31, 2015 by Guest Link to comment
#Wizard Posted July 31, 2015 Share Posted July 31, 2015 local vehicle = {} addEventHandler("onPlayerQuit",root,function() if vehicle[source] then if isElement( vehicle[source] ) then destroyElement(vehicle[source]) end vehicle[source] = nil end end) ^ سيرفر بس ! Link to comment
aL.Kfo Posted July 31, 2015 Author Share Posted July 31, 2015 جربت سويت السيرفر --------------------------------------- --SCRIPT NAME: Vehicle Spawners --START OF DEVELOPMENT: Thursday, January 1st, 2015. 12:15PM GMT + 1 --END OF DEVELOPMENT: Thursday, January 1st, 2015. 22:03PM GMT + 1 --PURPOSE: Intended for Roleplay Servers --DEVELOPER: Danz2001 aka Danzy --COPYRIGHTED MEANING YOU CAN EDIT THIS SCRIPT TO YOUR LIKING AS LONG AS YOU KEEP THE CREDITS --------------------------------------- addEvent("spawnSelectedVehicle", true) function spawnSelectedVehicle (selectedVehicle, cost) x, y, z = getElementPosition(source) _, _, rz = getElementRotation(source) vehID = getVehicleModelFromName(selectedVehicle) getVehicleNameFromModel(selectedVehicle) vehicle = createVehicle(vehID, x, y, z) setElementRotation(vehicle, _, _, rz) takePlayerMoney(source, cost) warpPedIntoVehicle(source, vehicle) setVehicleColor(vehicle, 255, 255, 255) end addEventHandler("spawnSelectedVehicle", root, spawnSelectedVehicle) function destroySpawnedVehicle () if not isElement(vehicle) then return outputChatBox("Error: No spawned vehicle", source, 255, 0, 0) end speedx, speedy, speedz = getElementVelocity(vehicle) vehiclespeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) kph = vehiclespeed * 180 mph = vehiclespeed * 111.847 if mph > 6 then outputChatBox("You must move under 6 MPH (10 KPH), you are at "..math.floor(mph).." MPH ("..math.floor(kph).." KPH)", source, 255, 255, 0) return false end if isElement(vehicle) then destroyElement(vehicle) outputChatBox("Destroyed your spawned vehicle, thank you", source, 0, 255, 0) end end addCommandHandler("dsv", destroySpawnedVehicle) function getspeed (player) veh = getPedOccupiedVehicle(player) speedx, speedy, speedz = getElementVelocity(veh) vehiclespeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) kph = vehiclespeed * 180 mph = vehiclespeed * 111.847 outputChatBox("My Speed: "..math.floor(mph).." MPH ("..math.floor(kph).." KPH)", player, 0, 255, 0) end addCommandHandler("speed", getspeed) function velocity () setAircraftMaxVelocity(1.5) end addEventHandler("onResourceStart", resourceRoot, velocity) addEventHandler("onPlayerQuit",root,function() if vehicle then if isElement( vehicle ) then destroyElement(vehicle) end vehicle = nil end end) Link to comment
H25 Posted July 31, 2015 Share Posted July 31, 2015 (edited) --------------------------------------- --SCRIPT NAME: Vehicle Spawners --START OF DEVELOPMENT: Thursday, January 1st, 2015. 12:15PM GMT + 1 --END OF DEVELOPMENT: Thursday, January 1st, 2015. 22:03PM GMT + 1 --PURPOSE: Intended for Roleplay Servers --DEVELOPER: Danz2001 aka Danzy --COPYRIGHTED MEANING YOU CAN EDIT THIS SCRIPT TO YOUR LIKING AS LONG AS YOU KEEP THE CREDITS --------------------------------------- local vehicle = {} addEvent("spawnSelectedVehicle", true) function spawnSelectedVehicle (selectedVehicle, cost) x, y, z = getElementPosition(source) _, _, rz = getElementRotation(source) vehID = getVehicleModelFromName(selectedVehicle) getVehicleNameFromModel(selectedVehicle) if isElement( vehicle[source] ) then destroyElement(vehicle[source]) end vehicle[source] = createVehicle(vehID, x, y, z) setElementRotation(vehicle[source], _, _, rz) takePlayerMoney(source, cost) warpPedIntoVehicle(source, vehicle[source]) setVehicleColor(vehicle[source], 255, 255, 255) end addEventHandler("spawnSelectedVehicle", root, spawnSelectedVehicle) function destroySpawnedVehicle (source) if not isElement(vehicle[source]) then return outputChatBox("Error: No spawned vehicle", source, 255, 0, 0) end speedx, speedy, speedz = getElementVelocity(vehicle[source]) vehiclespeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) kph = vehiclespeed * 180 mph = vehiclespeed * 111.847 if mph > 6 then outputChatBox("You must move under 6 MPH (10 KPH), you are at "..math.floor(mph).." MPH ("..math.floor(kph).." KPH)", source, 255, 255, 0) return false end if isElement(vehicle[source]) then destroyElement(vehicle[source]) outputChatBox("Destroyed your spawned vehicle, thank you", source, 0, 255, 0) end end addCommandHandler("dsv", destroySpawnedVehicle) function getspeed (player) veh = getPedOccupiedVehicle(player) speedx, speedy, speedz = getElementVelocity(veh) vehiclespeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) kph = vehiclespeed * 180 mph = vehiclespeed * 111.847 outputChatBox("My Speed: "..math.floor(mph).." MPH ("..math.floor(kph).." KPH)", player, 0, 255, 0) end addCommandHandler("speed", getspeed) function velocity () setAircraftMaxVelocity(1.5) end addEventHandler("onResourceStart", resourceRoot, velocity) addEventHandler("onPlayerQuit", root, function() if vehicle[source] then if isElement( vehicle[source] ) then destroyElement(vehicle[source]) end vehicle[source] = nil end end ) Edited July 31, 2015 by Guest Link to comment
aL.Kfo Posted July 31, 2015 Author Share Posted July 31, 2015 نفسه لا نزلت سياره ثم نزلت السياره الاولى ماتختفي اللي نزلتها اول شي Link to comment
H25 Posted July 31, 2015 Share Posted July 31, 2015 نفسه لا نزلت سياره ثم نزلت السياره الاولى ماتختفي اللي نزلتها اول شي كنت ناسي شي عدلته جرب الحين Link to comment
aL.Kfo Posted July 31, 2015 Author Share Posted July 31, 2015 يعطيكك العافيةة خيو .. ماقصرت Link to comment
H25 Posted July 31, 2015 Share Posted July 31, 2015 يعطيكك العافيةة خيو .. ماقصرت الله يعافيك حاضرين 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