Jump to content

(AYUDA) Script


Lalalu

Recommended Posts

Me ayudan con esto por favor ?

Quiero que al poner por ejemplo el comando "salto" se active, esto lo saque de un resource es decir quiero ponerlo individual (No soy autora del script), quiero que se active con un comando :( pero no sé como , soy nueva en esto del script, help me plz

CLIENT:

superjumping = 0

function rocketjump()
    startrocketjumpingthing = nil
    if getControlState("jump") == true then
        local task = getPedSimplestTask(getLocalPlayer())
        if task == "TASK_SIMPLE_IN_AIR"  and superjumping == 0 then
            if isTimer(startgroundchecktimer) then
                resetTimer ( startgroundchecktimer)
            else
                startgroundchecktimer = setTimer ( startjumpgroundcheck, 300, 1)
            end
            superjumpgroundcheck = 0
            addEventHandler("onClientRender",getRootElement(), rocketplayer )
            addEventHandler("onClientRender",getRootElement(), jumpgroundcheck )
            triggerServerEvent ("onSpeedChange", getLocalPlayer(), "jumping")
            jumpstart = getTickCount()
            superjumping = 1
        end
    end
end

function triggersuperjump(key, keyState)
    if getElementData( getLocalPlayer(), "transport_power" ) == "superjump" then
        if keyState == "down" then
            local px,py,pz = getElementPosition( getLocalPlayer () )
            local isclear = isLineOfSightClear ( px, py, pz,px, py, pz-3,true,true, true, true,true,true, false, getLocalPlayer() )
            if isTimer(startrocketjumpingthing) == false and isclear == false then
                startrocketjumpingthing = setTimer ( rocketjump, 650, 1)
            end
        elseif keyState == "up" then
            removeEventHandler("onClientRender",getRootElement(), rocketplayer )
        end
    end
end
bindKey("jump", "both", triggersuperjump)

function rocketplayer()
    local px,py,pz = getElementPosition( getLocalPlayer () )
    local currenttask = getPedSimplestTask(getLocalPlayer())
    if getTickCount() - jumpstart < 4500 and currenttask ~= "TASK_SIMPLE_NAMED_ANIM" then
        if getTickCount() - jumpstart > 3000 then
            theZ = 0
        elseif getTickCount() - jumpstart > 2000 then
            theZ = .1
        else
            theZ = .3
        end
        local playerangle = getPedRotation(getLocalPlayer())
        local newradRot = math.rad ( playerangle )
        local radius = 3
        local ex = px + radius * math.sin(newradRot)
        local ey = py + -(radius) * math.cos(newradRot)
        local ez = pz
        x,y,z = px-ex,py-ey,pz-ez
        local dist = math.sqrt(x*x+y*y+z*z)
        x = x*.4/dist
        y = y*.4/dist
        setElementVelocity(getLocalPlayer(),x, y, theZ)
    else
        removeEventHandler("onClientRender",getRootElement(), rocketplayer )
    end
end

function jumpgroundcheck()
    if superjumpgroundcheck == 1 then
        local px,py,pz = getElementPosition( getLocalPlayer () )
        local isclear = isLineOfSightClear ( px, py, pz,px, py, pz-2.5,true,true, true, true,true,true, false, getLocalPlayer() )
        local currenttask = getPedSimplestTask(getLocalPlayer())
        if isclear == false or currenttask == "TASK_SIMPLE_LAND" or isElementInWater(getLocalPlayer()) == true then
            removeEventHandler("onClientRender",getRootElement(), jumpgroundcheck )
            setElementPosition(getLocalPlayer(),px,py,pz )
            removeEventHandler("onClientRender",getRootElement(), rocketplayer )
            superjumping = 0
            triggerServerEvent ("onJumpChange", getLocalPlayer(), "normal")
        end
    end
end

function startjumpgroundcheck()
    superjumpgroundcheck = 1
    startgroundchecktimer = nil
    triggerServerEvent ("onJumpChange", getLocalPlayer(), "jumping")
end

 

SERVER:

addEvent( "onJumpChange", true )
function Jumpeffect(mode)
    if mode == "jumping" then
        if isElement(getElementData( source, "themeJumpobject" )) == false then
            local px,py,pz = getElementPosition(source)
            local Jumpeffect = createThemeObject(source,px,py,pz)
            attachElements ( Jumpeffect, source, 0, 0, -.7)
            setElementParent ( Jumpeffect, source)
            setElementData ( source, "themeJumpobject", Jumpeffect, false )
        end
    elseif mode == "normal" then
        if isElement(getElementData( source, "themeJumpobject" )) then
            local oldthemeobject = getElementData( source, "themeJumpobject" )
            destroyElement(oldthemeobject)
        end
    end
end
addEventHandler ( "onJumpChange", getRootElement(), Jumpeffect )

Link to comment

Estás en la sección equivocada. Publica aquí para que te atiendan en Español.

This is English section, post here to get supported by the Spanish section.

Anyway, you can use this/Puedes usar esto, usa la variable de arriba para asignarle nombre a tu comando:

superjumping = 0
comando = "aqui_tu_comando"

function rocketjump()
    startrocketjumpingthing = nil
    if getControlState("jump") == true then
        local task = getPedSimplestTask(getLocalPlayer())
        if task == "TASK_SIMPLE_IN_AIR"  and superjumping == 0 then
            if isTimer(startgroundchecktimer) then
                resetTimer ( startgroundchecktimer)
            else
                startgroundchecktimer = setTimer ( startjumpgroundcheck, 300, 1)
            end
            superjumpgroundcheck = 0
            addEventHandler("onClientRender",getRootElement(), rocketplayer )
            addEventHandler("onClientRender",getRootElement(), jumpgroundcheck )
            triggerServerEvent ("onSpeedChange", getLocalPlayer(), "jumping")
            jumpstart = getTickCount()
            superjumping = 1
        end
    end
end

function triggersuperjump(key, keyState)
    if getElementData( getLocalPlayer(), "transport_power" ) == "superjump" then
        if keyState == "down" then
            local px,py,pz = getElementPosition( getLocalPlayer () )
            local isclear = isLineOfSightClear ( px, py, pz,px, py, pz-3,true,true, true, true,true,true, false, getLocalPlayer() )
            if isTimer(startrocketjumpingthing) == false and isclear == false then
                startrocketjumpingthing = setTimer ( rocketjump, 650, 1)
            end
        elseif keyState == "up" then
            removeEventHandler("onClientRender",getRootElement(), rocketplayer )
        end
    end
end
addCommandHandler( comando, triggersuperjump )

function rocketplayer()
    local px,py,pz = getElementPosition( getLocalPlayer () )
    local currenttask = getPedSimplestTask(getLocalPlayer())
    if getTickCount() - jumpstart < 4500 and currenttask ~= "TASK_SIMPLE_NAMED_ANIM" then
        if getTickCount() - jumpstart > 3000 then
            theZ = 0
        elseif getTickCount() - jumpstart > 2000 then
            theZ = .1
        else
            theZ = .3
        end
        local playerangle = getPedRotation(getLocalPlayer())
        local newradRot = math.rad ( playerangle )
        local radius = 3
        local ex = px + radius * math.sin(newradRot)
        local ey = py + -(radius) * math.cos(newradRot)
        local ez = pz
        x,y,z = px-ex,py-ey,pz-ez
        local dist = math.sqrt(x*x+y*y+z*z)
        x = x*.4/dist
        y = y*.4/dist
        setElementVelocity(getLocalPlayer(),x, y, theZ)
    else
        removeEventHandler("onClientRender",getRootElement(), rocketplayer )
    end
end

function jumpgroundcheck()
    if superjumpgroundcheck == 1 then
        local px,py,pz = getElementPosition( getLocalPlayer () )
        local isclear = isLineOfSightClear ( px, py, pz,px, py, pz-2.5,true,true, true, true,true,true, false, getLocalPlayer() )
        local currenttask = getPedSimplestTask(getLocalPlayer())
        if isclear == false or currenttask == "TASK_SIMPLE_LAND" or isElementInWater(getLocalPlayer()) == true then
            removeEventHandler("onClientRender",getRootElement(), jumpgroundcheck )
            setElementPosition(getLocalPlayer(),px,py,pz )
            removeEventHandler("onClientRender",getRootElement(), rocketplayer )
            superjumping = 0
            triggerServerEvent ("onJumpChange", getLocalPlayer(), "normal")
        end
    end
end

function startjumpgroundcheck()
    superjumpgroundcheck = 1
    startgroundchecktimer = nil
    triggerServerEvent ("onJumpChange", getLocalPlayer(), "jumping")
end

Recuerda: El nombre del comando no es /nombre, simplemente el nombre, por ejemplo: 

comando = "saltar"

 

Edited by aka Blue
Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...