TheJMaster06 Posted August 13, 2008 Share Posted August 13, 2008 Can someone plz make me a vhilicle Spawn Script for MTA:DM? Thanks!! Link to comment
churchill Posted August 13, 2008 Share Posted August 13, 2008 this page has all you need to know about spawning vehicles: http://development.mtasa.com/index.php? ... ateVehicle and a list of vehicle ids are here: http://development.mtasa.com/index.php? ... ehicle_IDs But the next question is, how many vehicles are you planning to spawn, and are planning to spawn them in fixed locations, randomly or where the player is when he requests a vehicle? Link to comment
TheJMaster06 Posted August 13, 2008 Author Share Posted August 13, 2008 this page has all you need to know about spawning vehicles:http://development.mtasa.com/index.php? ... ateVehicle and a list of vehicle ids are here: http://development.mtasa.com/index.php? ... ehicle_IDs But the next question is, how many vehicles are you planning to spawn, and are planning to spawn them in fixed locations, randomly or where the player is when he requests a vehicle? IDK. I am a beginner Lua Scripter. That's why I was asking. And what folder do I put the scripts in and what do I call em? Link to comment
churchill Posted August 13, 2008 Share Posted August 13, 2008 Didn't you just read the scripting introduction? This reply might seem a bit long, but it's worth you reading it, as hopefully it'll explain things a bit clearer so that you can understand why you're doing what you're doing, rather than me just give you a one sentence answer that doesn't really make it clear what you're actually doing. When you're writing scripts, you can call them whatever you want, and put them in any folder you want, whether it's the root of your resource or a subfolder. So say, I've got a new resource I'm creating called "myleetrpg", and I've created a folder under the resources folder, and created a meta.xml file in that folder, I'd have something like this: resources/myleetrpg/ -- the resource folder resources/myleetrpg/meta.xml -- the meta file associated with this resource, making sure the info details are correct inside this meta file. now I want to create my first script - let's call it "myfirstscript.lua". Note that it can be whatever you want to call it, but it makes sense to call it something that you can later identify it. So, if you're working on some code for your gamemode that handles vehicle spawning, you might call it "vehiclespawning.lua". Now, as to where you need to put it, you can either put it in the root, alongside the "meta.xml" file (remember in the introductory tutorial it says to do this with your first test script it asks you to create?) or you could put them into a subfolder. Generally you would create a subfolder if you want to separate your clientside scripts from your server side scripts, so that you have: resources/myleetrpg/ -- the resource folder resources/myleetrpg/meta.xml -- the meta file associated with this resource, making sure the info details are correct inside this meta file. resources/myleetrpg/client/CodeThatHandlesSomethingOnTheClientSuchAsGUIBuildingForAVehicleSelectorWindow.lua resource/myleetrpg/server/vehiclespawning.lua -- this handles the server side code that will be run when the vehicle selector window has been used by a player. or if you wanted to you could dump everything in one place like this: resources/myleetrpg/ resources/myleetrpg/meta.xml resources/myleetrpg/CodeThatHandlesSomethingOnTheClientSuchAsGUIBuildingForAVehicleSelectorWindow.lua resources/myleetrpg/vehiclespawning.lua but doing it this way makes it harder to find what you're looking for when you have lots of scripts in there Another way of separating things is to put a _c at the end of your script, such a "vehiclespawning_c.lua" to indicate it's a client side script, or "c_vehiclespawning.lua" if you want to group all your clientside scripts together when viewing the folder. Finally, if you have lots of scripts associated with particular functionality, you might even do something like this: resources/myleetrpg/ resources/myleetrpg/meta.xml resources/myleetrpg/vehiclespawning/vehiclespawning_c.lua resources/myleetrpg/vehiclespawning/vehiclespawning.lua meaning I've put all my vehicle spawning scripts into one place. again, if I had lots of scripts associated with a function, I'd probably add another sub folder to further group things together: resources/myleetrpg/ resources/myleetrpg/meta.xml resources/myleetrpg/vehiclespawning/client/vehiclespawning_c.lua resources/myleetrpg/vehiclespawning/server/vehiclespawning.lua summary: you can name your scripts anything you want, and put them anywhere you want, but it makes sense to keep things that are related together in some way! And now for the important bit: Whatever you call your files and whatever folder structure you choose to keep them in, your meta.xml must contain a reference to the scripts. In your meta.xml file for your resource, you would have something like this, depending on where you've put it and what you're calling it: Link to comment
Gamesnert Posted August 13, 2008 Share Posted August 13, 2008 Can someone plz make me a vhilicle Spawn Script for MTA:DM? Thanks!! Someone can make it, yes. That one, however... Is you. Read the scripting introduction to find out how to make a command to spawn vehicles. Otherwise: Make a .map file with Link to comment
[UVA]Bart Posted August 13, 2008 Share Posted August 13, 2008 simply loop through the "vehicle" node and create them as you come across them thats how i do it and to add more vehicles to it just add a new line to teh xml "402" x="3527.734375" y="-1756.7296142578" z="90.276741027832" rotx="0" roty="0" rotz="1.6366271972656"/> "402" x="3536.3386230469" y="-1756.4110107422" z="90.276741027832" rotx="0" roty="0" rotz="357.89987182617"/> "402" x="3545.1743164063" y="-1754.8531494141" z="90.276741027832" rotx="0" roty="0" rotz="0.40658569335938"/> Link to comment
50p Posted August 13, 2008 Share Posted August 13, 2008 simply loop through the "vehicle" node and create them as you come across them thats how i do it and to add more vehicles to it just add a new line to teh xml "402" x="3527.734375" y="-1756.7296142578" z="90.276741027832" rotx="0" roty="0" rotz="1.6366271972656"/> "402" x="3536.3386230469" y="-1756.4110107422" z="90.276741027832" rotx="0" roty="0" rotz="357.89987182617"/> "402" x="3545.1743164063" y="-1754.8531494141" z="90.276741027832" rotx="0" roty="0" rotz="0.40658569335938"/> You don't have to loop through "vehicle". Such feature is built in MTA. You just create something similar to what you posted, but instead of x, y, z, rotx, rotx, rotz, you use posX, posY, posZ, rotX, rotY, rotZ and change the to . Also, just add the file to meta.xml as . That's all you need to do, server will create the vehicles when resource starts. Link to comment
[UVA]Bart Posted August 13, 2008 Share Posted August 13, 2008 o lol i have a command that makes the xml for me lol Link to comment
TheJMaster06 Posted August 13, 2008 Author Share Posted August 13, 2008 o lol i have a command that makes the xml for me lol Okay what command is that? Link to comment
Gamesnert Posted August 13, 2008 Share Posted August 13, 2008 He scripted it himself I think. He just made a scripting command for it. But I would suggest to do what 50p said. Very simple guide: 1. Create a new file in Notepad 2. Type: 3. Press enter, and type 4. Press enter again, and type 5. Go save the file in the same directory as your other script files. Save it with a name like: "map.map" or "anything.map". Aslong as you do not forget .map! Now you got yourself a map file. Now go to meta.xml (should be in the same folder as your map file) and add: Then, you are done. You have successfully created a vehicle! (well, I hope so...) Also: Try changing posX, posY and posZ. To something like next to your own spawnpoint. Might make it easier since you then don't have to look for your vehicle. If you want to rotate the vehicle by the way, change rotZ! Not X or Y since it'll rotate in directions you most likely don't want to be changed... Link to comment
TheJMaster06 Posted August 13, 2008 Author Share Posted August 13, 2008 Well I Might be doing something wrong because none of my scripts that I have made aren't working Link to comment
TheJMaster06 Posted August 13, 2008 Author Share Posted August 13, 2008 He scripted it himself I think. He just made a scripting command for it.But I would suggest to do what 50p said. Very simple guide: 1. Create a new file in Notepad 2. Type: 3. Press enter, and type 4. Press enter again, and type 5. Go save the file in the same directory as your other script files. Save it with a name like: "map.map" or "anything.map". Aslong as you do not forget .map! Now you got yourself a map file. Now go to meta.xml (should be in the same folder as your map file) and add: Then, you are done. You have successfully created a vehicle! (well, I hope so...) Also: Try changing posX, posY and posZ. To something like next to your own spawnpoint. Might make it easier since you then don't have to look for your vehicle. If you want to rotate the vehicle by the way, change rotZ! Not X or Y since it'll rotate in directions you most likely don't want to be changed... I went to my Meta.xml and Added and it f**ked up my meta file so I had to delete it. Link to comment
Gamesnert Posted August 13, 2008 Share Posted August 13, 2008 Nonono, I said <map src="mapname.map"/> And the quotes should stay how they are! Link to comment
TheJMaster06 Posted August 13, 2008 Author Share Posted August 13, 2008 Nonono, I said <map src="mapname.map"/> And the quotes should stay how they are! Never mind. I fixed it I Just have script error's now. Link to comment
haybail Posted August 14, 2008 Share Posted August 14, 2008 I went to my Meta.xml and Added and it f**ked up my meta file so I had to delete it. lol. Link to comment
TheJMaster06 Posted August 14, 2008 Author Share Posted August 14, 2008 I went to my Meta.xml and Added and it f**ked up my meta file so I had to delete it. lol. I fixed it!! I typed the Wrong lol! Link to comment
churchill Posted August 14, 2008 Share Posted August 14, 2008 (edited) I went to my Meta.xml and Added and it f**ked up my meta file so I had to delete it. lol. I fixed it!! I typed the Wrong lol! good stuff. So now you know how to create script files and add them to your meta file, next step is fixing those script errrors. Assuming you've created an admin user for youself as part of setting up your server, the following will come in very handy: login username password -- to login as your admin user debugscript 3 -- turns on error messages and tells you where the problems are cleardebug -- clears the debug output ready for running your script again. the map file that people are advocating is great when you want to spawn your vehicles in a fixed location when the server starts, but if you want your vehicle to spawn next to a player when they type a command or push a gui button, you'll still need to script it, so you're on the right track. Edited August 14, 2008 by Guest Link to comment
TheJMaster06 Posted August 14, 2008 Author Share Posted August 14, 2008 Okay. So Here is My update on my New Server, When I log on to the server. I am starting off falling into the Same Position as always. When I die, It does not auto re spawn. <- What Scripts do I need to Fix that? I have also Made A Vehicle script. When U type in /create vehicle ID# U can spawn what ever car ID when U want. And I have finally added the /jet pack command in too. So I can fly around in the Jet Pack. All I need to know is How do I script out for Map Spawning, Buildings And Weapons. Thanks for helping me guys. PS. I am still a Beginner at Scripting and NO I have not scripted before. So I am still working with this to get a server going. Pe@ce! Link to comment
Lordy Posted August 14, 2008 Share Posted August 14, 2008 if u add a command handler I think it should be only one word.. like "createvehilce" ont create vehilce or jet pack.. I strongly suggest you search wiki for weapons for example.. You would find a function giveWeapon () (or sth like that). And for weapon pickups, there is createPickup (). Spawning is done by spawnPlayer, anyway take a close look to the scripting introduction tutorial because all basics are written there, even if you don't want to get the same result as there, you get the general picture better. Link to comment
Gamesnert Posted August 14, 2008 Share Posted August 14, 2008 Okay. So Here is My update on my New Server,When I log on to the server. I am starting off falling into the Same Position as always. When I die, It does not auto re spawn. <- What Scripts do I need to Fix that? I have also Made A Vehicle script. When U type in /create vehicle ID# U can spawn what ever car ID when U want. And I have finally added the /jet pack command in too. So I can fly around in the Jet Pack. All I need to know is How do I script out for Map Spawning, Buildings And Weapons. Thanks for helping me guys. PS. I am still a Beginner at Scripting and NO I have not scripted before. So I am still working with this to get a server going. Pe@ce! Ok: 1. To fix falling in the beginning, set posZ a little higher. 2. There is event "onPlayerWasted". Just like you handled "onPlayerJoin" you should handle wasted, only remove some join thingies and add some death thingies. 3. I would suggest to also make it create it from names. Command for that is HERE. 4. Nice, jetpacks!! 5. I would suggest looking for a map editor in the RESOURCES LIST. (examples: Medit, alternate map editor of offedit) 6. Then we understand why you asked it. I think I'm going to make a big tutorial for Lua, since we would like to avoid questions like these. But if you don't know how something works or whatever: look for yourself first, and then ask. Link to comment
TheJMaster06 Posted August 15, 2008 Author Share Posted August 15, 2008 Okay. So Here is My update on my New Server,When I log on to the server. I am starting off falling into the Same Position as always. When I die, It does not auto re spawn. <- What Scripts do I need to Fix that? I have also Made A Vehicle script. When U type in /create vehicle ID# U can spawn what ever car ID when U want. And I have finally added the /jet pack command in too. So I can fly around in the Jet Pack. All I need to know is How do I script out for Map Spawning, Buildings And Weapons. Thanks for helping me guys. PS. I am still a Beginner at Scripting and NO I have not scripted before. So I am still working with this to get a server going. Pe@ce! Ok: 1. To fix falling in the beginning, set posZ a little higher. 2. There is event "onPlayerWasted". Just like you handled "onPlayerJoin" you should handle wasted, only remove some join thingies and add some death thingies. 3. I would suggest to also make it create it from names. Command for that is HERE. 4. Nice, jetpacks!! 5. I would suggest looking for a map editor in the RESOURCES LIST. (examples: Medit, alternate map editor of offedit) 6. Then we understand why you asked it. I think I'm going to make a big tutorial for Lua, since we would like to avoid questions like these. But if you don't know how something works or whatever: look for yourself first, and then ask. But Where do I put the map editor at? Link to comment
Gamesnert Posted August 15, 2008 Share Posted August 15, 2008 Okay. So Here is My update on my New Server,When I log on to the server. I am starting off falling into the Same Position as always. When I die, It does not auto re spawn. <- What Scripts do I need to Fix that? I have also Made A Vehicle script. When U type in /create vehicle ID# U can spawn what ever car ID when U want. And I have finally added the /jet pack command in too. So I can fly around in the Jet Pack. All I need to know is How do I script out for Map Spawning, Buildings And Weapons. Thanks for helping me guys. PS. I am still a Beginner at Scripting and NO I have not scripted before. So I am still working with this to get a server going. Pe@ce! Ok: 1. To fix falling in the beginning, set posZ a little higher. 2. There is event "onPlayerWasted". Just like you handled "onPlayerJoin" you should handle wasted, only remove some join thingies and add some death thingies. 3. I would suggest to also make it create it from names. Command for that is HERE. 4. Nice, jetpacks!! 5. I would suggest looking for a map editor in the RESOURCES LIST. (examples: Medit, alternate map editor of offedit) 6. Then we understand why you asked it. I think I'm going to make a big tutorial for Lua, since we would like to avoid questions like these. But if you don't know how something works or whatever: look for yourself first, and then ask. But Where do I put the map editor at? Between your other resources. Then, you can do "start [resourcename]" (without "" and []) Link to comment
TheJMaster06 Posted August 15, 2008 Author Share Posted August 15, 2008 I did that I don't know how to get offedit to work in the game. I click Map Editor Preview and It say's "Map Editor Recourse Not Installed." Link to comment
Gamesnert Posted August 15, 2008 Share Posted August 15, 2008 No, you should go to your own server and start the resource. That button is for the official map editor, which isn't available yet. Link to comment
TheJMaster06 Posted August 17, 2008 Author Share Posted August 17, 2008 No, you should go to your own server and start the resource. That button is for the official map editor, which isn't available yet. Well I am signed in to my own server and every time I try 2 use the off edit codes. It wont work. So IDK how I can get that 2 work. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now