Jump to content

Porque No Me Sale La Gui?


Monsthers

Recommended Posts

Hola a todos, bueh e conseguido este script en la comunidad es de dar un spawn a carros! los que yo quiera poner! es el que mas me gusto pero ese no es el problema, cuando lo baje venia con 1 solo createMarker y yo le agrege 11 mas pero al agregarlos los 11 mas ninguno abre, si pongolo solo 1 funciona pero si agrego los otros 11 no quiere salir la gui! ¿Que problema tendra? Aqui el client.lua

local vehicleMarker = createMarker (1538.88,-1686.07,13.55,"cylinder", 3, 0,0,0 ) 
local vehicleMarker = createMarker (1188.35,-1331.75,13.56,"cylinder", 3, 0,0,0 ) 
local vehicleMarker = createMarker (2034.61,-1437.47,17.32,"cylinder", 3, 0,0,0 ) 
local vehicleMarker = createMarker (1374.35,416.79,19.78,"cylinder", 3, 0,0,0 ) 
local vehicleMarker = createMarker (1624.37,1817.87,10.82,"cylinder", 3, 0,0,0 ) 
local vehicleMarker = createMarker (2578.49,1978.19,10.82,"cylinder", 3, 0,0,0 ) 
local vehicleMarker = createMarker (-331.47,1063.28,19.74,"cylinder", 3, 0,0,0 ) 
local vehicleMarker = createMarker (-1504.19,2533.95,55.69,"cylinder", 3, 0,0,0 ) 
local vehicleMarker = createMarker (-2641.08,620.4,14.45,"cylinder", 3, 0,0,0 ) 
local vehicleMarker = createMarker (-2206.39,-2299.49,30.63,"cylinder", 3, 0,0,0 ) 
local vehicleMarker = createMarker (-1568.97,653.7,7.19,"cylinder", 3, 0,0,0 ) 
local vehicleMarker = createMarker (2242.02,26.46,26.44,"cylinder", 3, 0,0,0 ) 
-- Blip Of Spawn Cars 
local VehicleBlip = createBlip (1538.88,-1686.07,13.55,35,0, 0, 0, 0, 0, 0, 250) 
local VehicleBlip = createBlip (1188.35,-1331.75,13.56,35,0, 0, 0, 0, 0, 0, 250) 
local VehicleBlip = createBlip (2034.61,-1437.47,17.32,35,0, 0, 0, 0, 0, 0, 250) 
local VehicleBlip = createBlip (1374.35,416.79,19.78,35,0, 0, 0, 0, 0, 0, 250) 
local VehicleBlip = createBlip (1624.37,1817.87,10.82,35,0, 0, 0, 0, 0, 0, 250) 
local VehicleBlip = createBlip (2578.49,1978.19,10.82,35,0, 0, 0, 0, 0, 0, 250) 
local VehicleBlip = createBlip (-331.47,1063.28,19.74,35,0, 0, 0, 0, 0, 0, 250) 
local VehicleBlip = createBlip (-1504.19,2533.95,55.69,35,0, 0, 0, 0, 0, 0, 250) 
local VehicleBlip = createBlip (-2641.08,620.4,14.45,35,0, 0, 0, 0, 0, 0, 250) 
local VehicleBlip = createBlip (-2206.39,-2299.49,30.63,35,0, 0, 0, 0, 0, 0, 250) 
local VehicleBlip = createBlip (-1568.97,653.7,7.19,35,0, 0, 0, 0, 0, 0, 250) 
local VehicleBlip = createBlip (2242.02,26.46,26.44,35,0, 0, 0, 0, 0, 0, 250) 
outputDebugString("Blip visible distance: "..getBlipVisibleDistance(blip)) --250 
setBlipVisibleDistance(blip, 250) 
  
        window = guiCreateWindow(553, 212, 270, 241, "Spawn Cars", false) 
        guiWindowSetSizable(window, false) 
        guiSetAlpha(window, 1.00) 
  
        carlist = guiCreateGridList(9, 29, 254, 143, false, window) 
        guiGridListAddColumn(carlist, "Free Cars", 0.9) 
        guiGridListAddColumn(carlist, "ID" , 0) 
         
        spawn = guiCreateButton(18, 191, 96, 40, "Spawn Car", false, window) 
        guiSetFont(spawn, "default-bold-small") 
        guiSetProperty(spawn, "NormalTextColour", "FF01D51A") 
        close = guiCreateButton(167, 191, 93, 40, "Close Car List", false, window) 
        guiSetFont(close, "default-bold-small") 
        guiSetProperty(close, "NormalTextColour", "FF31491A")     
        guiSetVisible(window , false) 
  
         
       cars = { 
       {"Alpha" , 602 }, 
       {"BMX" , 481 }, 
       {"Club", 589}, 
       {"Faggio" , 462 }, 
       } 
        
     function addCars ()  
        for i , cars in ipairs (cars) do 
           local row = guiGridListAddRow(carlist) 
            guiGridListSetItemText(carlist,row,1,cars[1],false,false) 
            guiGridListSetItemText(carlist,row,2,cars[2],false,false) 
             
        end 
     end 
     addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),addCars)   
        
     function closegui () 
     if (source == close) then 
         guiSetVisible(window , false) 
         showCursor(false) 
        end 
    end 
    addEventHandler("onClientGUIClick" ,close , closegui) 
     
     
  
     function showgui (hitElement) 
     if getElementType(hitElement) == "player" and (hitElement == localPlayer ) and (not isPedInVehicle(localPlayer)) then 
         if not guiGetVisible(window) then 
                guiSetVisible(window , true) 
                showCursor(true) 
            end 
        end   
    end 
     
    addEventHandler("onClientMarkerHit" , vehicleMarker , showgui) 
     
     
  
     function showguil (leaveElement) 
         if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then 
             if guiGetVisible(window) then 
                guiSetVisible(window , false) 
                showCursor(false) 
            end 
        end 
    end 
     
  
addEventHandler("onClientMarkerLeave" , vehicleMarker,showguil ) 
  
    function spawnFreeCars ()    
        if ( source == spawn ) then  
         
           local row,col = guiGridListGetSelectedItem(carlist) 
           local modelid = guiGridListGetItemText(carlist,row,2) 
           local carN = guiGridListGetItemText(carlist,row,1) 
           if ( row and col ) then  
             triggerServerEvent("spawn",localPlayer,modelid,carN) 
            end 
        end 
    end 
addEventHandler("onClientGUIClick",spawn,spawnFreeCars) 
  
  
  
  

Aqui la server.lua

    Vehicle = {} 
    function spawnCars(modelid , carN) 
            if (isElement(Vehicle[source])) then  
            outputChatBox("You can only spawn one free car to get another one you have to destroy your previous car using /des " , player,255,0,0) 
            return end  
            if ( modelid and carN) then  
             local x,y,z = getElementPosition(source) 
             Vehicle[source] = createVehicle(modelid,x,y, z) 
             setElementData(source,"veh",Vehicle[source]) 
             warpPedIntoVehicle(source,Vehicle[source]) 
             outputChatBox("You have spawned "..tostring(carN).. " !" ,player,255,255,0) 
             setElementData(source , "vehN" , carN) 
               
            end 
    end 
addEvent("spawn",true) 
addEventHandler("spawn",root,spawnCars) 
  
    function dstrVeh (player)  
           local carName = getElementData(player,"vehN") 
           getPedOccupiedVehicle(player) 
           local Veh = getElementData(player ,"veh") 
            if (Veh) then  
             destroyElement(Veh) 
             outputChatBox("Your Spawner :[ " ..tostring(carName).." ] is destroyed",player,255,255,0) 
              
           end 
      end 
addCommandHandler("des",dstrVeh) 
  
  

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...