Search the Community
Showing results for tags 'abrir puertas'.
-
Quisiera saber cómo puedo hacer que este script funcione sin necesidad de usar elementData, porque digamos que ya tengo varios y quisiera ver si puedo quitarle los elementData a este recurso para abrir/cerrar las puertas del auto. Client ------------------------------------ -- QUANTUMZ - QUANTUMZ - QUANTUMZ -- ------------------------------------ -- 2011 - Romania -- ------------------------------------ -- You can modify this file but -- -- don't change the credits. -- ------------------------------------ ------------------------------------ -- VEHICLECONTROL v1.0 for MTA -- ------------------------------------ GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Scrollbar = {} GUIEditor_Window[1] = guiCreateWindow(709,236,272,288,"Vehicle Control - QuantumZ",false) GUIEditor_Scrollbar[1] = guiCreateScrollBar(24,49,225,17,true,false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(86,30,135,15,"Hood Open Ratio",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Label[2] = guiCreateLabel(74,72,135,15,"First Door Open Ratio",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Scrollbar[2] = guiCreateScrollBar(24,91,225,17,true,false,GUIEditor_Window[1]) GUIEditor_Label[3] = guiCreateLabel(68,112,135,15,"Second Door Open Ratio",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[3],"default-bold-small") GUIEditor_Scrollbar[3] = guiCreateScrollBar(24,130,225,17,true,false,GUIEditor_Window[1]) GUIEditor_Label[4] = guiCreateLabel(71,151,135,15,"Third Door Open Ratio",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[4],"default-bold-small") GUIEditor_Scrollbar[4] = guiCreateScrollBar(24,168,225,17,true,false,GUIEditor_Window[1]) GUIEditor_Label[5] = guiCreateLabel(68,189,135,15,"Fourth Door Open Ratio",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[5],"default-bold-small") GUIEditor_Scrollbar[5] = guiCreateScrollBar(24,206,225,17,true,false,GUIEditor_Window[1]) GUIEditor_Label[6] = guiCreateLabel(83,226,135,15,"Trunk Open Ratio",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Label[6],"default-bold-small") GUIEditor_Scrollbar[6] = guiCreateScrollBar(24,243,225,17,true,false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(23,265,230,14,"close window",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Button[1],"default-small") guiWindowSetSizable ( GUIEditor_Window[1], false ) setElementData(GUIEditor_Scrollbar[1], "Type", 0) setElementData(GUIEditor_Scrollbar[2], "Type", 2) setElementData(GUIEditor_Scrollbar[3], "Type", 3) setElementData(GUIEditor_Scrollbar[4], "Type", 4) setElementData(GUIEditor_Scrollbar[5], "Type", 5) setElementData(GUIEditor_Scrollbar[6], "Type", 1) guiSetVisible(GUIEditor_Window[1], false) showCursor(false) function enableVehicleControl() if guiGetVisible(GUIEditor_Window[1]) == false then guiSetVisible(GUIEditor_Window[1], true) showCursor(true) else guiSetVisible(GUIEditor_Window[1], false) showCursor(false) end end addCommandHandler("cveh", enableVehicleControl) function closeButton() guiSetVisible(GUIEditor_Window[1], false) showCursor(false) end addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], closeButton, false ) function updateRatio(Scrolled) local position = guiScrollBarGetScrollPosition(Scrolled) local door = getElementData(Scrolled, "Type") triggerServerEvent("moveThis:~", getLocalPlayer(), door, position) end addEventHandler("onClientGUIScroll", getRootElement(), updateRatio) Server ------------------------------------ -- QUANTUMZ - QUANTUMZ - QUANTUMZ -- ------------------------------------ -- 2011 - Romania -- ------------------------------------ -- You can modify this file but -- -- don't change the credits. -- ------------------------------------ ------------------------------------ -- VEHICLECONTROL v1.0 for MTA -- ------------------------------------ function openDoor(door, position) local vehicle = getPedOccupiedVehicle(source) if getPedOccupiedVehicleSeat(source) == 0 then if door == 0 then if position==0 then setVehicleDoorOpenRatio(vehicle, 0, 0, 0.5) end if position==100 then setVehicleDoorOpenRatio(vehicle, 0, 1, 0.5) end if position>0 and position<100 then setVehicleDoorOpenRatio(vehicle, 0, position/100, 0.5) end end if door == 1 then if position==0 then setVehicleDoorOpenRatio(vehicle, 1, 0, 0.5) end if position==100 then setVehicleDoorOpenRatio(vehicle, 1, 1, 0.5) end if position>0 and position<100 then setVehicleDoorOpenRatio(vehicle, 1, position/100, 0.5) end end if door == 2 then if position==0 then setVehicleDoorOpenRatio(vehicle, 2, 0, 0.5) end if position==100 then setVehicleDoorOpenRatio(vehicle, 2, 1, 0.5) end if position>0 and position<100 then setVehicleDoorOpenRatio(vehicle, 2, position/100, 0.5) end end if door == 3 then if position==0 then setVehicleDoorOpenRatio(vehicle, 3, 0, 0.5) end if position==100 then setVehicleDoorOpenRatio(vehicle, 3, 1, 0.5) end if position>0 and position<100 then setVehicleDoorOpenRatio(vehicle, 3, position/100, 0.5) end end if door == 4 then if position==0 then setVehicleDoorOpenRatio(vehicle, 4, 0, 0.5) end if position==100 then setVehicleDoorOpenRatio(vehicle, 4, 1, 0.5) end if position>0 and position<100 then setVehicleDoorOpenRatio(vehicle, 4, position/100, 0.5) end end if door == 5 then if position==0 then setVehicleDoorOpenRatio(vehicle, 5, 0, 0.5) end if position==100 then setVehicleDoorOpenRatio(vehicle, 5, 1, 0.5) end if position>0 and position<100 then setVehicleDoorOpenRatio(vehicle, 5, position/100, 0.5) end end end end addEvent("moveThis:~", true) addEventHandler("moveThis:~", getRootElement(), openDoor) function showCreditsToQuantumZ() outputChatBox ( "Write #FFFFFF/cveh #FF0000to use #FFFFFFQuantumZ's Vehicle Control#FF0000 resource!", source, 255, 0, 0, true ) end addEventHandler("onPlayerJoin", getRootElement(), showCreditsToQuantumZ) Lo que hace es abrir las puertas del auto por medio de un scroll, pero le asigna un tipo a cada scroll (1, 2, 3, 4) para saber que es la puerta que tiene que mover; mi pregunta es, si puedo remplazar los elementData por variables, y si es así, me podrían explicar cómo? Gracias.
- 12 replies
-
- sin elementdata
- hacer funcionar
-
(and 1 more)
Tagged with: