-
Posts
68 -
Joined
-
Last visited
Everything posted by -Blaze-
-
Hello , I am trying to attach a blip to the chopper type vehicles. I will attach 2 blips, 1) the chopper body , 2) the rotor of the chopper. Is there a way i can make the rotor blip rotate so it looks like a working chopper on the map?
-
Can you give an example?
-
Hello , I am working on a mounted machine gun script , that places big guns on cars and a player is able to go on top and use it. I am using createObject for making a base_minigun and then using createWeapon to make a custom weapon and attaching them both with attachElements However these are all made clientside (since createWeapon is a clientside function) and are not visible and synced with all the players. when a player uses the mounted gun , he is able to rotate it and direct the line of fire, but the rotation of the weapon cannot be seen by all the players. Is there a way i can sync the client side created object and custom weapon so it is visible to all the players? My code so far : Server : addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() truck1 = createVehicle ( 470, 201.33500671387, 1908.2733154297, 17.640625 ,0,0,0, "Hex" ) setElementData( truck1, "mgtruck1", true) createBlipAttachedTo ( truck1, 0, 1) setTimer(triggerClientEvent, 500, 1, getRootElement(), "one", resourceRoot) end) i created the vehicle serverside because clientside vehicles aren't enterable. Client: function attachmgtotruckone() alltruck1 = getElementsByType ( "vehicle" ) for key, thetruck1 in ipairs ( alltruck1 ) do if getElementModel( thetruck1 ) == 470 then if getElementData(thetruck1, "mgtruck1" ) then local x, y, z = getElementPosition( thetruck1 ) local rx, ry, rz = getElementRotation( thetruck1 ) stand1 = createObject( 2985, x+2, y, z-1 ,rx,ry,rz+90) mountgun1 = createWeapon ( "minigun", 0, 0, 0 ) setElementAlpha( mountgun1, 50) attachElements( mountgun1, stand1, -0.2, 0 , 0.-- s8) --> attachElements( stand1, thetruck1, 0, 0, 0.6, 0, 0, 90) setElementCollisionsEnabled ( mountgun1, false ) setElementCollisionsEnabled ( stand1, false ) end end end end addEvent("one", true) addEventHandler("one", root, attachmgtotruckone) function moveup1() if isElement( stand1) then local thetruck1 = getElementAttachedTo ( stand1 ) if getElementData( localPlayer, "mg1controller") then if roty1 == 30 then return end attachElements( stand1, thetruck1, 0, 0, 0.6, 0, roty1+5, rotz1) roty1 = roty1+ 5 end end end function movedown1() if isElement( stand1) then local thetruck1 = getElementAttachedTo ( stand1 ) if getElementData( localPlayer, "mg1controller") then if roty1 == -30 then return end attachElements( stand1, thetruck1, 0, 0, 0.6, 0, roty1-5, rotz1) roty1 = roty1 - 5 end end end function moveleft1() if isElement( stand1) then local thetruck1 = getElementAttachedTo ( stand1 ) if getElementData( localPlayer, "mg1controller") then attachElements( stand1, thetruck1, 0, 0, 0.6, 0, roty1, rotz1+5) rotz1 = rotz1 + 5 end end end function moveright1() if isElement( stand1) then local thetruck1 = getElementAttachedTo ( stand1 ) if getElementData( localPlayer, "mg1controller") then attachElements( stand1, thetruck1, 0, 0, 0.6, 0, roty1, rotz1-5) rotz1 = rotz1 - 5 end end end bindKey("a", "down", moveleft1) bindKey("d", "down", moveright1) bindKey("s", "down", moveup1) bindKey("w", "down", movedown1)
-
Post the recent working code here and i'll show you and explain how.
-
function onPlayerClick(button, state, absX, absY, wx, wy, wz, element) if (element and getElementType(element) == "player" and state=="down") then if element ~= getLocalPlayer() then return end local x, y, z = getElementPosition(localPlayer) if (getDistanceBetweenPoints3D(x, y, z, wx, wy, wz) <=3) then RenderHolo() end end end addEventHandler("onClientClick", getRootElement(), onPlayerClick) Sorry , my bad. Try the above code . It should work.
-
Well , if i didnt get you wrong , what you want to say is that if you click on a player or ped the window should show. If you click on yourself , it shouldnt show. Well , its easy. You just need to write an "if " statement to check that the clicked element is not the local player himself. Replace your first function with this -> function onPlayerClick(button, state, absX, absY, wx, wy, wz, element) if (element and getElementType(element) == "player" and state=="down") then if element == getLocalPlayer() then return end local x, y, z = getElementPosition(localPlayer) if (getDistanceBetweenPoints3D(x, y, z, wx, wy, wz) <=3) then RenderHolo() end end end addEventHandler("onClientClick", getRootElement(), onPlayerClick) Also , i would prefer not to use "element" as a parameter. Use "theelement" or something.
-
Hello , I have 2 questions related to weapons . 1) How to calculate the rotation of a weapon while it is being aimed or it is stationary. (player's weapon) 2) Is it possible to hold weapons of similar types suck as a pistol and a silenced or a m4 and an AK-47. If yes , how? Thanks. Warm Regards.
-
Thanks @TrapLord Studios™ and @NeverGiveup
-
hey, i'm searching for an in-flight HUD , if anyone hasn't made one , i might as well be the first. Does one already exist at the community? if yes, could i have the link?
-
Whats your skype ID?
-
Hello, Is there a way where 2 teams can be created and the players playing in game currently can be divided equally and set to those teams?
-
Thanks , it works
-
hello everyone , is there a way to cancel the damage done to a player when he falls from a height?
-
Thanks , @xXMADEXx it works just fine.
-
Hello everybody , i'm trying to make a script where the last player in combat gets a reward. I'm using onVehicleExplode() to check on the number of alive players since it is a Shooter mode. How can i get the last player alive and set a variable to him so i may be able to give him money , exp ,etc.?
-
hello everyone , i'm having some bugs in a game-mode when i use don't change option in the vote map. Is there a way to disable it in the vote map?
-
Well , you can do that easily with a little bit of scripting knowledge. Set a timer that checks the players ammo every 50 milisecs . If ammo is lesser than 2 then toggle the fire control off. If more than 1 then toggle the fire control on. You can easily mess with the hud by adding a "-1" in the getPedTotalAmmo part.
-
Hello everybody , i'd had been working on a zombie RPG project for a while , and now it's finished and hosted. Name - Zombie RPG - Missions , Mods , Bosses, Objectives Ip - mtasa://213.136.80.168:22008 some shots - well , there's a lot more , but i wouldn't want my ideas stolen . All RPG/Zombie lovers are welcome to join .
-
Change default animation from slothbot when they're chasing
-Blaze- replied to Stanley Sathler's topic in Scripting
I made some zombies with it and it worked just fine. use a timer to set the walking style. Example : when the ped is created setTimer(setPedWalkingStyle, 2000, 1, thePed, the ID) -
Change default animation from slothbot when they're chasing
-Blaze- replied to Stanley Sathler's topic in Scripting
It doesen't need a rewrite . All you have to do is use setPedWalkingStyle when you create the ped. -
hey , this is a beautiful idea of yours, and i think i found the problem in your code . this should work - function loadModels() weapontxd1 = engineLoadTXD ("models/weap/ak47.txd"); weapondff1 = engineLoadDFF ("models/weap/ak47.dff"); end addEventHandler("onClientResourceStart",root,loadModels) function onClientPlayerSkinChange() if getElementData(localPlayer,"currentweapon_1") == "FNFAL" then if getElementData(localPlayer,"done") == true then return end engineImportTXD (weapontxd1, 355); engineReplaceModel (weapondff1, 355); setElementData( localPlayer, "done", true) elseif getElementData(localPlayer,"currentweapon_1") == "AK-47" then engineRestoreModel(355) setElementData( localPlayer, "done", false) else engineRestoreModel(355) setElementData( localPlayer, "done", false) end end addEventHandler("onClientPlayerWeaponSwitch",localPlayer,onClientPlayerSkinChange) you must use an element data so that models don't replace again and again when you switch , and in " weapondff1 = engineLoadDFF ("models/weap/ak47.dff");", the invisibility was 0. That's the reason the models didn't appear.
-
yes , it can be done. and , setCameraTarget supports both , client and server.
-
well , i tried this. col = {} Zombies = createTeam("Zombies") function getElementsWithinMarker(marker) if (not isElement(marker) or getElementType(marker) ~= "marker") then return false end local markerColShape = getElementColShape(marker) local elements = getElementsWithinColShape(markerColShape) return elements end function makeazombie(source) local x, y, z = getElementPosition( source ) zombie = exports [ "slothBot" ]:spawnBot ( x+7, y, z, 90, 285, 0, 0, Zombies, 0,"hunting", true ) setElementData( zombie, "loler", true) col[1] = createMarker( 0, 0, 0, "cylinder", 10, 0, 255, 0, 100) attachElements(col[1], zombie, 0, 0, -1) setElementParent(col[1],zombie) killTimer = setTimer( function() local howmany = getElementsWithinMarker ( col[1] , "player") if (#howmany == 0) then if (zombie) then killPed( zombie ) end end end, 5000, 0) end addCommandHandler("zombie", makeazombie) function test(hitElement, mD) if (source == col[1]) then outputChatBox("you entered", hitElement) end end addEventHandler ( "onMarkerHit", getRootElement(), test ) but it doesn't work. any help?
-
hello, today i was making a script related to zombies. here it is. well, when the person , who created it , is far away from the zombie , the zombie gets killed. Zombies = createTeam("Zombies") function makeazombie(source) local x, y, z = getElementPosition( source ) zombie = exports [ "slothBot" ]:spawnBot ( x+7, y, z, 90, 285, 0, 0, Zombies, 0,"hunting", true ) setElementData( zombie, "loler", true) gay = setTimer( function () local xL,yL,zL = getElementPosition( zombie ) local xx, yx, zx = getElementPosition( source ) if getDistanceBetweenPoints3D (xx,yx,zx,xL,yL,zL) > 50 then if (zombie) then killPed( zombie ) if (gay) then killTimer(gay) outputChatBox( " the zombie was killed ", source) end end end end, 5000, 0) end addCommandHandler("zombie", makeazombie) But if there are any other players around ( in his range of 50) , when the person gone farther than 50 , then he shoudn't die, so that he can attack the others in his range. But if there is no one in the range of 50 , then he should be killed. Any idea how i can do this?