Lalalu Posted September 7, 2016 Share Posted September 7, 2016 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 autorq del script), quiero que se active con un comando pero no sé como , soy nueva en esto del script 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
Simple0x47 Posted September 7, 2016 Share Posted September 7, 2016 Publica esto en la sección española en el subforo de Scripting. Gracias Link to comment
EstrategiaGTA Posted September 7, 2016 Share Posted September 7, 2016 Usa addCommandHandler 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