Sasu Posted December 12, 2012 Share Posted December 12, 2012 Mi problema es que este script me bugea el server. Cuando se cierra la ventana de vehiculos, al hacer doble click en cualquier lado o tiempo es como que se selecciona de nuevo. Vehicles_C Wnd = guiCreateWindow ( 0.2, 0.2, 0.25, 0.5, "Vehiculos especiales de la Elite", true ) guiSetAlpha( Wnd, 1 ) button = guiCreateButton ( 0.01, 0.8, 0.50, 0.15, "Cerrar", true, Wnd ) button = guiCreateButton ( 0.01, 0.8, 0.50, 0.15, "Crear", true, Wnd ) label = guiCreateLabel ( 0.1, 0.1, 0.9, 0.1, "Bienvenido al panel de vehiculos de la Elite. Para obtener el vehiculo deseado, haz doble click en el.", true, Wnd ) showCursor(false) guiSetVisible( Wnd, false ) guiWindowSetSizable( Wnd, false ) guiWindowSetMovable( Wnd, true ) vehicles = { {"Sultan", 560}, {"HPV1000", 523}, {"Police LS", 596}, {"Police LV", 598}, {"Police Ranger", 599}, {"Hydra", 520}, {"Police Maverick", 497} } grid = guiCreateGridList(0.01, 0.2, 0.99, 0.5, true, Wnd) guiGridListAddColumn(grid, "Vehicles", 0.85) for i,veh in ipairs(vehicles) do row = guiGridListAddRow(grid) -- guiGridListSetItemText(grid, row, 1, tostring(veh[1]), false, false) guiGridListSetItemData(grid, row, 1, tostring(veh[2])) end function use() local row, col = guiGridListGetSelectedItem(grid) if (row and col and row ~= -1 and col ~= -1) then local model = tonumber(guiGridListGetItemData(grid, row, 1)) if model ~= "" then triggerServerEvent("CreVehicle", localPlayer, model) end end end addEventHandler("onClientDoubleClick", root, use, true) function close() if (source == button) then guiSetVisible(Wnd,false) showCursor(false) end end addEventHandler("onClientGUIClick", button, close) function showGUI2p() guiSetVisible(Wnd,true) showCursor(true) end addEvent("showGUI2p",true) addEventHandler("showGUI2p", getRootElement(), showGUI2p) Vehicles_S Marker1 = createMarker ( 842.19921875, -2353.5, 14.89999961853, "cylinder", 3, 0, 0, 255, 0 ) Marker2 = createMarker ( 869.599609375, -2297.599609375, 15, "cylinder", 3, 0, 0, 0, 0 ) local vehicles = {} function spawnVehP(id) theTeam = getPlayerTeam( source ) theTeamName = getTeamName( theTeam ) if ( theTeamName == "Elite" ) then local x, y, z = getElementPosition(source) if isElement(vehicles[source]) then destroyElement(vehicles[source]) end vehicles[source] = createVehicle(id, x + 1, y, z) warpPedIntoVehicle(source, vehicles[source]) else outputChatBox("Usted no es una fuerza Elite. Salga de la base inmediatamente antes de que un elite se de cuenta.", source, 0, 200, 0 , true) end end addEvent("CreVehicle",true) addEventHandler("CreVehicle", root, spawnVehP) addEventHandler("onPlayerQuit", root, function() if isElement(vehicles[source]) then destroyElement(vehicles[source]) vehicles[source] = nil end end) function showGUIp(hitPlayer) setElementFrozen(source, true) triggerClientEvent (hitPlayer,"showGUI2p",getRootElement(),hitPlayer) end addEventHandler("onMarkerHit",Marker1,showGUIp) addEventHandler("onMarkerHit",Marker2,showGUIp) Desde ya, Muchas Gracias. Link to comment
Castillo Posted December 12, 2012 Share Posted December 12, 2012 addEventHandler("onClientDoubleClick", root, use, true) addEventHandler("onClientGUIClick", button, close) Ahi es el problema, te olvidaste de poner en 'false' cuarto argumento de addEventHandler. addEventHandler ( "onClientDoubleClick", root, use, false ) addEventHandler ( "onClientGUIClick", button, close, false ) Link to comment
Sasu Posted December 12, 2012 Author Share Posted December 12, 2012 @Solidsnake14 Cuando abro el admin panel y apreto doble clik en cualquier parte tanto botones como en el vacio del panel el vehiculo se vuelve a crear. Link to comment
Castillo Posted December 12, 2012 Share Posted December 12, 2012 Cambia: addEventHandler ( "onClientDoubleClick", root, use, false ) A: addEventHandler ( "onClientDoubleClick", grid, use, false ) Link to comment
Sasu Posted December 12, 2012 Author Share Posted December 12, 2012 No me crea el vehiculo. Link to comment
Recommended Posts