-
Posts
60 -
Joined
-
Last visited
Everything posted by Noah_Antilles
-
Thanks for replying @3laa33 I tried your script but it doesn't work, nothing happens when I press u
-
I've posted the same script sometime ago, but it turned out it wasn't the scripts fault, but rather a problem with the model. Now I am wondering how I can smoothly rotate a vehicle component. Right now when I press "u" the component instantly moves 90 degrees, but I'd much rather have that it rotates gradually. Much like in this video: https://www.youtube.com/watch?v=Rg-BAa7gvuw&feature=youtu.be&t=45s Here's my script: function shamalFunctions() local vehicle = getPedOccupiedVehicle(localPlayer) local x, y, z = getVehicleComponents(vehicle, "gearflapleft" ) if(vehicle)then if getElementModel(vehicle) == 519 then local rx, ry, rz = getVehicleComponentRotation(vehicle, "gearflapleft") setVehicleComponentRotation(vehicle, "gearflapleft", rx, ry+90, rz) end end end bindKey("u", "down", shamalFunctions) Thanks for your time -Noah
-
Thanks for your help @Einheit-101 It fixed my problem. I would've never figured this out on my own, so thanks a lot
-
Hey guys, In a model I've added a custom vehicle component (gearflapleft) What it is supposed to do is rotate 90 degrees when I press u. This works perfectly, however, It also scales the component about three times larger. What's going on here? function shamalFunctions() local vehicle = getPedOccupiedVehicle(localPlayer) local x, y, z = getVehicleComponents(vehicle, "gearflapleft" ) if(vehicle)then if getElementModel(vehicle) == 519 then local rx, ry, rz = getVehicleComponentRotation(vehicle, "gearflapleft") setVehicleComponentRotation(vehicle, "gearflapleft", rx, ry+90, rz) end end end bindKey("u", "down", shamalFunctions) Pics for a better explanation: https://gyazo.com/a41f4801a76a3894671452f0598ac814 https://gyazo.com/b399008953774d5216db6f30f9895dde Thanks for your help!
-
Thanks
- 17 replies
-
- bone county
- canyon
-
(and 3 more)
Tagged with:
-
Heya, This is a small project I've spend three days on so far. I was bored of the same old desert so I decided to add a canyon. I feel like this gives the desert a fresh, new feeling while still retaining the good ol' San Andreas vibe. https://www.youtube.com/watch?v=RwetzEnNs-8&feature=youtu.be Things I've yet got to do: Create LOD models. Prelight the models so they fit in more with the enviroment. Small tweaks here and there. Let me know what you think! -Noah
- 17 replies
-
- 6
-
- bone county
- canyon
-
(and 3 more)
Tagged with:
-
[REL] Texture replacement SHADER (car wraps etc)
Noah_Antilles replied to Dutchman101's topic in Resources
Heya there Dutchman, I was looking into using custom shaders in order to have unique vehicles in my server. Am I allowed to use this in my server? I´ll of course give you and Ren_712 credit for this script. Thanks in advance, -Noah -
Thank you for your wonderful replies with explanation ^^ I will try my best to fix it
-
Thanks for your reply. Well I guess I do want to make a serverside script, but I've never made one before, so that's quite a challenge I have no idea where to begin honestly. could you give me some more info where to start: How can I make two scripts (one serverside & one clientside) work together? As far as I can see the setElementData causes most problems. Is there something else I can use? Thanks for your time
-
Hello everyone. After loads of work and help from you guys I finally managed to get a custom weapon script on the Hydra working... ...only to find out it doesn't sync to any other player in the server. Other players don't see the weapon. Other players don't get damaged by the weapon Vehicles the other player used aren't receiving any damage either. I tried to somehow get it to work this weekend, But I failed and I have no idea what to do. function hydraFunctions() local vehicle = getPedOccupiedVehicle(localPlayer) if(vehicle)then if getElementModel(vehicle) == 520 then --outputChatBox ("Hydra guns installed") toggleControl ( "accelerate", true ) toggleControl ( "brake_reverse", true ) toggleControl ( "vehicle_secondary_fire", false ) toggleControl ( "vehicle_fire", false ) setControlState ( "special_control_up", true) toggleControl ( "special_control_down", false) local x, y, z = getElementPosition(vehicle) local weaponR = createWeapon("m4", x, y, z) local weaponL = createWeapon("m4", x, y, z) local weaponHydraR = setElementData(vehicle, "weaponHydraR", weaponR, true) local weaponHydraL = setElementData(vehicle, "weaponHydraL", weaponL, true) attachElements ( weaponR, vehicle, -0.5, 5, -0.5, 0, 0, 90) attachElements ( weaponL, vehicle, 0.5, 5, -0.5, 0, 0, 90) setWeaponClipAmmo(weaponR, 5000000) setWeaponFiringRate(weaponR, 50) --setWeaponFlags(weaponR, "disable_model", true) setWeaponClipAmmo(weaponL, 5000000) setWeaponFiringRate(weaponL, 50) --setWeaponFlags(weaponL, "disable_model", true) end end end addEventHandler ( "onClientPlayerVehicleEnter", getLocalPlayer(), hydraFunctions ) function hydraFiring() local vehicle = getPedOccupiedVehicle(localPlayer) if(vehicle)then if getElementModel(vehicle) == 520 then if getElementData(vehicle, "weaponHydraR", true ) then if getElementData(vehicle, "weaponHydraL", true ) then setWeaponState(getElementData(vehicle, "weaponHydraR"), "firing") setWeaponState(getElementData(vehicle, "weaponHydraL"), "firing") --outputChatBox ("guns activated") end end end end end function hydraStopping() local vehicle = getPedOccupiedVehicle(localPlayer) if(vehicle)then if getElementModel(vehicle) == 520 then if getElementData(vehicle, "weaponHydraR", true ) then if getElementData(vehicle, "weaponHydraL", true ) then setWeaponState(getElementData(vehicle, "weaponHydraR"), "ready") setWeaponState(getElementData(vehicle, "weaponHydraL"), "ready") --outputChatBox ("guns deactivated") end end end end end bindKey("mouse1", "down", hydraFiring) bindKey("mouse1", "up", hydraStopping) bindKey("lctrl", "down", hydraFiring) bindKey("lctrl", "up", hydraStopping) How do I get this script to sync for all other players? so they can see the weapon too and get damaged by it (including the vehicle they're in)
-
Beginner scripter here, you could try to use: setWeaponProperty "anim_loop_start" - float - Start of aimed firing animation loop "anim_loop_stop" - float - End of aimed firing animation loop (Reduce to increase firing rate) "anim_loop_bullet_fire" - float - Time in aimed firing animation when weapon should be fired (Must be between Start and End) I would try to use the following settings: ¨anim_loop_start¨ 0.2 or 0.3 ¨anim_loop_bullet_fire¨ 0.2 or 0.3 (same settings you used for anim_loop_start) ¨anim_loop_stop¨ 5.0 or something big (the larger this amount the later the player can fire again) Just try whether or not it works -Noah
-
Thank you for your tips and feedback. I was struggling so hard to find why the setWeaponState function didn't work ^^ Now I see the local weapon created in hydraFunctions was outside the scope and thus not recognized by the other functions. I learned some great tips and tricks thanks to you all. Thanks again!
-
I've been posting a lot here lately, and I am sorry if I'm getting annoying. But after a whole afternoon of trying to get my script to work I'd like to get some feedback. After I learned of the existence of debugging I immediatly went ahead and tried it. I almost fixed my script, but there's one problem keeping it from working Context: Player enters vehicle and an uzi is spawned and attached to the vehicle When the player presses left mouse button the uzi starts firing When the left mouse button is released the uzi should stop firing. function hydraFunctions() local vehicle = getPedOccupiedVehicle(localPlayer) if(vehicle)then if getElementModel(vehicle) == 520 then outputChatBox ("Hydra guns installed") toggleControl ( "accelerate", true ) toggleControl ( "brake_reverse", true ) toggleControl ( "vehicle_secondary_fire", false ) toggleControl ( "vehicle_fire", false ) setControlState ( "special_control_up", true) toggleControl ( "special_control_down", false) local x, y, z = getElementPosition(vehicle) local weapon = createWeapon("uzi", x, y, z) local weaponHydraR = setElementData(vehicle, "weaponHydraR", weapon, true) attachElements ( weapon, vehicle, 0, 4, 1, 0, 0, 90) setWeaponClipAmmo(weapon, 500) setWeaponFiringRate(weapon, 90) end end end addEventHandler ( "onClientPlayerVehicleEnter", getLocalPlayer(), hydraFunctions ) function hydraFiring() local vehicle = getPedOccupiedVehicle(localPlayer) if(vehicle)then if getElementModel(vehicle) == 520 then if getElementData(vehicle, "weaponHydraR", true ) then setWeaponState(weapon, "firing") -- Can't seem to find the weapon outputChatBox ("guns activated") end end end end function hydraStopping() local vehicle = getPedOccupiedVehicle(localPlayer) if(vehicle)then if getElementModel(vehicle) == 520 then if getElementData(vehicle, "weaponHydraR", true ) then setWeaponState(weapon, "ready") -- Can't seem to find the weapon outputChatBox ("guns deactivated") end end end end bindKey("mouse1", "down", hydraFiring) bindKey("mouse1", "up", hydraStopping) bindKey("lctrl", "down", hydraFiring) bindKey("lctrl", "up", hydraStopping) WARNING: 1947weapons\hydraweaponC.lua:41: Bad argument @ 'setWeaponState' [Expected weapon at argument 1, got nil] WARNING: 1947weapons\hydraweaponC.lua:28: Bad argument @ 'setWeaponState' [Expected weapon at argument 1, got nil] What I think is happening: The uzi spawns perfectly fine, but for some reason the following functions (hydraFiring & hydraStopping) cannot "detect" the uzi, hence the [Expected weapon at argument 1, got nil] error message. The uzi is simply not found. Also, I read on the forums that the setElementData and getElementData should only be used with more important data (which this isn't really I guess.) Is there an alternative that I can use? Thanks for your time, -Noah
-
Thanks for replying, and believe me I am not taking this as an offence at all. You see if I knew there was such a debugging tool I would´ve used it before, but I simply didn´t know it excisted. I try to spend atleast a day trying to get a code to work, and after that day if I still haven´t managed I try to look for help here. In the future I will use the debugging tool before posting here. Thanks @pa3ck
-
Hello there, I've been having some trouble with the DestroyElement function. (destroyHydraGun function, line 42-51) The rest of the script works fine. An uzi is created when a player enters a Hydra, but it doesn't seem to destroy the uzi when a player exits the vehicle. What am I doing wrong? function hydraFunctions() -- ignore this function local vehicle = getPedOccupiedVehicle(localPlayer) if(vehicle)then if getElementModel(vehicle) == 520 then outputChatBox ("Hydra guns installed") toggleControl ( "accelerate", true ) toggleControl ( "brake_reverse", true ) toggleControl ( "vehicle_secondary_fire", false ) toggleControl ( "vehicle_fire", false ) setControlState ( "special_control_up", true) toggleControl ( "special_control_down", false) local x, y, z = getElementPosition(vehicle) local weapon = createWeapon("uzi", x, y, z) attachElements ( weapon, vehicle, 0, 4, 1, 0, 0, 90) end end end addEventHandler ( "onClientPlayerVehicleEnter", getLocalPlayer(), hydraFunctions ) function hydraFiring() -- ignore this function local vehicle = getPedOccupiedVehicle(localPlayer) if(vehicle)then if getElementModel(vehicle) == 520 then setWeaponClipAmmo(weapon, 500) setWeaponFiringRate(weapon, 90) setWeaponState(weapon, "firing") outputChatBox ("guns activated") end end end function hydraStopping() -- ignore this function local vehicle = getPedOccupiedVehicle(localPlayer) if(vehicle)then if getElementModel(vehicle) == 520 then setWeaponState(weapon, "ready") outputChatBox ("guns deactivated") end end end function destroyHydraGun -- This function doesn't work local vehicle = getPedOccupiedVehicle(localPlayer) if(vehicle)then if getElementModel(vehicle) == 520 then local attached = getElementAttachedTo (vehicle) if ( attached ) then destroyElement ( weapon ) end end addEventHandler("onClientPlayerVehicleExit", getLocalPlayer(), destroyHydraGun ) bindKey("mouse1", "down", hydraFiring) bindKey("mouse1", "up", hydraStopping) bindKey("lctrl", "down", hydraFiring) bindKey("lctrl", "up", hydraStopping)
-
Creating a weapon and attaching it on a vehicle
Noah_Antilles replied to Noah_Antilles's topic in Scripting
Oh of course I am a retard. I totally forgot that. I got it working now, an uzi spawns and is attached to the Hydra. Now I will try to make it fire on left mouse button Thanks for helping me! -
Sorry for the late reply, I just saw your topic and since I have some knowledge of custom models I thought I could help you. First I will have to know some more details: Does the model load/work without the LOD? Does your model have textures? if so, how many and how big is the filesize of each texture? What SA model did you replace your custom model with? How large is your model? is it small like a house or large like a mountain? How many Polygons/Tris does your model have? models above 30k-35k+ tris tend to crash. Can you provide me with a picture of your model in 3DSMAX (or whatever program you modelled it with) Take the pictures in Wireframe mode (F4) Try to get various angles of the model, perhaps something could be wrong with the model itself. Let me know those details so I have more information to work with and perhaps solve your problem -Noah
- 1 reply
-
- custom model
- crash
-
(and 1 more)
Tagged with:
-
Creating a weapon and attaching it on a vehicle
Noah_Antilles replied to Noah_Antilles's topic in Scripting
@Mr.Loki Thanks for your reply but you´re giving me tips on my next step which I haven´t reached yet. Right now I am trying to get the uzi to spawn, but it doesn´t work for some reason. I think the problem might be that the uzi spawns somewhere, but not on the x,y,z coordinates of the player/vehicle. What could the problem be that the uzi doesn´t spawn? -
Creating a weapon and attaching it on a vehicle
Noah_Antilles replied to Noah_Antilles's topic in Scripting
@Elmatus I know spawning a weapon doesn't make it fire, but since I am a beginner I try to make my script in little steps. First try to spawn the weapon > try to attach it to the vehicle > make it fire on left click. Right now I am stuck on spawning the weapon, that's why I asked for help -
Creating a weapon and attaching it on a vehicle
Noah_Antilles replied to Noah_Antilles's topic in Scripting
Thanks for your reply, as far as I can see the uzi should spawn when I enter a Hydra. On one point I actually managed to have the uzi spawn, but soon after it didn't work anymore. would it be better to have the uzi spawn when I press left mouse? -
Hello there, I've been trying to create a weapon (uzi) and attach it on a vehicle (hydra) the weapon should fire when I click the left mouse button. I am stuck at the very beginning of the script (trying to get the uzi to spawn) and I just cannot progress any further. function hydraGuns() local vehicle = getPedOccupiedVehicle(localPlayer) if(vehicle)then if getElementModel(vehicle) == 520 then local x, y, z = getElementPosition(vehicle) local weapon = createWeapon("uzi", x, y, z) outputChatBox ("Hydra guns are installed") end end end What am I doing wrong?
-
Tested both scripts, thanks again for your replies @DNL291 When I am in a rustler and press the left mouse it works perfectly. however, when I press it for the second time the guns fire and the chatbox launches the "No rustler guns message" @Elmatus Your script works perfectly, it spawns a rocket when I press left mouse and am inside of a rustler. However, the normal rustler guns still fired, so I added the disableFireForRustler script. It now works perfectly fine! For anyone interested in the script, here it is: function disableFireForRustler ( theVehicle, seat ) if ( getElementModel ( theVehicle ) == 476 ) then toggleControl ( "vehicle_secondary_fire", false ) else toggleControl ( "vehicle_secondary_fire", true ) end end addEventHandler ( "onClientPlayerVehicleEnter", getLocalPlayer(), disableFireForRustler ) function shootProjectile() local vehicle = getPedOccupiedVehicle(localPlayer) -- Check if the player is in a vehicle if(vehicle)then --Check if its a rustler if getElementModel(vehicle) == 476 then --Get the current position of the vehicle and fire a rocket (No rotation is passed to createProjectile function because it automaticaly gets the vehicle rotation) local x, y, z = getElementPosition(vehicle) createProjectile(vehicle, 19, x, y, z) end end end bindKey("mouse1", "down", shootProjectile) I want to thank all of you for helping out a beginner in scripting. I feel more confident knowing there is a big community that is willing to help me when I am struggling. Big thanks to everyone who helped me -Noah
-
@DNL291 Thanks for the reply, I tested the script and it almost works. I added an outputChatBox function to see whether or not it worked here's what I found: When I press left mouse button in the rustler it posts both outputchatbox texts in the chat. Here's the small addition I added addEventHandler( "onClientKey", root, function ( button ) if button == "mouse1" and getPedOccupiedVehicle(localPlayer) then if getElementModel( getPedOccupiedVehicle(localPlayer) ) == 476 and isControlEnabled( "vehicle_secondary_fire" ) then toggleControl ( "vehicle_secondary_fire", false ) outputChatBox ("Guns activated") else if not isControlEnabled( "vehicle_secondary_fire" ) then toggleControl ( "vehicle_secondary_fire", true ) outputChatBox ("No rustler guns") end end end end ) I added these outputChatBox functions because later on I want to replace them with createProjectile so I have "custom" guns firing from the rustler.
-
Thanks mate, I saved it and I will try it as soon as I finished the map
-
@CodyJ(L) No idea how to do that. I'll probably start prelighting it once I finished the base. This is just an alpha version for me to test whether I got the scale right and stuff like that.