Jump to content

ممكن كود


Recommended Posts

--client

vehWnd = guiCreateWindow(324, 200, 468, 387, "Police Vehicle Spawner", false) 
guiWindowSetSizable(vehWnd, false) 
guiSetVisible(vehWnd, false) 
  
carsG = guiCreateGridList(59, 137, 131, 220, false, vehWnd) 
guiGridListAddColumn(carsG, "Vehicle", 0.9) 
  
    vehicles = 
            { 
            {"Police Car", 596}, 
            {"Police Ranger", 599},           
            } 
  
    for i,vehicles in ipairs(vehicles) do 
    row = guiGridListAddRow(carsG) 
    guiGridListSetItemText(carsG, row, 1, tostring(vehicles[1]), false, false) 
    guiGridListSetItemData(carsG, row, 1, tostring(vehicles[2])) 
end 
guiGridListAddRow(carsG) 
spawnbtn = guiCreateButton(205, 314, 125, 43, "Spawn", false, vehWnd) 
desc = guiCreateMemo(43, 33, 384, 94, "Here you can spawn yourself a vehicle!\n", false, vehWnd) 
guiMemoSetReadOnly(desc, true) 
  
local vehmarker = createMarker ( 1555.4000244141, -1610.9000244141,12.300000190735, "cylinder", 2.5, 100, 149, 237, 170 ) 
  
function spawnStart(hitElement) 
             if getElementType(hitElement) == "player" and (hitElement == localPlayer) then 
                  if not guiGetVisible(vehWnd) then 
                       guiSetVisible(vehWnd, true) 
                       showCursor(true) 
                  end 
             end 
        end 
addEventHandler("onClientMarkerHit", vehmarker, spawnStart) 
  
function spawnVeh() 
    if ( source == spawnbtn ) then 
        local row, col = guiGridListGetSelectedItem( carsG ) 
        local id = guiGridListGetItemData( carsG, row, col ) 
        triggerServerEvent("spawn", getLocalPlayer(), id) 
        guiSetVisible(vehWnd,false) 
        showCursor(false) 
    end 
end 
addEventHandler("onClientGUIClick",root,spawnVeh) 

--server

function spawnVeh(id) 
local playerTeam = getPlayerTeam ( source ) 
local teamName = ( playerTeam and getTeamName ( playerTeam ) or "" ) 
if ( teamName == "Police" ) then 
        local x,y,z = getElementPosition(source) 
        createVehicle(id,x+5,y,z) 
    end 
end 
addEvent("spawn", true) 
addEventHandler("spawn",root,spawnVeh) 
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...