Jump to content

elchinooo98

Members
  • Posts

    65
  • Joined

  • Last visited

Posts posted by elchinooo98

  1. hola necesito ayuda con este script ya que quiero que en vez de poner los nombres de los autos de mta normales ponga los que yo quiero en la GUI,tal cual seria el Freeroam que se hace por .xml o otra forma pero que tengan los nombres que yo quiera...

    les dejo el client Side (no es Mio)

    function centerWindow ( center_window ) 
        local sx, sy = guiGetScreenSize ( )
        local windowW, windowH = guiGetSize ( center_window, false )
        local x, y = ( sx - windowW ) / 2, ( sy - windowH ) / 2
        guiSetPosition ( center_window, x, y, false )
    end
     
     
     
     
     
     
    setTimer ( function ()
     
    local theCol = getElementData(root, "BlockExportCol")
       
    function isInColExport ()
        if isElement(theCol) and isElementWithinColShape(localPlayer,theCol) then
            return true else return false
        end
    end
     
    function ClientExplosionCFunction()
     if isInColExport ()  then
      cancelEvent ()
     end
    end
    addEventHandler("onClientExplosion", root, ClientExplosionCFunction)
     
    end , 1000, 1 )
     
    local screX, screY = guiGetScreenSize()
     
    Window_VS = guiCreateWindow(500, 254, 276, 420,"Sistema De Autos",false)
    guiSetAlpha(Window_VS, 0.88)
    guiWindowSetSizable(Window_VS, false)
    guiSetVisible(Window_VS, false)
    centerWindow(Window_VS)
    Grid_VS = guiCreateGridList(11, 107, 255, 225,false,Window_VS)
    guiGridListSetSelectionMode(Grid_VS, 1)
    guiGridListAddColumn(Grid_VS,"Auto",0.29)
    guiGridListAddColumn(Grid_VS,"Precio $",0.29)
    guiGridListAddColumn(Grid_VS,"Vida",0.29)
    Label_SVS = guiCreateLabel(10, 386, 257, 15, "Reparar $1000 | Warpear $700",false,Window_VS)
     
     
    Button_VS_sn = guiCreateButton(10, 342, 61, 39, "Sacar", false, Window_VS)
    Button_VS_dy = guiCreateButton(75, 342, 61, 39, "Destrozar", false, Window_VS)
    Button_VS_lk = guiCreateButton(184, 54, 67, 43, "Des/Bloquear", false, Window_VS)
    Button_VS_bp = guiCreateButton(103, 54, 67, 43, "Des/Marcar", false, Window_VS)
    Button_VS_Fix = guiCreateButton(205, 342, 61, 39, "Reparar", false, Window_VS)
    Button_VS_sl = guiCreateButton(19, 54, 67, 43, "Vender", false, Window_VS)
    Button_VS_Warp = guiCreateButton(141, 342, 61, 39, "Warpear", false, Window_VS)
     
     
     
     
     
    Window_CHK = guiCreateWindow(screX/2-155,screY/2-60,310,120,"WARNING",false)
    guiSetVisible(Window_CHK, false)
    guiSetProperty(Window_CHK, "AlwaysOnTop", "true")
    guiWindowSetSizable(Window_CHK, false)
    Label_CHK = guiCreateLabel(21,28,266,36,"",false,Window_CHK)
    guiLabelSetHorizontalAlign(Label_CHK,"center",true)
    Button_CHK_Y = guiCreateButton(17,73,129,36,"Si",false,Window_CHK)
    Button_CHK_N = guiCreateButton(161,73,129,36,"No",false,Window_CHK)
     
    function updateGridList()
        local data = getElementData(localPlayer, "VehicleInfo")
        if data then
            local rw, cl = guiGridListGetSelectedItem(Grid_VS)
            guiGridListClear(Grid_VS)
            for i, data in ipairs (data) do
                local carName = getVehicleNameFrom{xml='vehicles.xml'}
                local ID = data["ID"]
                local Cost = data["Cost"]
                local HP = math.floor(data["HP"])
                local PreCost = math.ceil(Cost*.9*HP/100/10)
                local row = guiGridListAddRow(Grid_VS)
                guiGridListSetItemText(Grid_VS, row, 1, carName, false, true)
                guiGridListSetItemData(Grid_VS, row, 1, ID)
                guiGridListSetItemText(Grid_VS, row, 2, PreCost, false, true)
                guiGridListSetItemText(Grid_VS, row, 3, HP.." HP", false, true)
            end
            guiGridListSetSelectedItem(Grid_VS, rw, cl)
        end
    end
     
     
     
    bindKey("F6", "down",
    function()
    if getElementInterior(localPlayer) == 0 and getElementDimension(localPlayer) == 0 then
    if getElementData(localPlayer, "MissionWarProtection") and getElementData(localPlayer, "MissionProtection")then return end
        guiSetVisible(Window_VS, not guiGetVisible(Window_VS))
        guiSetVisible (Window_CHK, false)
        showCursor(guiGetVisible(Window_VS))
        end
    end)
     
    triggerServerEvent("onOpenGui", localPlayer)
     
    addEventHandler("onClientElementDataChange", root,
    function(dd)
        if getElementType(source) == "player" and source == localPlayer and dd == "VehicleInfo" then
            local data = getElementData(source, dd)
            if data then
                updateGridList()
            end
        end
    end)
     
    function WINDOW_CLICK_VEHICLE (button, state, absoluteX, absoluteY)
        local id = guiGridListGetSelectedItem(Grid_VS)
        local ID = guiGridListGetItemData(Grid_VS, id, 1)
        if source == Button_VS_close then
            guiSetVisible(Window_VS, false)
            showCursor(false)
        end
        if (source == Grid_VS) then
            if id == -1 and idd then
                guiGridListSetSelectedItem(Grid_VS, idd, 1)
                return false
            else
                idd = guiGridListGetSelectedItem(Grid_VS)
            end
        elseif id == -1 then
        elseif (source == Button_VS_sn) then
        if not isInColExport () then
            triggerServerEvent("SpawnMyVehicle", localPlayer, ID)
                    end
        elseif (source == Button_VS_dy) then
            triggerServerEvent("DestroyMyVehicle", localPlayer, ID)
        elseif (source == Button_VS_lt) then
            triggerServerEvent("LightsMyVehicle", localPlayer, ID)
        elseif (source == Button_VS_bp) then
            triggerServerEvent("BlipMyVehicle", localPlayer, ID)
        elseif (source == Button_VS_lk) then
            triggerServerEvent("LockMyVehicle", localPlayer, ID)
        elseif (source == Button_VS_sl) then
            guiSetVisible(Window_CHK, true)
            local carName = guiGridListGetItemText(Grid_VS, guiGridListGetSelectedItem(Grid_VS), 1)
            local carprice = guiGridListGetItemText(Grid_VS, guiGridListGetSelectedItem(Grid_VS), 2)
            guiSetText(Label_CHK, 'Esta Seguro En Vender Este Vehiculo "'..carName..'" Por $'..carprice)
        elseif source == Button_CHK_Y then
            triggerServerEvent("SellMyVehicle", localPlayer, ID)
            guiSetVisible(Window_VS, false)
            guiSetVisible(Window_CHK, false)
            showCursor(false)
        elseif source == Button_CHK_N then
            guiSetVisible (Window_CHK, false)
        elseif source == Button_VS_Spc then
          if getElementInterior(localPlayer) == 0 then
    if getElementData(localPlayer,"Stats") < 2 then
            SpecVehicle(ID)
    end
    end
        elseif source == Button_VS_Fix then
            triggerServerEvent("FixMyVehicle", localPlayer, ID)
        elseif source == Button_VS_Warp then
               if not isInColExport () then
            triggerServerEvent("WarpMyVehicle", localPlayer, ID)
                          end
        end
    end
    addEventHandler("onClientGUIClick", resourceRoot, WINDOW_CLICK_VEHICLE)
     
    function SpecVehicle(id)
     
        if spc then
            removeEventHandler("onClientPreRender", root, Sp)
            setCameraTarget(localPlayer)
            if isTimer(freezTimer) then killTimer(freezTimer) end
            freezTimer = setTimer(function() setElementFrozen(localPlayer, false) end, 2500, 1)
            spc = false
        return end
        for i, vehicle in ipairs(getElementsByType("vehicle")) do
            if getElementData(vehicle, "Owner") == localPlayer and getElementData(vehicle, "ID") == id then
                cVeh = vehicle
                spc = true
                addEventHandler("onClientPreRender", root, Sp)
                guiSetVisible(Window_VS, false)
                showCursor(false)
                break
              end
                           
        end
    end
     
    function Sp()
        if isElement(cVeh) then
            local x, y, z = getElementPosition(cVeh)
            setElementFrozen(localPlayer, true)
            setCameraMatrix(x, y-1, z+15, x, y, z)
     
        else
            removeEventHandler("onClientPreRender", root, Sp)
            setCameraTarget(localPlayer)
            if isTimer(freezTimer) then killTimer(freezTimer) end
            freezTimer = setTimer(function() setElementFrozen(localPlayer, false) end, 2500, 1)
            spc = false
          end
    end
     
    ShopMarkersTable = {}   
     
    local ShopTable = {
        [1] = {ID = {{579, 70000}
            ,{400, 1000000}
            ,{404, 38000}
            ,{489, 75000}
            ,{505, 75000}
            ,{479, 55000}
            ,{442, 55000}
            ,{458, 55000}
            ,{602, 60000}
            ,{496, 52500}
            ,{401, 51000}
            ,{518, 70000}
            ,{527, 85000}
            ,{589, 85000}
            ,{419, 55000}
            ,{533, 85000}
            ,{526, 60000}
            ,{474, 65000}
            ,{545, 60000}
            ,{517, 55000}
            ,{410, 51000}
            ,{600, 60000}
            ,{436, 51000}
            ,{580, 60000}
            ,{439, 85000}
            ,{549, 85000}
            ,{491, 55000}
            ,{445, 55000}
            ,{507, 55000}
            ,{585, 55000}
            ,{587, 85000}
            ,{466, 65000}
            ,{492, 60000}
            ,{546, 55000}
            ,{551, 55000}
            ,{516, 55000}
            ,{467, 55000}
            ,{426, 57500}
            ,{547, 55000}
            ,{405, 65000}
            ,{409, 85000}
            ,{550, 55000}
            ,{566, 55000}
            ,{540, 55000}
            ,
  2. Hola tengo un sistema de grupos (no se bien de quien es) que usa como setElementData "gang" (igual que el de castillo creo) y quiero hacer un script para que no se puedan hacer daño ni matar los miembros de esa gang que funciones deberia usar y como detecto la gang? desde ya gracias :D

  3. Aquí tienes, debería servirte para cada jugador en invidivual, porque si no al poner otro jugador /private1 borraría el anterior vehículo que creó otro jugador distinto.
    creados = {} 
      
    addCommandHandler("private1", 
        function ( player ) 
            local x, y, z = getElementPosition ( player ) 
            local accName = getAccountName ( getPlayerAccount ( player ) ) 
            if ( isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) ) then 
                if creados[player] == nil then 
                    creados[player] = createVehicle(581, x, y+2, z, 0, 0, 0) 
                else 
                    destroyElement(creados[player]) 
                    creados[player] = createVehicle(581, x, y+2, z, 0, 0, 0) 
                end 
            else 
                outputChatBox ( "#00FFFFNo tienes Acceso a este Comando", player, 255, 255, 255, true ) 
            end 
        end 
    ) 
    

    sisi me sirvioo de 10 gracias Wissen :)

  4. Aquí tienes, debería servirte para cada jugador en invidivual, porque si no al poner otro jugador /private1 borraría el anterior vehículo que creó otro jugador distinto.
    creados = {} 
      
    addCommandHandler("private1", 
        function ( player ) 
            local x, y, z = getElementPosition ( player ) 
            local accName = getAccountName ( getPlayerAccount ( player ) ) 
            if ( isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) ) then 
                if creados[player] == nil then 
                    creados[player] = createVehicle(581, x, y+2, z, 0, 0, 0) 
                else 
                    destroyElement(creados[player]) 
                    creados[player] = createVehicle(581, x, y+2, z, 0, 0, 0) 
                end 
            else 
                outputChatBox ( "#00FFFFNo tienes Acceso a este Comando", player, 255, 255, 255, true ) 
            end 
        end 
    ) 
    

    sisis mi idea es crear un acl especial para cada dueño de ese auto cosa que no lo borren ya lo pruebo y te cuento como me fue

  5. Hola a todoos este es mi segundo script desde 0 pero obviamente es muy basico :oops: .... lo que no tengo idea como hacer es que con este comando solamente un auto se pueda crear como en el freeroam que al crear 2 uno desaparece alguna ayuda? porque si abusan de el se pueden crear millones y creo que me dijeron que pueden tirar servers con eso bah nose desde ya muchas gracias :)

    Server-Side (y unico)

    function autoprivado1 ( player, command ) 
          local luckyBugger = player  
          local x, y, z = getElementPosition ( luckyBugger )  
          local accName = getAccountName ( getPlayerAccount ( player ) ) 
        if ( isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) ) then 
          createVehicle ( 581, x, y+2, z, 0, 0, 0 )  
        else 
        outputChatBox ( "#00FFFFNo tienes Acceso a este Comando", player, 255, 255, 255, true ) 
    end 
    end 
      
    addCommandHandler ( "private1", autoprivado1 ) 
    

    function autoprivado1 ( player, command ) 
          local luckyBugger = player  
          local x, y, z = getElementPosition ( luckyBugger )  
          local accName = getAccountName ( getPlayerAccount ( player ) ) 
        if ( isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) ) then 
          auto = createVehicle ( 581, x, y+2, z, 0, 0, 0 )  
        else 
        outputChatBox ( "#00FFFFNo tienes Acceso a este Comando", player, 255, 255, 255, true ) 
    end 
    end 
      
    addCommandHandler ( "private1", autoprivado1 
    function () 
         destroyElement(auto) 
     auto2 = createVehicle ( 581, x, y+2, z, 0, 0, 0 )  
    end 
     ) 
    

    si no me equivoco creo que es haci

    Lo probe como me dijiste y me salta esto en el debug "ERROR:Loading script failed:auto1/auto.lua ')'expected(to close'(' at line 12) near "fuction"

  6. Hola a todoos este es mi segundo script desde 0 pero obviamente es muy basico :oops: .... lo que no tengo idea como hacer es que con este comando solamente un auto se pueda crear como en el freeroam que al crear 2 uno desaparece alguna ayuda? porque si abusan de el se pueden crear millones y creo que me dijeron que pueden tirar servers con eso bah nose desde ya muchas gracias :)

    Server-Side (y unico)

    function autoprivado1 ( player, command ) 
          local luckyBugger = player  
          local x, y, z = getElementPosition ( luckyBugger )  
          local accName = getAccountName ( getPlayerAccount ( player ) ) 
        if ( isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) ) then 
          createVehicle ( 581, x, y+2, z, 0, 0, 0 )  
        else 
        outputChatBox ( "#00FFFFNo tienes Acceso a este Comando", player, 255, 255, 255, true ) 
    end 
    end 
      
    addCommandHandler ( "private1", autoprivado1 ) 
    

  7. Yo aprendí con la Wiki y con las maravillosas personas de este foro, la Wiki es la forma más rápida pero no más efectiva, obviamente se aprende más con alguien explicandote que leyendo.

    sisii por eso hice este topic para aprender xqe me gusta muchoo lo que es script y a veces se me vienen ideas de algo que podria usar pero no tengo la nocion de lo que tengo que usar y en la wiki esas cosas no las aprendo

  8. Yo te recomiendo que sigas intentando con la Wiki, algo que yo hice para aprender casi lo básico fue copiando los ejemplos y tratar de rehacerlo a mi manera

    sisii yo uso la wiki y uso sus ejemplos pero hay muchas cosas que por ejemplo los element data no los termino de entender se me complica a veces

  9. Holaa a todos ando queriendo aprender lo mas necesario para ser scripter por ejemplo los triggers,los element data como se usan,quiero aprender mejor a manejarme con los acl...(yo digo lo mas basico por aii esto es mas complicado de lo que parece) ya se que en la wiki hay ejemplos pero ninguno se compara a que alguien te lo explique bah eso creo yo asi que espero que me puedan "enseñar" algo de esto que es tan lindo que a mi tanto me gustaria ser un Scripter (tambien me pueden decir cosas que por ai no puse en los ejemplos,en otras palabras lo que tengo que aprender si o si) desde ya gracias por su ayuda y su tiempo :)

  10. en el resource freeroam hay un archivo llamdo fr_server.lua abrelo y dirigete a la linea 217

    hay encontraras la funcion setMySkin

    reemplaza toda esa funcion por esto

    function setMySkin(skinid) 
        if isPedDead(source) then 
            local x, y, z = getElementPosition(source) 
            if isPedTerminated(source) then 
                x = 0 
                y = 0 
                z = 3 
            end 
            local r = getPedRotation(source) 
            local interior = getElementInterior(source) 
            spawnPlayer(source, x, y, z, r, skinid) 
            setElementInterior(source, interior) 
            setCameraInterior(source, interior) 
        else 
         if skinid == 59 then 
             if isObjectInACLGroup ("user."..getAccountName( getPlayerAccount (source) ), aclGetGroup ( "Admin" ) ) then 
              setElementModel(source, skinid) 
              setElementHealth(source, 100) 
             else 
              outputChatBox("Este skin es solo para Administradores", source, 100,0,0) 
              end 
          else 
            setElementModel(source, skinid) 
            setElementHealth(source, 100) 
          end 
        end 
        setCameraTarget(source, source) 
        setCameraInterior(source, getElementInterior(source)) 
    end 
    

    Gracias alex me sirvioo :)

  11. eso es lo que no encuentro en el freeroam :c mi idea era borrarlo cosa que cuando pusieran /ss 59 nada pasara pero no la encuentro esa funcion :/ probe esto que encontre en un topic de la comu pero no me funciona

    function checkskin( posX, posY, posZ, spawnRotation, theTeam, theSkin, theInterior, theDimension ) 
    if not isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then 
    if theSkin == 59 then 
    killPed(source) 
    end 
    end 
    end 
    addEventHandler("onPlayerSpawn",getRootElement(),checkskin) 
    

  12. Solo las personas que estén en el ACL que tu predefinas podrán usarlo

    sii pero eso no es lo que queria polluelo soloo quiero que solo el skin 59 no lo puedan usar porque es de admin despues que puedan usar /ss 58 57 60 nose si me explico

  13. Holaa quiero aprender bien el tema de "bloquear" cosas para los acl y trate de privatisar un skin para el acl admin pero no se como hacerlo osea que cuando pongan ej:"/ss 59" les diga Acceso Denegado pero trate pero al poner /ss 59 no pasa nada se pone el skin normalmente alguna ayuda?

  14. Como te expliqué por privado, debes detectar si el jugador está en el ACL Admin, o si tiene permiso para X función, ejemplo:
      
    thePlayer = getPlayerFromName("Pedro") 
    local acc = getPlayerAccount(thePlayer) 
    local nacc = getAccountName(acc) 
      if ( isObjectInACLGroup ("user."..nacc, aclGetGroup ( "Admin" ) ) ) then 
    -- bla bla bla  
      
    

    aww cierto que me dijiste en varias oportunidades ^^ es que me olvidooo es hasta que aprenda por las malas jaj gracias tomas :)

×
×
  • Create New...