Jump to content

Crook4Money

Members
  • Posts

    33
  • Joined

  • Last visited

Details

  • Location
    Washington, US
  • Occupation
    GTA:SA Speedrunner, Noob Roleplayer, Terrible MTA Scripter

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Crook4Money's Achievements

Rat

Rat (9/54)

1

Reputation

  1. I made a script that I had to restart from scratch due to not backing it up and completely breaking it. When the script was in a better state I could get the sound to follow the vehicle I was driving, but I can't seem to get that to happen again. function startMySound(thePlayer) if ( isPedInVehicle ( thePlayer ) ) then local vehicle = getPedOccupiedVehicle(thePlayer) local x,y,z = getElementPosition( vehicle ) playSound3D( "sound1.mp3", x, y, z, true ) end end addEventHandler( "onClientVehicleEnter", root, startMySound ) From what I tried to remember from the last script setting the x,y,z to the vehicle was allowing the sound to follow the vehicle using the local coordinates, but the sound now just starts at the car and stays where the sound started playing. How do I get it to track your position? Edit: Come to think of it I couldn't get PlaySound3D to work at all with the original script for whatever reason and instead used PlaySound which would follow the player by default. So I guess I never had this working to begin with.
  2. I just didn't know you could set a separate timer within a single function. I tried it a couple times before, but it didn't work for whatever reason. Maybe my pointless return values were messing something up.
  3. I had to try about a couple hundred different variables to get what I wanted, but I finally got it using my previous script. function moveDoor(player, vehicle) local vehicle = getPedOccupiedVehicle(player) local money = getPlayerMoney(player) if ( money >= 200 ) and getElementHealth(vehicle) < 1000 then local move = moveObject(door1, moveTime, 2071.5, -1831.4000244141, 14.60000038147, 0, 90, 0) triggerClientEvent("doorSound", resourceRoot) if move then isMoving = false setTimer(moveDoor, moveTime, 1, true) end setTimer(function() moveObject(door1, moveTime, 2072.5, -1831.4200244141, 16.5, 0, -90, 0) isMoving = false triggerClientEvent("doorSound", resourceRoot) end, 6000, 1) end end addEventHandler("onMarkerHit", marker1, moveDoor) Function thing may be wrong again, but whatever. It works.
  4. I just need door 2 to trigger after the first. The reason I'm having issues though is that the second door is on a timer where as the first door isn't. Also they're the same door. It goes up and then down.
  5. Unfortunately the changes made have the same result. The second door still isn't responding correctly. It's actually responding the exact same way as it was previously. This was the change I needed to work. I don't know how to get it to respond to the second line of script as I was actually asking this question originally. setTimer(door2, moveTime, 1, true)--This will trigger door2 after moveTime is over Edit: Before this post door 1 was responding correctly and door 2 was either responding incorrectly or not at all. After the changes this is still the case.
  6. I use the wiki everytime I have a problem. I guess I just messed up the vehicle part as I was copying it from the beginning of my script that does something entirely different. function moveDoor(hitElement, dimension) I'm also completely oblivious to the use of the words in the ( ) as well which has been causing me issues for quite some time.
  7. That was just the part of the script I was having issues with. The entire script is 81 lines.
  8. I'm basically trying to tell one function that if another function happens to go ahead and do the thing. function moveDoor(player, vehicle) local vehicle = getPedOccupiedVehicle(player) local money = getPlayerMoney(player) if ( money >= 200 ) and getElementHealth(vehicle) < 1000 then if isMoving then return end if source == marker1 then local move = moveObject(door1, moveTime, 2071.5, -1831.4000244141, 14.60000038147, 0, 90, 0) triggerClientEvent("doorSound", resourceRoot) if move then isMoving = false setTimer(moveDoor, moveTime, 1, true) end end end end addEventHandler("onMarkerHit", marker1, moveDoor) function door2(player, vehicle) setTimer(function() if moveDoor = true then moveObject(door1, moveTime, 2072.5, -1831.4200244141, 16.5, 0, -90, 0) isMoving = false triggerClientEvent("doorSound", resourceRoot) end end, 6000, 1) end addEventHandler("onMarkerHit", marker1, door2) I'm trying to do this as the second door function is giving me problems so bypassing the whole "trying to get it to work similarly" would be great if I could just tell it to start if the first door function starts. My problem with duplicating the scripts which wasn't a problem when I first did it, but then became one is that it says that I'm trying to attach numbers to booleans, nils or even that the player element is registering as a vehicle.
  9. How would you go about showing the radius on the map?
  10. Ah, I thought I'd have to use a ColShape which is what I was trying before. This was a lot more complex than I originally thought. lol Nice. It works just as I wanted it to. Thanks.
  11. Can anyone show me a simple script for making a player lose health if he's in a marker or something. I can't seem to get the player to lose health that way. Basically trying to go for a zone method like PUBG where you lose health over time in a circle.
  12. That was kind've the problem I guess. I copied one of your guys scripts that had the argument like this. local vehHealth = getElementHealth( theVehicle ) I had to change all of "theVehicle"s to just "vehicle". I finally got my script working as it should now with a ton of trying to do workarounds till I figured out why the element wasn't established. I'm not sure in which cases you'd use "theVehicle", but I know that it works cos I tried MOG's script and it was functional in his. Maybe I'm just missing something with that. Idk. Was funny tho cos I actually rebuilt my script in a different structure and tho it was pointless what I needed it to do came out better and more consistent. Probably. Only messing around with scripting for a month or two is pretty tough especially just getting into creating my own script for once and getting into the use of else/if. I definitely wouldn't have been able to get my script to function the way I wanted to without your guys help. Thanks
  13. When I try to use local vehHealth = getElementHealth( theVehicle ) if vehHealth >= 999 then or if getElementHealth(vehicle) < 1000 then in my script I keep getting an error "attempt to compare number with boolean."
  14. Ah, thanks. I was curious if other markers would interact the same way. I was just using root as a placeholder for not knowing what I'm doing. I'll try to implement this tomorrow. I like the simplicity of it anyways and doesn't seem to cause as many issues as I was having earlier.
×
×
  • Create New...