Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -----------------------
- -- Autor: TheCrazy17 --
- -- Fecha: 18/04/2015 --
- -----------------------
- Lobby = {
- ["Mostrando"] = false
- }
- local screenW,screenH = guiGetScreenSize()
- local resW, resH = 1024,768
- local Size = ( 1.3 / resW ) * screenW -- Fix para que las letras se vean bien en todas las resoluciones
- local T1 = tocolor(255, 255, 255, 255)
- local T2 = tocolor(255, 255, 255, 255)
- local T3 = tocolor(255, 255, 255, 255)
- local T4 = tocolor(255, 255, 255, 255)
- local T5 = tocolor(0, 255, 255, 255)
- local T6 = tocolor(255, 0, 0, 255)
- function Lobby.Dibujar()
- dxDrawText("JUGAR", 102*sW, 410*sH, 250*sW, 448*sH, T1, Size, "default-bold")
- dxDrawText("PERSONAJE", 102*sW, 448*sH, 250*sW, 486*sH, T2, Size, "default-bold")
- dxDrawText("CONFIGURACIÓN", 102*sW, 486*sH, 250*sW, 524*sH, T3, Size, "default-bold")
- dxDrawText("CREDITOS", 102*sW, 524*sH, 250*sW, 562*sH, T4, Size, "default-bold")
- dxDrawText("*Prohibido hacer flood \n*Prohibido hacer spam \n (Nombrar otros servidores \n ajenos a gta.la)\n*Prohibido los insultos \n*Prohibido los hacks,cheats,etc. \n*Prohibido el re-logeo \n (evade-kill)\n*Prohibido dupear balas \n armas o cualquier otra cosa. \n *Prohibido hacer spawk-kill. \n *Prohibido usar nick como \n xd; .. ; u otro tipo de nick que lleve \n menos de 2 caracteres.\n", 760*sW, 90*sH, 580*sW, 448*sH, T5, Size, "default-bold")
- dxDrawText("\n mapa modificado\n Islas Agregadas\n Nueva Area 51\n Sistema de Bases y VIP\n",760*sW, 370*sH, 580*sW, 448*sH, T5, Size, "default-bold")
- dxDrawText(" Stark\n TheCrazy\n Gta.la/foro \n ",850*sW, 500*sH, 580*sW, 448*sH, T5, Size, "default-bold")
- dxDrawText("\n Servidor con:",760*sW, 350*sH, 580*sW, 448*sH, T6, Size, "default-bold")
- dxDrawText("\nReglas:", 760*sW, 50*sH, 580*sW, 448*sH, T6, Size, "default-bold")
- dxDrawText("\n Servidor creado por:\n Scripter/Owner:\n Comunidad:",760*sW, 480*sH, 580*sW, 448*sH, T6, Size, "default-bold")
- --Obtener la posición del cursor
- local CursorX, CursorY = getCursorPosition()
- --Realizar ciertas funciones si el cursor está en cierta posición
- if CursorX >= 0.09375 and CursorX <= 0.155 and CursorY >= 0.53 and CursorY <= 0.56 then
- T1 = tocolor(120, 120, 120, 255)
- T2 = tocolor(255, 255, 255, 255)
- T3 = tocolor(255, 255, 255, 255)
- T4 = tocolor(255, 255, 255, 255)
- elseif CursorX >= 0.09375 and CursorX <= 0.20 and CursorY >= 0.585 and CursorY <= 0.61 then
- T1 = tocolor(255, 255, 255, 255)
- T2 = tocolor(120, 120, 120, 255)
- T3 = tocolor(255, 255, 255, 255)
- T4 = tocolor(255, 255, 255, 255)
- elseif CursorX >= 0.09375 and CursorX <= 0.24 and CursorY >= 0.632 and CursorY <= 0.652 then
- T1 = tocolor(255, 255, 255, 255)
- T2 = tocolor(255, 255, 255, 255)
- T3 = tocolor(120, 120, 120, 255)
- T4 = tocolor(255, 255, 255, 255)
- elseif CursorX >= 0.09375 and CursorX <= 0.185 and CursorY >= 0.68 and CursorY <= 0.71 then
- T1 = tocolor(255, 255, 255, 255)
- T2 = tocolor(255, 255, 255, 255)
- T3 = tocolor(255, 255, 255, 255)
- T4 = tocolor(120, 120, 120, 255)
- else
- T1 = tocolor(255, 255, 255, 255)
- T2 = tocolor(255, 255, 255, 255)
- T3 = tocolor(255, 255, 255, 255)
- T4 = tocolor(255, 255, 255, 255)
- end
- end
- -- Crear el lobby cuando el recurso inicie en el cliente
- function Lobby.Inicio()
- Lobby.Mostrando = true
- addEventHandler("onClientRender", root, Lobby.Dibujar)
- showCursor(true)
- fadeCamera(true)
- setCameraMatrix(1901.9, -1222.35, 17.3, 2000, 0, 300)
- Jugador = createPed(0, 1902.8, -1219, 18.5)
- setPedRotation(Jugador, 140)
- end
- addEventHandler("onClientResourceStart", resourceRoot, Lobby.Inicio)
- function Lobby.Ocultar()
- removeEventHandler("onClientRender", root, Lobby.Dibujar)
- showCursor(false)
- end
- -- Funcion para simular los botones
- function Lobby.Click(Boton, Estado)
- if Estado == "up" then
- return
- end
- local CursorX, CursorY = getCursorPosition()
- if Lobby.Mostrando then
- if CursorX >= 0.09375 and CursorX <= 0.155 and CursorY >= 0.53 and CursorY <= 0.56 then
- triggerServerEvent("DayZ.SpawnJugador", localPlayer, getLocalPlayer())
- destroyElement ( Jugador )
- Lobby.Ocultar()
- elseif CursorX >= 0.09375 and CursorX <= 0.20 and CursorY >= 0.585 and CursorY <= 0.61 then
- Lobby.Ocultar()
- showClothWindow()
- elseif CursorX >= 0.09375 and CursorX <= 0.24 and CursorY >= 0.632 and CursorY <= 0.652 then
- outputChatBox("CONFIGURACIÓN")
- Lobby.Ocultar()
- showConfig()
- elseif CursorX >= 0.09375 and CursorX <= 0.185 and CursorY >= 0.68 and CursorY <= 0.71 then
- outputChatBox("CREDITOS")
- end
- end
- end
- addEventHandler("onClientClick", getRootElement(), Lobby.Click)
- ----cloth-----
- screenWidth, screenHeight = guiGetScreenSize( )
- Jugador = nil
- itemsPacks = {
- {"Caras", 1, 0, 32 },
- {"Camisetas", 0, 0, 67 },
- {"Pantalones", 2, 0, 44 },
- {"Zapatos", 3, 0, 37 },
- {"Gorros", 16, -1, 56 },
- {"Gafas", 15, -1, 16 },
- }
- selectedClothes = {}
- function showConfig()
- if not isElement ( showconfig ) then
- showCursor (true)
- showconfig = guiCreateWindow((sW - 350) / 2, (sH - 199) / 2, 350, 199, "Configuraciones", false)
- guiWindowSetSizable(showconfig, false)
- guiSetVisible(showconfig, false)
- info = guiCreateLabel(10, 10, 310, 15, "Informacion: "..getPlayerName(localPlayer), false, info)
- guiLabelSetHorizontalAlign(info, "center", false)
- guiWindowSetSizable(clothWindow, false)
- setCameraMatrix(1901.9, -1222.35, 17.3, 2000, 0, 300)
- removeEventHandler("onClientClick", getRootElement(), Lobby.Click)
- bindKey ( "mouse1", "down", setPrevX )
- addEventHandler('onClientRender', root, showConfig )
- end
- end
- function showClothWindow()
- if not isElement ( clothWindow ) then
- showCursor (true)
- clothWindow = guiCreateWindow(0.07*screenWidth, 0.41*screenHeight, 268, 120+#itemsPacks*25, "PERSONAJE", false)
- guiWindowSetSizable(clothWindow, false)
- setCameraMatrix(1901.9, -1222.35, 17.3, 2000, 0, 300)
- removeEventHandler("onClientClick", getRootElement(), Lobby.Click)
- addEventHandler('onClientRender', root, rotateTestPed )
- addEventHandler('onClientRender', root, renderRotateText )
- bindKey ( "mouse1", "down", setPrevX )
- x_prev = nil
- hombre = guiCreateRadioButton(98, 27, 71, 13, "Hombre", false, clothWindow)
- guiRadioButtonSetSelected(hombre,true)
- mujer = guiCreateRadioButton(181, 27, 71, 13, "Mujer", false, clothWindow)
- for i, v in ipairs ( itemsPacks ) do
- local rub_label = guiCreateLabel(21, 55+25*(i-1), 53, 20, v[1], false, clothWindow)
- local run_back_b = guiCreateButton(93, 55+25*(i-1), 30, 18, "<<", false, clothWindow)
- guiSetProperty(run_back_b, "NormalTextColour", "FFAAAAAA")
- local rub_back = guiCreateButton(134, 55+25*(i-1), 30, 18, "<", false, clothWindow)
- guiSetProperty(rub_back, "NormalTextColour", "FFAAAAAA")
- local rub_forw = guiCreateButton(198, 55+25*(i-1), 30, 18, ">", false, clothWindow)
- guiSetProperty(rub_forw, "NormalTextColour", "FFAAAAAA")
- local rub_forw_b = guiCreateButton(239, 55+25*(i-1), 30, 18, ">>", false, clothWindow)
- guiSetProperty(rub_forw_b, "NormalTextColour", "FFAAAAAA")
- local cur_cloth = getElementData ( localPlayer, "cloth"..v[2]) or v[3]
- local rub_num = guiCreateLabel(169, 55+25*(i-1), 22, 18, cur_cloth, false, clothWindow)
- guiLabelSetHorizontalAlign(rub_num, "center", false)
- setElementData ( run_back_b, "clothButBackB", true )
- setElementData ( rub_forw_b, "clothButForwB", true )
- setElementData ( rub_back, "clothButBack", true )
- setElementData ( rub_forw, "clothButForw", true )
- setElementData ( run_back_b, "clothButID", i )
- setElementData ( rub_forw_b, "clothButID", i )
- setElementData ( rub_back, "clothButID", i )
- setElementData ( rub_forw, "clothButID", i )
- table.insert ( selectedClothes, { rub_num, cur_cloth, v[2], v[3], v[4] } )
- setPedClothes ( Jugador, v[2], cur_cloth )
- end
- button_save = guiCreateButton(13, 55+#itemsPacks*25, 242, 23,"Guardar Vestimenta!",false,clothWindow)
- button_back = guiCreateButton(13, 85+#itemsPacks*25, 242, 23,"Seguir",false,clothWindow)
- addEventHandler("onClientGUIClick", button_save, allowCloth )
- addEventHandler("onClientGUIClick", button_back, disallowCloth )
- end
- end
- function renderRotateText()
- dxDrawText ( "Mantenga pulsado el botón del ratón y arrastre para girar a CJ", 0, screenHeight/2+screenHeight/3,screenWidth,screenHeight, tocolor(255,255,255), 1.3, "sans","center")
- end
- function allowCloth ()
- if source ~= button_save then return true end
- for i, v in ipairs ( itemsPacks ) do
- setElementData ( localPlayer, "cloth"..v[2], selectedClothes[i][2] )
- end
- outputChatBox ( "Vestimenta Guardada!", 30, 250, 30 )
- --closeClothWindow()
- end
- function disallowCloth ()
- if source ~= button_back then return true end
- closeClothWindow()
- end
- function closeClothWindow ()
- destroyElement ( clothWindow )
- selectedClothes = {}
- unbindKey ( "mouse1", "down", setPrevX )
- removeEventHandler('onClientRender', root, rotateTestPed )
- removeEventHandler('onClientRender', root, renderRotateText )
- addEventHandler("onClientClick", getRootElement(), Lobby.Click)
- setCameraMatrix(1901.9, -1222.35, 17.3, 2000, 0, 300)
- addEventHandler("onClientRender", root, Lobby.Dibujar)
- showCursor ( true )
- end
- x_prev = nil
- function setPrevX()
- x, _ = getCursorPosition ()
- x_prev = x*screenWidth
- end
- function rotateTestPed()
- if getKeyState ("mouse1") then
- x, _ = getCursorPosition ()
- x=x*screenWidth
- change_rot = (x-x_prev)
- local _, _, ped_rot = getElementRotation ( Jugador )
- local rot_to = ped_rot+change_rot
- if rot_to < 0 then
- rot_to = ped_rot+change_rot+360
- end
- setElementRotation ( Jugador, 0, 0, rot_to )
- x_prev = x
- end
- end
- function clickOntoCloth ()
- local id = getElementData ( source, "clothButID" ) or 0
- if id > 0 then
- local setCloth = selectedClothes[id][4]
- if getElementData ( source, "clothButBackB" ) then
- setCloth = selectedClothes[id][4]
- elseif getElementData ( source, "clothButForwB" ) then
- setCloth = selectedClothes[id][5]
- elseif getElementData ( source, "clothButBack" ) then
- if selectedClothes[id][2] > selectedClothes[id][4] then
- setCloth = selectedClothes[id][2]-1
- else
- setCloth = selectedClothes[id][5]
- end
- elseif getElementData ( source, "clothButForw" ) then
- if selectedClothes[id][2] < selectedClothes[id][5] then
- setCloth = selectedClothes[id][2]+1
- end
- end
- selectedClothes[id][2] = setCloth
- guiSetText (selectedClothes[id][1],setCloth)
- setPedClothes ( Jugador, selectedClothes[id][3], setCloth )
- end
- end
- addEventHandler("onClientGUIClick", root, clickOntoCloth )
- function setPedClothes(thePed, clothingSlot, clothingID)
- if not isElement(thePed) or type(clothingSlot) ~= "number" then
- error("Invalid arguments to setPedClothes()!", 2)
- end
- if not clothingID or clothingID == -1 then
- return removePedClothes(thePed, clothingSlot)
- end
- local hasClothes = getPedClothes(thePed, clothingSlot)
- if hasClothes then
- removePedClothes(thePed, clothingSlot)
- end
- local texture, model = getClothesByTypeIndex(clothingSlot, clothingID)
- return addPedClothes(thePed, texture, model, clothingSlot)
- end
- addEventHandler( "onClientElementStreamIn", getRootElement( ),
- function ( )
- if getElementType( source ) == "player" or ( getElementType( source ) == "ped" and getElementData ( source, "deadman" ) ) and getElementModel ( source ) == 0 then
- for i, v in ipairs ( itemsPacks ) do
- setPedClothes (source,v[2],getElementData ( source, "cloth"..v[2] ) or 0)
- end
- end
- end
- );
- function updatePlayerClothesC (skin)
- if isElement ( source ) then
- if skin == 0 then
- for i, v in ipairs ( itemsPacks ) do
- setPedClothes (source,v[2],getElementData ( source, "cloth"..v[2] ) or 0)
- end
- else
- for i, v in ipairs ( itemsPacks ) do
- removePedClothes(source, v[2])
- end
- end
- end
- end
- addEvent("updatePlayerClothes", true)
- addEventHandler("updatePlayerClothes", getRootElement(), updatePlayerClothesC)
- function putPlayerClothesOnSpawn ()
- if getElementModel ( localPlayer ) == 0 then
- for i, v in ipairs ( itemsPacks ) do
- setPedClothes (localPlayer,v[2],getElementData ( localPlayer, "cloth"..v[2] ) or 0)
- end
- end
- end
- addEvent("onClientPlayerDayZSpawn", true)
- addEventHandler("onClientPlayerDayZSpawn", getRootElement(), putPlayerClothesOnSpawn)
- addEvent("onClientPlayerDayZLogin", true)
- addEventHandler("onClientPlayerDayZLogin", getRootElement(), putPlayerClothesOnSpawn)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement