EvoGT Posted February 27, 2013 Share Posted February 27, 2013 Hello Scripters Look here: You see i attached gun to car. is it possible to: to check if there's a vehicle with processLineOfSight and decrease their health and draw a line using dxDrawLine3D. Please help me how to do this. Link to comment
Anderl Posted February 27, 2013 Share Posted February 27, 2013 You said it all.. You already know the functions and what to do, there are examples for each function in the wiki. What do you expect us to tell you now? Link to comment
EvoGT Posted February 27, 2013 Author Share Posted February 27, 2013 You said it all.. You already know the functions and what to do, there are examples for each function in the wiki. What do you expect us to tell you now? I need help in scripting it. i tryed but nothing worked. So, maybe mta community will try to script it. I think that the script will not be long I would be very grateful Link to comment
Anderl Posted February 27, 2013 Share Posted February 27, 2013 Then next time post the code you tried. Link to comment
EvoGT Posted February 27, 2013 Author Share Posted February 27, 2013 I did something like this processLineOfSight ( float startX, float startY, float startZ, float endX, float endY, float endZ, [ bool checkBuildings = true, bool checkVehicles = true, LoL.. I dont know how to start.. Help me to do this script . Link to comment
iPrestege Posted February 27, 2013 Share Posted February 27, 2013 Required Arguments startX: The start x position startY: The start y position startZ: The start z position endX: The end x position endY: The end y position endZ: The end z position Optional Arguments NOTE: When using optional arguments, you must supply all arguments before the one you wish to use. For more information on optional arguments, see Optional Arguments. checkBuildings: Allow the line of sight to be blocked by GTA's internally placed buildings, i.e. the world map. checkVehicles: Allow the line of sight to be blocked by vehicles. checkPlayers: Allow the line of sight to be blocked by players. checkObjects: Allow the line of sight to be blocked by objects. checkDummies: Allow the line of sight to be blocked by GTA's internal dummies. These are not used in the current MTA version so this argument can be set to false. seeThroughStuff: Allow the line of sight to be blocked by translucent game objects, e.g. glass. ignoreSomeObjectsForCamera: Allow the line of sight to pass through objects that have (K) property enabled in "object.dat" data file. (i.e. Most dynamic objects like boxes or barrels) shootThroughStuff: Allow the line of sight to be blocked by things that can be shot through ignoredElement: Allow the line of sight to pass through a certain specified element. This is usually set to the object you are tracing from so it does not interfere with the results. includeWorldModelInformation : Include the results of hitting a world model. Link to comment
Moderators IIYAMA Posted February 27, 2013 Moderators Share Posted February 27, 2013 local pX, pY, pZ = getElementPosition (vehicle) local xR,yR,zR = getElementRotation (vehicle) math.pi () -- or 3.141592653 math.cos () math.sin () Link to comment
EvoGT Posted February 27, 2013 Author Share Posted February 27, 2013 Maybe i can use this function fireandcreate () local weapon = createWeapon("mp5",0,0,0) --Create a Mp5 at the Cordinates 0,0,0 fireWeapon(weapon) --Fires the Weapon end ? Link to comment
EvoGT Posted February 27, 2013 Author Share Posted February 27, 2013 Thanks guys for your post's, but i dont know what you writed : X Link to comment
Moderators IIYAMA Posted February 27, 2013 Moderators Share Posted February 27, 2013 Maybe i can use this function fireandcreate () local weapon = createWeapon("mp5",0,0,0) --Create a Mp5 at the Cordinates 0,0,0 fireWeapon(weapon) --Fires the Weapon end ? local weapon = createWeapon("mp5",0,0,0) --Create a Mp5 at the Cordinates 0,0,0 function fireWeapon () setWeaponState ( weapon,"firing") end Link to comment
Anderl Posted February 27, 2013 Share Posted February 27, 2013 local weapon = createWeapon("mp5",0,0,0) --Create a Mp5 at the Cordinates 0,0,0 function fireWeapon () setWeaponState ( weapon,"firing") end There is fireWeapon for that, it just needs to be called multiple times because it only shots one bullet per call. Link to comment
EvoGT Posted February 27, 2013 Author Share Posted February 27, 2013 local weapon = createWeapon("mp5",0,0,0) --Create a Mp5 at the Cordinates 0,0,0 function fireWeapon () setWeaponState ( weapon,"firing") end There is fireWeapon for that, it just needs to be called multiple times because it only shots one bullet per call. Maybe is it possible to bind it ? Like i press "O" And the weapon shot until i press O ? Link to comment
Anderl Posted February 27, 2013 Share Posted February 27, 2013 You can do that using bindKey, using key state "both". Link to comment
EvoGT Posted February 27, 2013 Author Share Posted February 27, 2013 Okey, if i'l bind it. But what should i do to put that shotting gun on the car ( where is weapon ) Link to comment
Anderl Posted February 27, 2013 Share Posted February 27, 2013 I'm not sure if attachElements function supports weapon elements (most likely not, since it's not in the supported element types list in the wiki's page), however you can try: create a weapon and use attachElements using the element returned by the function createWeapon. Link to comment
EvoGT Posted February 27, 2013 Author Share Posted February 27, 2013 Tottaly mest up.. ok i will try to bind it . heh. local weapon = createWeapon("m4",0,0,0) --Create a Mp5 at the Cordinates 0,0,0 function fireWeapon () setWeaponState ( weapon,"firing") end bindKey ( string mouse1, string both, function handlerFunction, [ var arguments, ... ] ) function fireWeapon ( string moise1, string both, [ var arguments, ... ] ) im soo bad at scripting : X Link to comment
Anderl Posted February 27, 2013 Share Posted February 27, 2013 Well, then learn the language: http://lua.org The wiki wasn't made to be copy+pasted. What you're copying is the function syntax which has COMPLETELY NOTHING to do. Link to comment
EvoGT Posted February 27, 2013 Author Share Posted February 27, 2013 Well, then learn the language: http://lua.orgThe wiki wasn't made to be copy+pasted. What you're copying is the function syntax which has COMPLETELY NOTHING to do. i wont learn it : x my en too bad.. Could you make bind? Link to comment
myonlake Posted February 28, 2013 Share Posted February 28, 2013 Well, then learn the language: http://lua.orgThe wiki wasn't made to be copy+pasted. What you're copying is the function syntax which has COMPLETELY NOTHING to do. i wont learn it : x my en too bad.. Could you make bind? Then don't begin scripting if you can't understand it. And no, we can not make a bind for you as you can't even try properly. Link to comment
50p Posted February 28, 2013 Share Posted February 28, 2013 @EvoGT, We can help you with scripting but we can't create the script for you. You need to learn Lua first and then you can start scripting. If you can't learn then how do you expect us to help you? By creating the ready script for you? This way you will not learn. There are many script out there already which you can learn from. Everyone has to start somewhere. If you'll learn the basics you will learn more quickly how to make your own scripts. Also, check my resources (link in signature), I have created some basic scripts which can help you learn. I'm not sure if attachElements function supports weapon elements (most likely not, since it's not in the supported element types list in the wiki's page), however you can try: create a weapon and use attachElements using the element returned by the function createWeapon. Weapons are supported by attachElements and you can attach weapons to vehicles but you can only manipulate weapons on client-side only. If you change the weapon state for one client then it will only be changed for this client (other clients don't even know that you created a weapon for yourself). When you create a weapon for 1 client then you have to create it for everyone. When you change weapon's state for 1 player, make sure you change it for everyone. If you change it for 1 client only and if another vehicle explodes then it will only explode your that 1 player. Even the other player sitting in that vehicle will be alive and "driving wrecked vehicle" (that's what player who shot will see on their screen). You have to sync weapons yourself. 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