Jump to content

Greenie0101

Members
  • Posts

    126
  • Joined

  • Last visited

Everything posted by Greenie0101

  1. hey i want to make a snow effect mod, any help? i want flakes and a layer of snow up to the shin on floor, how to do this?
  2. thanks so much man, so i just had to define player in all the functions before it? Another problem with it, it works first time but then after the tree has grown again and i cut it down a second time it doesn't work?
  3. Making this script for a suggestion on CIT (already suggested it so don't think about stealing) but im having many problems with the givePlayerMoney part. Here is script. function grow1() tree1 = createObject(616, -267, -1358, -30) moveObject(tree1, 30000, -267, -1358,7.5) healthtime1 = setTimer (health1, 30000, 1) end addCommandHandler("tree", grow1) function health1() ped1 = createPed ( 0, -267, -1358,8) setElementAlpha ( ped1, 0 ) attachElements(ped1, tree1) falltime1 = setTimer (treefall1, 100, 0) end function treefall1(player) if (isPedDead ( ped1 ) ) then killTimer ( falltime1 ) moveObject(tree1, 1000, -267, -1358,7.5, 90, 0, 0) setTimer(sink1, 3000, 1) outputChatBox("You've cut down a tree! Here is your pay!", getRootElement(), 0, 255, 0, true ) givePlayerMoney ( player, 1000 ) end end function sink1() moveObject(tree1, 10000, -267, -1358,4, 90, 0, 0) setTimer(grow1, 10200, 1) setTimer(reset1, 10000, 1) end function reset1() destroyElement(tree1) end
  4. ive made it, here type /acc to enter and drive it, ill add weapons soon. function carrier(player) boat = createVehicle ( 453, 2120.2375488281, 3017.9653320313, 0, 0, 0, 90) hull = createObject ( 10771, 2014.1197509766, 3017.8559570313, 5.375, 0, 0, 0 ) lowdeck = createObject ( 11145, 1951.1853027344, 3017.8220214844, 4.2094535827637, 0, 0, 0 ) hangar = createObject ( 11146, 2005.0550537109, 3018.4548339844, 12.224634170532, 0, 0, 0 ) samsite = createObject ( 3884, 2072.220703125, 3010.1181640625, 18.22149848938, 0, 0,0 ) sambase = createObject ( 3885, 2072.37890625, 3009.3210449219, 17.750085830688, 0, 0,0 ) lines = createObject ( 10772, 2015.9813232422, 3018.1411132813, 17.16, 0, 0, 0 ) accorridors = createObject ( 11149, 2008.0537109375, 3012.9792480469, 11.536260604858, 0, 0, 0 ) bridge = createObject ( 10770, 2017.3670654297, 3010.7241210938, 38.518768310547, 0, 0, 0 ) lift1 = createObject ( 3115, 1915.5963134766, 3017.947265625, 9.7763671875, 0, 0, 0 ) attachElements(hull, boat, 0, 0, 5.375, 0, 0, 90) --done attachElements(lowdeck, boat, 0, -63, 4.2094535827637, 0, 0, 90) --done attachElements(hangar, boat, -0.6, -9, 12.224634170532, 0, 0, 90) --done attachElements(samsite, boat, 7, 45, 17.5, 0, 0, 90) attachElements(sambase, boat, 7, 45, 17.750085830688, 0, 0, 90) attachElements(lines, boat, 0.1, 1.4, 17.16, 0, 0, 90) -- done attachElements(accorridors, boat, 5.1, -6, 11.8, 0, 0, 90) -- done attachElements(bridge, boat, 7.5, 3.3, 38.518768310547, 0, 0, 90) --done attachElements(lift1, boat, 0, -99, 16.8, 0, 0, 90) --done warpPedIntoVehicle(player, boat) end addCommandHandler("acc", carrier) Still to do is add guns (i think i can do this), a marker to enter it form the deck (imnot good with client side so can someone help me here), vehicle spawns, new handling for boat and sinking. To make it sink ill make it change the boat to a car if it takes enough damage.
  5. im working on the same thing and can drive it but am rearanging the bits. will post code when done. and its attachsElements not attachElement
  6. Well i want it to be server side but setPedControlState is client side and its thr only way i can make the ped shoot. Is there any other way to make the ped shoot?
  7. Hey there, sorry that im making a new topic for pretty much the same thing but I really need help here! Ive made this code: meta.xml <meta> <script src="racer1.lua" type="server"></script> <script src="racer1_cl.lua" type="server"></script> </meta> racer1.lua function makeracer( source, key, keyState ) local gunner = createPed ( 0, 1990, 2620, 11) bindKey(source, "mouse1", "down", shoot) car = createVehicle (402, 1990, 2620,12) gun1 = createObject ( 362, 1990, 2620, 11) shoot1 = createVehicle (464, 1990, 2620, 11) attachElements (gun1, car, 0, 1.5, 0.5, 0, 30, 90) attachElements (shoot1, car, 0, 2, 0.2) setVehicleDamageProof(shoot1, true) setElementAlpha ( shoot1, 0) setElementCollisionsEnabled(shoot1, false) setVehicleLocked ( shoot1, true ) setVehicleEngineState ( shoot1, false ) warpPedIntoVehicle ( gunner, shoot1) setElementAlpha ( gunner, 0) end addCommandHandler("car", makeracer) function shoot() triggerClientEvent ("shootgun", gunner) end racer1_cl.lua function shootgun() setPedControlState ( gunner, "vehicle_fire", true) end addEvent("shootgun", true) addCommandHandler("car", makeracer) Ive only started scripting in the last month so its probs a dumb error. I want the invisible ped (gunner) who is in the invisible RC baron (shoot1) attached to the buffalo (car) to shoot the RC barons gun when the player (driving the buffalo) presses LMB. Whats wrong with what ive got?
  8. Thanks cristal, I'll give it a go. Teteomar I didn't request anything. I asked for help with something I have made and propel like cristal are giving good answers. Did I ever say: make this script for me? No. I didn't.
  9. Sorry I don't think I explained very well. I have already scripted it so that the minigun and rc baron are attached however I need to script it so I can use the rc baron gun from the buffalo driver seat. Is this possible?
  10. I am making a script which has a RC baron and a mini gun model attached to the hood of a buffalo. The RC baron is invisible and is there to do the shooting while the mini gun model looks like its shooting. I need to make it so that while sitting in the buffalo I can use ctrl to shoot with the baron. Is it possible to do this? I was thinking make an invisible ped and warp it into the RC baron. Then I bind ctrl to the peds primary attack so that when I press ctrl the ped shoots. Is this possible?
  11. but then the whole train would be straight all the time, I'm using attach elements to attach boxes and stuff to the train
  12. That's odd cos I had it without a local before and I didn't work so I tried adding a local to fix it.o well I hav another problem with it now. When I get other people on it the individual carriages begin to break up. Gaps form in the train and some carriges disappear or lose their physical part so you fall throug the floor of them.
  13. thanks mate that worked. Whats different between timer and ptimer?
  14. I made this script from scratch and it works fine for 10 or so seconds then starts to lag and crash the server. function traingo() setTrainSpeed(myTrain, -0.5) -- Speed up setTrainSpeed(car1, -0.5) -- Speed up setTrainSpeed(car2, -0.5) -- Speed up setTrainSpeed(car3, -0.5) -- Speed up setTrainSpeed(car4, -0.5) -- Speed up local timer = setTimer (traingo, 1000, 0) end addCommandHandler("go",traingo) Whats wrong? (there is more to it but that part works fine) I type /go and the train goes fine I stand on the back and it works fine 10 secs later it lags heaps and i have to restart the server
  15. thanks alot! how to add carrages tho?
  16. Hey there! I'm making a resource for I suggestion I did on CIT and need to know something. How do I make a frieght train with 15 cars at LV north train station, drive to SF train station (anticlockwise) and disappear there? Thanks in advance
  17. Hahahahaha thanks guys, yea that was pretty stupid if me so yea I'll fix it. And yea I read the health one and man you really know how to write a good tutorial mate. Nice work, it showed me Andes basics and that's y I gave the money one a go. Thanks for the tips and myonlake, keep making tutorials dude, your good at it and many people would love it as there are not many tutorials out there. I suggest you make a tutorial that shows how to script a GUI for a login or something. Then a gamemode so new scriptures are not playing on 'play'. Hen start to move to more advanced stuff such jobs and also saving your position, money, health and ammo so when you login next your where you left off.
  18. i made my 1st scritp that ive ever done on my own today and i got an error on my server CMD saying stack overflow. Here is script. local commandname = "pay" local note = "Here is $1000" function givePlayerMoney (player, cmd) givePlayerMoney (player, 100) outputChatBox(note, player, 255, 255, 0, false) end addCommandHandler(commandname, givePlayerMoney) It's probs a really stupid mistake i made so can someone please correct me. Thanks
  19. Woohoo it worked! Thanks dude, now I can wing suit!
  20. The resource came with MTA, it comes with all copies of MTA and without it parachuting is impossible. Its located at C:\Program Files\MTA San Andreas 1.3\mods\deathmatch\resources\parachute
  21. Mate, your awesome! Not many people can be bothered to make a tutorial this good. Thank you and keep it up!
  22. Im sure you all know about the parachute resource in mta. It contains many .lua files and controls how you parachute but for some really annoying reason I cant edit it. FALL_VELOCITY = 0.9 -- how fast you have to be going (z) before you stop landing properly and just hit the ground MIN_GROUND_HEIGHT = 20 -- how high above the ground you need to be before parachuting will start local y_turn_offset = 20 -- limits how far to the sides the player will lean when turning left or right local rotation_accelerate = 0.5 -- speed at which the player will lean when turning slowfallspeed = -0.07 -- fall speed with legs up fallspeed = -0.15 -- fall speed with legs down haltspeed = 0.02 movespeed = 0.2 -- horizontal speed turnspeed = 1.5 -- rotation speed when turning lastspeed = 0 opentime = 1000 local lastAnim = {} local lastTick local removing = false local function onResourceStart ( resource ) bindKey ( "fire", "down", onFire ) bindKey ( "enter_exit", "down", onEnter ) end addEventHandler ( "onClientResourceStart", resourceRoot, onResourceStart ) local function onRender ( ) lastTick = lastTick or getTickCount() local currentTick = getTickCount() local tickDiff = currentTick - lastTick lastTick = currentTick if tickDiff > 0 then if ( getElementData ( localPlayer, "parachuting" ) ) then if ( changeVelocity ) then velX, velY, velZ = getElementVelocity ( localPlayer ) if ( not isPedOnGround ( localPlayer ) and not getPedContactElement ( localPlayer ) and velZ ~= 0) then _,rotY,rotZ = getElementRotation ( localPlayer ) rotZ = -rotZ local currentfallspeed = s(fallspeed) local currentmovespeed = s(movespeed) if ( getMoveState ( "backwards" ) ) then currentfallspeed = s(slowfallspeed) end -- going too fast, slow down to appropriate speed if ( velZ < currentfallspeed ) then if ( lastspeed < 0 ) then if ( lastspeed >= currentfallspeed ) then velZ = currentfallspeed else velZ = lastspeed + s(haltspeed) end end -- going too slow, speed back up to appropriate speed elseif ( velZ > currentfallspeed ) then velZ = currentfallspeed if lastspeed <= velZ then currentmovespeed = currentmovespeed / 2 end end lastspeed = velZ local dirX = math.sin ( math.rad ( rotZ ) ) local dirY = math.cos ( math.rad ( rotZ ) ) velX = dirX * currentmovespeed velY = dirY * currentmovespeed if ( velZ == currentfallspeed ) then if ( getMoveState ( "backwards" ) ) then setPedNewAnimation ( localPlayer, "animation_state", "PARACHUTE", "PARA_decel", -1, false, true, false ) if getMoveState ( "left" ) then rotZ = rotZ - a(turnspeed,tickDiff) if y_turn_offset > rotY then rotY = rotY + a(rotation_accelerate,tickDiff) end elseif getMoveState ( "right" ) then rotZ = rotZ + a(turnspeed ,tickDiff) if -y_turn_offset < rotY then rotY = rotY - a(rotation_accelerate,tickDiff) end elseif 0 > math.floor(rotY) then rotY = rotY + a(rotation_accelerate,tickDiff) elseif 0 < math.floor(rotY) then rotY = rotY - a(rotation_accelerate,tickDiff) end elseif ( getMoveState ( "left" ) ) then rotZ = rotZ - a(turnspeed,tickDiff) if y_turn_offset > rotY then rotY = rotY + a(rotation_accelerate,tickDiff) end setPedNewAnimation ( localPlayer, "animation_state", "PARACHUTE", "PARA_steerL", -1, false, true, false ) elseif ( getMoveState ( "right" ) ) then rotZ = rotZ + a(turnspeed ,tickDiff) if -y_turn_offset < rotY then rotY = rotY - a(rotation_accelerate,tickDiff) end setPedNewAnimation ( localPlayer, "animation_state", "PARACHUTE", "PARA_steerR", -1, false, true, false ) else setPedNewAnimation ( localPlayer, "animation_state", "PARACHUTE", "PARA_float", -1, false, true, false ) if 0 > math.floor(rotY) then rotY = rotY + a(rotation_accelerate,tickDiff) elseif 0 < math.floor(rotY) then rotY = rotY - a(rotation_accelerate,tickDiff) end end setPedRotation ( localPlayer, -rotZ ) setElementRotation ( localPlayer,0,rotY, rotZ ) end setElementVelocity ( localPlayer, velX, velY, velZ ) else if velZ >= FALL_VELOCITY then --they're going to have to fall down at this speed removeParachute(localPlayer,"land") setPedAnimation(localPlayer,"PARACHUTE","FALL_skyDive_DIE", t(3000), false, true, true) else removeParachute(localPlayer,"land") setPedNewAnimation ( localPlayer, nil, "PARACHUTE", "PARA_Land", t(3000), false, true, false ) end end end local posX,posY,posZ = getElementPosition(localPlayer) if testLineAgainstWater ( posX,posY,posZ + 10, posX,posY,posZ) then --Shoot a small line to see if in water removeParachute(localPlayer,"water") setPedNewAnimation ( localPlayer, nil, "PARACHUTE", "PARA_Land_Water", t(3000), false, true, true ) end end end --Render remote players for k,player in ipairs(getElementsByType("player", root, true)) do if player ~= localPlayer and getElementData ( player, "parachuting" ) and isElementStreamedIn(player) then local velX,velY,velZ = getElementVelocity ( player ) local rotz = 6.2831853071796 - math.atan2 ( ( velX ), ( velY ) ) % 6.2831853071796 local animation = getElementData ( player, "animation_state" ) setPedNewAnimation ( player, nil, "PARACHUTE", animation, -1, false, true, false ) local _,rotY = getElementRotation(player) --Sync the turning rotation if animation == "PARA_steerL" then if y_turn_offset > rotY then rotY = rotY + rotation_accelerate end elseif animation == "PARA_steerR" then if -y_turn_offset < rotY then rotY = rotY - rotation_accelerate end else if 0 > math.floor(rotY) then rotY = rotY + rotation_accelerate elseif 0 < math.floor(rotY) then rotY = rotY - rotation_accelerate end end setElementRotation ( player, 0, rotY, -math.deg(rotz) ) end end end addEventHandler ( "onClientRender", root, onRender ) function onFire ( key, keyState ) if ( not getElementData ( localPlayer, "parachuting" ) ) and getElementData(localPlayer,"skydiving") then local x,y,z = getElementPosition(localPlayer) if not processLineOfSight ( x,y,z, x,y,z-MIN_GROUND_HEIGHT, true, true,false,true,true,false,false,false,localPlayer ) then stopSkyDiving() addLocalParachute() addEventHandler ( "onClientPlayerWasted", localPlayer, onWasted ) end end end function onEnter () if ( getElementData ( localPlayer, "parachuting" ) ) then removeParachute(localPlayer,"water") setPedAnimation(localPlayer) end end function onWasted() removeParachute(localPlayer,"water") setPedAnimation(localPlayer) setPedAnimation(localPlayer,"PARACHUTE","FALL_skyDive_DIE", t(3000), false, true, false) end function addLocalParachute() local x,y,z = getElementPosition ( localPlayer ) local chute = createObject ( 3131, x,y,z ) setElementDimension(chute, getElementDimension( localPlayer ) ) setElementStreamable(chute, false ) openChute ( chute, localPlayer, opentime ) setElementData ( localPlayer, "parachuting", true ) triggerServerEvent ( "requestAddParachute", localPlayer ) end function removeParachute(player,type) if player == localPlayer then if removing then return end removing = true end local chute = getPlayerParachute ( player ) setTimer ( setPedAnimation, t(3000), 1, player ) openingChutes[chute] = nil if chute then if type == "land" then Animation.createAndPlay( chute, {{ from = 0, to = 100, time = t(2500), fn = animationParachute_land }} ) setTimer ( function() detachElements ( chute, player ) setTimer ( destroyElement, t(3000), 1, chute ) end, t(2500), 1 ) elseif type == "water" then Animation.createAndPlay( chute, {{ from = 0, to = 100, time = t(2500), fn = animationParachute_landOnWater }} ) setTimer ( destroyElement, t(2500), 1, chute ) end end lastAnim[player] = nil if player == localPlayer then divingTick = 0 divingSpeed = nil lastspeed = math.huge toggleControl ( "next_weapon", true ) toggleControl ( "previous_weapon", true ) changeVelocity = false setElementData ( localPlayer, "animation_state", nil ) setTimer ( setElementData, 1000, 1, localPlayer, "parachuting", false ) setTimer ( function() removing = false end, 1100, 1) removeEventHandler ( "onClientPlayerWasted", localPlayer, onWasted ) triggerServerEvent ( "requestRemoveParachute", localPlayer ) end end function animationParachute_land(chute,xoff) setElementAttachedOffsets ( chute, offset[1],offset[2],offset[3], math.rad(xoff), 0, 0 ) end function animationParachute_landOnWater(chute,xoff) setElementAttachedOffsets ( chute, offset[1],offset[2],-xoff/10, math.rad(xoff), 0, 0 ) end addEvent ( "doAddParachuteToPlayer", true) addEventHandler ( "doAddParachuteToPlayer", root, function() local x,y,z = getElementPosition ( source ) local chute = createObject ( 3131, x, y, z ) setElementDimension( chute, getElementDimension( source ) ) setElementStreamable(chute, false ) openChute ( chute, source, opentime ) end
  23. One of the default resources in MTA is 'parachute'. It controls things like the angle you lean while freefalling, speed you fall, time it takes to open chute and all other parameters to do with skydiveing and parachuting. However when i edit it on notepad++ and save it then begin my server it puts itself back to what it was origionaly. How can i stop this?
  24. ok i have no idea how to script, not asking for anyone to script it but and pointers to tutorials that will help me with this type of script?
×
×
  • Create New...