-
Posts
114 -
Joined
-
Last visited
About Ryuto
- Birthday 16/12/2000
Details
-
Gang
Kami
Recent Profile Visitors
2,153 profile views
Ryuto's Achievements
Sucka (13/54)
1
Reputation
-
Olá, estou tentando criar um script onde você possa perseguir um jogador com uma determinada animação. Há um tempo consegui recriar o sistema mas tive dois problemas... A primeira é que adiciono uma animação ao código do script, mas quando o link é reproduzido, o personagem aparece completamente estático, sem qualquer animação. E a segunda é que quando utilizo o bind em altura, o personagem vai para a posição do oponente mas enquanto está em altura e não para a posição no chão. Deixo aqui um vídeo dos erros mencionados para que seja mais fácil entendê-los. Aqui deixo um vídeo do meu problema. e este é o código do meu script local playerSelectedTarget local alpha = 255 local isChasing = false local chaseDuration = 10000 addEventHandler("onClientKey", root, function(key, state) if state and key == "1" and isElement(playerSelectedTarget) then startChasingPlayer() end end ) function startChasingPlayer() if not isChasing then isChasing = true setElementData(localPlayer, "Select", false) setPedAnimation(localPlayer, "ped", "run_player", -1, true, false, false) -- Change "run_player" to the animation name you want !!!!! setTimer(stopChasingPlayer, chaseDuration, 1) end end function stopChasingPlayer() isChasing = false setPedAnimation(localPlayer) end addEventHandler("onClientRender", root, function() if (getKeyState("mouse2") == true) then local x, y, z = getElementPosition(localPlayer) for k, target in ipairs(getElementsByType("player", root, true)) do if not (target == localPlayer) then local px, py, pz = getElementPosition(target) local distance = getDistanceBetweenPoints3D(px, py, pz, x, y, z) if playerSelectedTarget ~= localPlayer and (distance < 30) then playerSelectedTarget = target alpha = 255 setElementData(localPlayer, "Select", true) end end end if isElement(playerSelectedTarget) then local Px, Py, Pz = getCameraMatrix() local zhx, zhy, zhz = getPedBonePosition(playerSelectedTarget, 3) local dist = getDistanceBetweenPoints3D(Px, Py, Pz, zhx, zhy, zhz) if playerSelectedTarget ~= localPlayer and (dist < 30) then if (isLineOfSightClear(Px, Py, Pz, zhx, zhy, zhz, true, true, false, false, true, false, false, playerSelectedTarget)) then local sxx, syy = getScreenFromWorldPosition(zhx, zhy, zhz + 0.3) if sxx and syy then local size = 1300 / dist dxDrawImage(sxx - (size / 2), syy - (size / 4.5), size, size, "Effect/Select.webp", 0, 0, 0, tocolor(255, 255, 255, alpha), false) end end end end else if isElement(playerSelectedTarget) then alpha = 0 setElementData(localPlayer, "Select", false) end end if isChasing and isElement(playerSelectedTarget) then local px, py, pz = getElementPosition(localPlayer) local targetX, targetY, targetZ = getElementPosition(playerSelectedTarget) local angle = math.atan2(targetY - py, targetX - px) local speed = 0.1 local newX = px + math.cos(angle) * speed local newY = py + math.sin(angle) * speed setElementPosition(localPlayer, newX, newY, pz) end end )
-
Hello, thanks for entering my publication. I'll give you some context, I'm creating an inventory system for weapons, then you have the option to drop the weapon you have and another player can pick it up. Now the problem I have is that when two players decide to throw a weapon, then you go and try to grab the other player's weapon, the weapon that I threw on the ground is eliminated but not the one that the second player threw. here I leave my code... local colShapes = {} function DropWeapon() local , , r = getElementRotation(source) local x,y,z = getElementPosition(source) setPedAnimation(source, "BOMBER", "BOM_plant_loop",-1,true,false,false,false) setTimer(setPedAnimation, 1500, 1, source, false) takeWeapon(source, 2) obj = createObject(333, x+math.sin(math.rad(-r)) * 1,y+math.cos(math.rad(-r)) * 1, z-1, 90) col = createColSphere(x+math.sin(math.rad(-r)) * 1,y+math.cos(math.rad(-r)) * 1,z, 0.5) colShapes[col] = obj addEventHandler("onColShapeHit", col, function(hitter) if getElementType(hitter) == "player" then if colShapes[source] then outputChatBox("ENTER",hitter,255,255,0,true) bindKey(hitter,"F","down",TakeWeapon) --destroyElement(colShapes[source]) --destroyElement(source) end end end) addEventHandler("onColShapeLeave", col, function(hitter) if getElementType(hitter) == "player" then if colShapes[source] then outputChatBox("EXIT",hitter,255,255,0,true) unbindKey(hitter,"F","down",TakeWeapon) -- colShapes[source] = nil end end end) end addEvent ("dropKatana", true) addEventHandler ("dropKatana", root, DropWeapon) function TakeWeapon(source) if isElement(colShapes[col]) then colShapes[col] = obj colShapes[source] = nil giveWeapon(source, 2, 1, true) setPedAnimation(source, "BOMBER", "BOM_plant_loop",-1,true,false,false,false) setTimer(setPedAnimation, 1500, 1, source, false) unbindKey(source,"F","down",TakeWeapon) destroyElement(colShapes[col]) destroyElement(source) end end thank you!!
-
Thank you very much, I am getting closer to what I am looking for. but I have two problems... The first is that I add an animation to the script code, but when the link is played, the character appears completely static without any animation. And the second is that when I use the bind while at height, the character goes to the opponent's position but while at height and not to the position on the ground. Here I leave a video of the aforementioned errors so that it is easier to understand them.
-
Hello how are you? I want to ask if it is possible to use an animation that chases a nearby player that is being targeted. I give an example: Pressing the "1" key while selecting a nearby player activates Woozie's running animation and then begins chasing the player for a certain amount of time. I give an example of what I'm looking for... and this is the code to target a player. local playerSelectedTarget local alpha = 255 addEventHandler("onClientRender", root, function() if ( getKeyState("mouse2") == true ) then local x,y,z = getElementPosition(localPlayer) for k,target in ipairs(getElementsByType("player",root,true)) do if not ( target == localPlayer ) then local px,py,pz = getElementPosition(target) local distance = getDistanceBetweenPoints3D( px, py, pz, x, y, z ) if playerSelectedTarget ~= localPlayer and ( distance < 30 ) then --target distanc playerSelectedTarget = target local alpha = 255 setElementData(localPlayer, "Select", true) end end end if isElement(playerSelectedTarget) then local Px,Py,Pz = getCameraMatrix( ) local zhx,zhy,zhz = getPedBonePosition(playerSelectedTarget,3) local dist = getDistanceBetweenPoints3D ( Px, Py, Pz, zhx,zhy,zhz ) if playerSelectedTarget ~= localPlayer and ( dist < 30 ) then --target distanc if ( isLineOfSightClear ( Px, Py, Pz, zhx,zhy,zhz, true, true, false, false, true, false, false, playerSelectedTarget ) ) then local sxx,syy = getScreenFromWorldPosition(zhx,zhy,zhz+0.3) if sxx and syy then local size = 1300 / dist dxDrawImage( sxx - ( size / 2 ), syy - ( size / 4.5 ), size, size, "Effect/Select.webp", 0, 0, 0, tocolor ( 255, 255, 255, alpha ),false) end end end end else if isElement(playerSelectedTarget) then local alpha = 0 setElementData(localPlayer, "Select", false) end end end ) thanks for reading this post.
-
Thank you very much, it has worked very well for me. I want to ask how I can run the animations server-side so everyone can see them.
-
Hello, thanks for entering my post. I have a question... Is it possible to create a bind system that when pressing, for example, the "X" key repeatedly, different animations are played? I give an example: I press the "X" key for the first time, doing so plays a dance animation. Then I press the "X" again for the second time and doing so plays the vomiting animation. And so on.
-
Hello, thanks for entering my post. Is it possible to create an "Aura" effect in MTA? This is pretty much what I'm trying to achieve. I also wanted to ask if it is possible to change the default fire color, without affecting the original fire.
-
I'm sorry to reopen this post again but I have a question. Is there a way to detect if the player is being selected from another external script so I can execute a function?
-
Is there a way to recreate this wall walking system at MTA? I know there is a script called "Gravity Wheels" created by user @Ren_712 but it only works on vehicles, I was wondering if there is a way to adapt that system on players? What functions could I use?
-
Thank you very much, I'm going to try it on my local server. Is there a way for it to work with walls or other objects?
-
Hello, thanks for entering my post. Is it possible to add a function to an MTA object when interacting with a player? I want to make an object (in this case a ball) explode when it touches a player. I also wanted to ask if it is possible for it to explode upon contact with a wall or any other object on the map. I leave a video showing my problem and what I want to achieve.... What functions could I use to achieve something similar?
-
Hello!! I was able to create a player selection system but I have a small error. This system only selects a specific player and there is no way to select other nearby players. Is there another way to select other players? For example, by pressing a button or pressing the mouse wheel you can select another nearby player. This is my script code. local playerSelectedTarget local alpha = 255 addEventHandler("onClientRender", root, function() if ( getKeyState("mouse2") == true ) then local x,y,z = getElementPosition(localPlayer) for k,target in ipairs(getElementsByType("player",root,true)) do if not ( target == localPlayer ) then local px,py,pz = getElementPosition(target) local distance = getDistanceBetweenPoints3D( px, py, pz, x, y, z ) if playerSelectedTarget ~= localPlayer and ( distance < 30 ) then --target distanc playerSelectedTarget = target local alpha = 255 setElementData(localPlayer, "Select", true) end end end if isElement(playerSelectedTarget) then local Px,Py,Pz = getCameraMatrix( ) local zhx,zhy,zhz = getPedBonePosition(playerSelectedTarget,3) local dist = getDistanceBetweenPoints3D ( Px, Py, Pz, zhx,zhy,zhz ) if playerSelectedTarget ~= localPlayer and ( dist < 30 ) then --target distanc if ( isLineOfSightClear ( Px, Py, Pz, zhx,zhy,zhz, true, true, false, false, true, false, false, playerSelectedTarget ) ) then local sxx,syy = getScreenFromWorldPosition(zhx,zhy,zhz+0.3) if sxx and syy then local size = 1300 / dist dxDrawImage( sxx - ( size / 2 ), syy - ( size / 4.5 ), size, size, "Effect/Select.webp", 0, 0, 0, tocolor ( 255, 255, 255, alpha ),false) end end end end else if isElement(playerSelectedTarget) then local alpha = 0 setElementData(localPlayer, "Select", false) end end end ) I leave a video of my problem so you can see the error. thanks for reading me!!
-
Is there a function to change this kind of sounds? in this case I want to change the sound of CJ's footsteps. it's possible?
-
When you get close to a skin or a ped, the ped's voice appears and sounds bad on some skins. How can I remove them so that nothing is heard?
-
I really appreciate your help, little by little I'm seeing results. I have a small problem, if I hold mouse2 down, the trigger repeats many times. Isn't there another way to detect if the player is being selected without using the trigger? something like an "if" condition to detect if the player is being selected from the serverside. I have another question, is it possible to use a bind when selecting the player so that he performs an animation? for example I select it with mouse2 and if I press the number one button the selected player does an animation. something like this: Local HitPlayer = getPedTarget(thePlayer) if not HitPlayer then return end if HitPlayer and (getElementType(HitPlayer) = "ped" ) then setPedAnimation