Lormateve Posted March 14, 2018 Share Posted March 14, 2018 What I wanted to do, was that the user to buy a certain accessory color and object, that is saved and at the beginning, not only can see it, but also can see others. Server: function Cortina1(paintjobID, color) local vehicle = getPedOccupiedVehicle( client ) local player = client if ( vehicle ) then local pos = {getElementPosition( vehicle )} Cortinapuesta = createObject( 1000, pos[1], pos[2], pos[3] ) attachElements( Cortinapuesta, vehicle, 0, 0, 0, 0, 0, 0 ) triggerClientEvent (root, "setShader", resourceRoot, paintjobID, color) end end addEvent("PonerCortina", true) addEventHandler("PonerCortina", resourceRoot, Cortina1) function CancelarCortina() local vehicle = getPedOccupiedVehicle( source ) if ( vehicle ) then destroyElement(Cortinapuesta) end end addEvent("SacarCortina", true) addEventHandler("SacarCortina", root, CancelarCortina) ----------------------------------------------------------------------------------------------------- function addPJfction (player) triggerClientEvent (getRootElement(),"addPJ2", getRootElement(), player ) end addEvent( "addPJ", true ) addEventHandler( "addPJ", resourceRoot, addPJfction ) function removePJfction (player) triggerClientEvent (getRootElement(),"removePJ2", getRootElement(),player ) end addEvent( "removePJ", true ) addEventHandler( "removePJ", resourceRoot, removePJfction ) Client: Ventana1 = createMarker (2194.4677734375, 1440.5966796875, 10.8203125-1, "cylinder", 1.5, 0, 255, 0, 170 ) local NormalTextColour = "FFFB0202" function mapLoad ( Bondi2018OBJETOS ) local txdCortinas1518 = engineLoadTXD( "objetos/metalpar1518/vehicle.txd" ) local dffCortinas1518 = engineLoadDFF( "objetos/metalpar1518/spl_b_mar_m.dff", 0 ) engineImportTXD( txdCortinas1518, 1000 ) engineReplaceModel( dffCortinas1518, 1000 ) end addEventHandler ( "onClientResourceStart", resourceRoot, mapLoad ) addEventHandler("onClientMarkerHit", Ventana1, function(localPlayer) if localPlayer == getLocalPlayer() then Ventana = guiCreateWindow(997, 226, 228, 743, "BONDI 2018 - Taller \"Libertad\"", false);guiSetVisible(Ventana, true) guiWindowSetSizable(Ventana, false) guiSetProperty(Ventana, "CaptionColour", "FF0EF1E3") showCursor(true) veh = getPedOccupiedVehicle( localPlayer ) Boton1 = guiCreateButton(15, 66, 108, 31, " CORTINAS", false, Ventana); guiSetProperty(Boton1, "NormalTextColour", "FFFB0202") Boton2 = guiCreateButton(15, 107, 108, 31, " Parachoques", false, Ventana);guiSetProperty(Boton2, "NormalTextColour", "FFFB0202") Boton3 = guiCreateButton(15, 148, 108, 31, " ASIENTOS", false, Ventana);guiSetProperty(Boton3, "NormalTextColour", " FFFB0202") Boton4 = guiCreateButton(15, 189, 108, 31, " VIDRIOS", false, Ventana);guiSetProperty(Boton4, "NormalTextColour", "FFFB0202") Boton5 = guiCreateButton(15, 230, 108, 31, " OPTICAS", false, Ventana);guiSetProperty(Boton5, "NormalTextColour", "FFFB0202") Boton6 = guiCreateButton(15, 271, 108, 31, "", false, Ventana);guiSetProperty(Boton6, "NormalTextColour", " FFFB0202") Boton7 = guiCreateButton(15, 312, 108, 31, "", false, Ventana);guiSetProperty(Boton7, "NormalTextColour", " FFFB0202") Boton8 = guiCreateButton(15, 353, 108, 31, "", false, Ventana);guiSetProperty(Boton8, "NormalTextColour", " FFFB0202") Boton9 = guiCreateButton(15, 394, 108, 31, "", false, Ventana);guiSetProperty(Boton9, "NormalTextColour", " FFFB0202") BotonCERRAR = guiCreateButton(15, 700, 108, 31, "CERRAR", false, Ventana);guiSetProperty(BotonCERRAR, "NormalTextColour", "FFFB0202") end end ) Ventana2 = guiCreateWindow(997, 226, 228, 743, "BONDI 2018 - Taller \"Libertad\"", false);guiSetVisible(Ventana2, false);guiWindowSetSizable(Ventana2, false);guiSetProperty(Ventana2, "CaptionColour", "FF0EF1E3") Boton1 = guiCreateButton(60, 66, 108, 31, "Cortinas Simples", false, Ventana2); guiSetProperty(Boton1, "NormalTextColour", "FFFB0202") Boton2 = guiCreateButton(15, 107, 108, 31, " Turquesas", false, Ventana2);guiSetProperty(Boton2, "NormalTextColour", "FFFB0202") Boton2b = guiCreateMemo(150, 107, 64, 31, "2500", false, Ventana2); guiSetProperty(Boton2b, "NormalTextColour", "FFFB0202");guiMemoSetReadOnly( Boton2b, true ) Boton3 = guiCreateButton(15, 148, 108, 31, " 2", false, Ventana2);guiSetProperty(Boton3, "NormalTextColour", " FFFB0202"); Boton4 = guiCreateButton(15, 189, 108, 31, " 3", false, Ventana2);guiSetProperty(Boton4, "NormalTextColour", "FFFB0202") Boton5 = guiCreateButton(15, 230, 108, 31, " 4", false, Ventana2);guiSetProperty(Boton5, "NormalTextColour", "FFFB0202") Boton6 = guiCreateButton(15, 271, 108, 31, "5", false, Ventana2);guiSetProperty(Boton6, "NormalTextColour", " FFFB0202") Boton7 = guiCreateButton(15, 312, 108, 31, "6", false, Ventana2);guiSetProperty(Boton7, "NormalTextColour", " FFFB0202") Boton8 = guiCreateButton(60, 353, 108, 31, "Cortinas Completas", false, Ventana2);guiSetProperty(Boton8, "NormalTextColour", " FFFB0202") Boton9a = guiCreateButton(15, 394, 108, 31, "Turquesas", false, Ventana2);guiSetProperty(Boton9a, "NormalTextColour", " FFFB0202") Boton10a = guiCreateButton(15, 435, 108, 31, "Rojas", false, Ventana2);guiSetProperty(Boton10a, "NormalTextColour", " FFFB0202") Boton11a = guiCreateButton(15, 476, 108, 31, "Azules", false, Ventana2);guiSetProperty(Boton11a, "NormalTextColour", " FFFB0202") Boton12a = guiCreateButton(15, 517, 108, 31, "Blancas", false, Ventana2);guiSetProperty(Boton12a, "NormalTextColour", " FFFB0202") Boton13a = guiCreateButton(15, 558, 108, 31, "Celestes", false, Ventana2);guiSetProperty(Boton13a, "NormalTextColour", " FFFB0202") BotonTOTAL = guiCreateMemo (15, 650, 60, 31, "Total:", false, Ventana2);guiSetProperty(BotonTOTAL, "NormalTextColour", "FFFB0202");guiMemoSetReadOnly( BotonTOTAL, true ) BotonTOTAL2 = guiCreateMemo (75, 650, 60, 31, "0", false, Ventana2);guiSetProperty(BotonTOTAL2, "NormalTextColour", "FFFB0202");guiMemoSetReadOnly( BotonTOTAL2, true ) BotonCOMPRAR = guiCreateButton (135, 650, 65, 31, "COMPRAR", false, Ventana2);guiSetProperty(BotonCOMPRAR, "NormalTextColour", "FFFB0202") BotonCERRAR2 = guiCreateButton(15, 700, 108, 31, "CERRAR", false, Ventana2);guiSetProperty(BotonCERRAR2, "NormalTextColour", "FFFB0202") addEventHandler("onClientGUIClick", guiRoot, --VENTANA function() local getGui = guiGetVisible(Ventana) if source == BotonCERRAR then if getGui then guiSetVisible(Ventana, false) showCursor(false) veh = getPedOccupiedVehicle( localPlayer ) end end end ) -------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------- addEventHandler("onClientGUIClick", guiRoot, --VENTANA function() local getGui = guiGetVisible(Ventana2) if source == BotonCERRAR2 then if getGui then guiSetVisible(Ventana2, false) showCursor(false) veh = getPedOccupiedVehicle( localPlayer ) triggerServerEvent("SacarCortina", localPlayer, localPlayer) end end end ) addEventHandler("onClientGUIClick", guiRoot, --VENTANA2 = CORTINAS function() local getGui = guiGetVisible(Ventana) if source == Boton1 then if getGui then guiSetVisible(Ventana, false) guiSetVisible(Ventana2, true) veh = getPedOccupiedVehicle( localPlayer ) end end end ) --------------------------------------------------------------------------------------------------------- addEventHandler("onClientGUIClick", guiRoot, --VENTANA2 = CORTINAS > Completas > Turquesas function () local getGui = guiGetVisible(Ventana2) if source == Boton9a then local color = "nada" triggerServerEvent("PonerCortina", resourceRoot, paintjobID, color) PrecioCortinasCompletas = 3500 PrecioTotal = PrecioCortinasCompletas guiSetText(BotonTOTAL2, PrecioCortinasCompletas) else if source == Boton10a then --ROJAS local color = "red" triggerServerEvent("PonerCortina", resourceRoot, paintjobID, color) PrecioCortinasCompletas = 3500 PrecioTotal = PrecioCortinasCompletas guiSetText(BotonTOTAL2, PrecioCortinasCompletas) end end end ) addEvent( "addPJ2", true ) addEventHandler( "addPJ2", getLocalPlayer(), CortinasCompletas ) function addPaintjob2(paintjobID, color) outputChatBox("the color is:" .. color) if color == "red" then CortinasRojas = dxCreateTexture ( "CortinasRojas.png" ) engineRemoveShaderFromWorldTexture (shader_cars,"cortinas", getPedOccupiedVehicle ( player )) shader_cars , tec = dxCreateShader ( "shader.fx" ) engineApplyShaderToWorldTexture (shader_cars,"cortinas", getPedOccupiedVehicle ( player )) dxSetShaderValue (shader_cars,"TX0",CortinasRojas) elseif color == "blue" then CortinasAzules = dxCreateTexture ( "CortinasAzules.png" ) engineRemoveShaderFromWorldTexture (shader_cars,"cortinas", getPedOccupiedVehicle ( player )) shader_cars , tec = dxCreateShader ( "shader.fx" ) engineApplyShaderToWorldTexture (shader_cars,"cortinas", getPedOccupiedVehicle ( player )) dxSetShaderValue (shader_cars,"TX0",CortinasAzules) elseif color == "Nada" then outputChatBox ("Asi como está") end end addEvent( "setShader", true ) addEventHandler( "setShader", resourceRoot, addPaintjob2 ) -------------------------------------------------------------------------------------- addEventHandler("onClientGUIClick", guiRoot, --VENTANAS > BOTON COMPRAR function(localPlayer) local getGui = guiGetVisible(Ventana2) local money = getPlayerMoney (localPlayer) if source == BotonCOMPRAR then if (money > PrecioTotal) then outputChatBox ("Dinero CALCULADO") takePlayerMoney ( PrecioTotal ) outputChatBox ("Usted ha comprado las cortinas") guiSetVisible(Ventana2, false) showCursor (false) else outputChatBox ("No tiene el dinero suficiente para comprarlas!!") end end end) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now