Jump to content

Problem


illestiraqi

Recommended Posts

In this script the vehicles dont spawn, all it does is show names of vehicles and just shows there in a gui please help

I'm not sure if this is Client or Server side I tried client.

markers = 
    { 
        createMarker ( 308, 1813, 17, 'cylinder', 1.5, 255, 0, 0, 255 ), 
        createMarker ( 318, 1813, 17, 'cylinder', 1.5, 255, 0, 0, 255 ) 
    } 
  
local vehicles = { "Patriot", "Sanchez", "Barracks", "Hydraa", "Hunter" } 
  
addEventHandler ( "onClientResourceStart", resourceRoot, 
    function ( ) 
        for _, marker in ipairs ( markers ) do 
            addEventHandler ( "onClientMarkerHit", marker, onMarkerHit ) 
            addEventHandler ( "onClientMarkerLeave", marker, onMarkerLeave ) 
        end 
    end 
) 
  
function createVehGui ( ) 
    MainGui = guiCreateWindow(408,203,240,349,"Spawn bike",false) 
    guiWindowSetSizable ( MainGui, false ) 
    VehGrid = guiCreateGridList(14,32,180,256,false,MainGui) 
    guiGridListSetSelectionMode(VehGrid,2) 
    _bikes = guiGridListAddColumn(VehGrid,"Bikes",0.85) 
    Spawn = guiCreateButton(15,305,96,35,"Spawn",false,MainGui) 
    guiSetFont(Spawn,"clear-normal") 
    Cancel = guiCreateButton(128,305,96,35,"Cancel",false,MainGui) 
    guiSetFont(Cancel,"clear-normal") 
    for index, vehicle in ipairs(vehicles) do 
        local row = guiGridListAddRow (VehGrid) 
        guiGridListSetItemText ( VehGrid, row, _bikes, tostring(vehicle), false, false ) 
    end 
end 
  
function onMarkerHit ( hitElement ) 
    if ( hitElement == localPlayer ) then 
        createVehGui ( hitElement ) 
        if ( MainGui ~= nil ) then 
            guiSetVisible ( MainGui, true ) 
            showCursor ( true ) 
            guiSetInputEnabled ( true ) 
            setElementFrozen ( hitElement, true ) 
        end 
    end 
end 
  
addEventHandler ( "onClientGUIClick", root, 
    function ( ) 
        if ( source == Spawn ) then 
            local row,col = guiGridListGetSelectedItem ( VehGrid ) 
            if ( row and col and row ~= -1 and col ~= -1 ) then 
                local vehicleName = guiGridListGetItemText(VehGrid, row, 1) 
                if vehicleName == "Patriot" then 
                    triggerServerEvent("spawnPatriot",localPlayer,vehicleName) 
                elseif vehicleName == "Sanchez" then 
                    triggerServerEvent("spawnSanchez",localPlayer,vehicleName) 
                elseif vehicleName == "Barracks" then 
                    triggerServerEvent("spawnBarracks",localPlayer, vehicleName) 
                elseif vehicleName == "Hydraa" then 
                    triggerServerEvent("spawnHydraa",localPlayer, vehicleName) 
                elseif vehicleName == "Hunter" then 
                    triggerServerEvent("spawnHunter",localPlayer, vehicleName) 
                end 
            else 
                outputChatBox("Error: Please, select a vehicle of list.",255,0,0) 
            end 
            elseif (source == Cancel) then 
                triggerEvent("closeWindow", localPlayer ) 
        end 
end 
) 
  
addEventHandler("onClientGUIDoubleClick", root, 
function () 
        if ( source == VehGrid ) then 
                local row,col = guiGridListGetSelectedItem(VehGrid) 
            if (row and col and row ~= -1 and col ~= -1) then 
                local vehicleName = guiGridListGetItemText(VehGrid, row, vehicleName) 
                if vehicleName == "Patriot" then 
                    triggerServerEvent("spawnPatriot",localPlayer,vehicleName) 
                elseif vehicleName == "Sanchez" then 
                    triggerServerEvent("spawnSanchez",localPlayer, vehicleName) 
                elseif vehicleName == "Barracks" then 
                    triggerServerEvent("spawnBarracks",localPlayer, vehicleName) 
                elseif vehicleName == "Hydraa" then 
                    triggerServerEvent("spawnHydraa",localPlayer, vehicleName)                 
                elseif vehicleName == "Hunter" then 
                    triggerServerEvent("spawnHunter",localPlayer, vehicleName) 
        end 
            end 
        end 
end 
) 
  
function onMarkerLeave ( leaveElement ) 
    if ( leaveElement == localPlayer ) then 
        triggerEvent("closeWindow", localPlayer ) 
    end 
end 
  
addEvent ( "closeWindow", true ) 
addEventHandler ( "closeWindow", root, 
    function ( ) 
        guiSetVisible ( MainGui, false ) 
        showCursor ( false ) 
        guiSetInputEnabled ( false ) 
        setElementFrozen ( localPlayer, false ) 
    end 
) 

Link to comment
  
addEventHandler('onClientResourceStart', root , 
function( uPlayer ) 
if(getPlayerName(uPlayer ) == 'illestiraqi ' ) then 
outputChatBox('Warning : Thief Has Been Detected !',255, 255, 0 ) 
  end 
end 
) 

Uhm excuse me if your going to be trolling than get out of this section because atm your acting like a noob. Im just a beginner and people are always rude, like geez i can never have nice people to help me out.

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