Xwad Posted December 29, 2014 Posted December 29, 2014 Hi is there any script or rescource that makes possible to kill rhino with rpg? Becaouse i cant kill the rhino with RPG
xeon17 Posted December 29, 2014 Posted December 29, 2014 As i know there isn't a script like this on the community, to create a script like this is pretty easy. Event; onClientVehicleDamage Functions: getElementModel cancelEvent() getElementHealth getElementPosition createExplosion When a player damage ,check the model of the vehicle,if the model is a rhino then cancel the event and create your damage system for the rhino,use getElementHealth to get his health , and use setElementHealth to make him health lower. getElementPosition and createExplosion to make the rhino explode.
Xwad Posted December 29, 2014 Author Posted December 29, 2014 so need i create a meta and a lua file and write this in the lua?
xeon17 Posted December 29, 2014 Posted December 29, 2014 No, you'll need to use this functions to create what you want. If you get problems,post what you tried and i'll help you.
Dealman Posted December 29, 2014 Posted December 29, 2014 Are you sure the Rhino takes damage by the RPG? Otherwise, I assume you'll have to check whenever there is an explosion - and who the creator was. If there's a Rhino within a distance of X, either damage it or blow it up.
Catalyst Posted December 29, 2014 Posted December 29, 2014 Rhinos only take damage from ramming and flames afaik - you'd have to write your own damage-system
manawydan Posted December 29, 2014 Posted December 29, 2014 you can see the example in wiki: https://wiki.multitheftauto.com/wiki/On ... icleDamage
Xwad Posted December 29, 2014 Author Posted December 29, 2014 this? -- Only let these weapons damage a Rhino local weaponsToDamageRhino = { [38] = true, -- minigun [33] = true, -- country rifle [34] = true, -- sniper rifle [30] = true, -- AK-47 [31] = true, -- M4 } function handleRhinoDamage(attacker, weapon, loss, x, y, z, tyre) if (weapon and getElementModel(source) == 432 and loss > 0) then if (weaponsToDamageRhino[weapon]) then setElementHealth(source, getElementHealth(source) - loss) end end end addEventHandler("onClientVehicleDamage", root, handleRhinoDamage)
ViRuZGamiing Posted December 29, 2014 Posted December 29, 2014 Yes he does, to give you more inside in the code i'm going to explain it with the comments "-- text". local weaponsToDamageRhino = { [35] = true, -- basis RPG [36] = true, -- Heatseaking RPG -- You can add different weapons too apart from RPG, if not then a table isn't necessarily needed. -- The [number] is the weapon ID, true means it's valid, every other number returns false. } function handleRhinoDamage(attacker, weapon, loss, x, y, z, tyre) if (weapon and getElementModel(source) == 432 and loss > 0) then -- if the weapon exists and the vehicle being shot is a Rhino and -- the damage dealt isn't 0 but any number higher then do the following. if (weaponsToDamageRhino[weapon]) then -- if the weapon is one of the valid ID's above (35 'true' and 36 'true') then do the following. setElementHealth(source, getElementHealth(source) - loss) -- set the health (life points) of the Rhino (source is the vehicle being shot) -- too the current health minus the loss. end end end addEventHandler("onClientVehicleDamage", root, handleRhinoDamage)
Einheit-101 Posted December 29, 2014 Posted December 29, 2014 Is this tested? AFAIK onClientVehicleDamage does not trigger for explosions @ Rhino, only for ramming, fire and bullets (but bullets do not make real damage, they just trigger the event)
ViRuZGamiing Posted December 29, 2014 Posted December 29, 2014 Not tested Just showed him What the script does.
Xwad Posted December 29, 2014 Author Posted December 29, 2014 what??xdSo need i write in lua this? local weaponsToDamageRhino = { [35] = true, -- basis RPG [36] = true, -- Heatseaking RPG -- You can add different weapons too apart from RPG, if not then a table isn't necessarily needed. -- The [number] is the weapon ID, true means it's valid, every other number returns false. } function handleRhinoDamage(attacker, weapon, loss, x, y, z, tyre) if (weapon and getElementModel(source) == 432 and loss > 0) then -- if the weapon exists and the vehicle being shot is a Rhino and -- the damage dealt isn't 0 but any number higher then do the following. if (weaponsToDamageRhino[weapon]) then -- if the weapon is one of the valid ID's above (35 'true' and 36 'true') then do the following. setElementHealth(source, getElementHealth(source) - loss) -- set the health (life points) of the Rhino (source is the vehicle being shot) -- too the current health minus the loss. end end end addEventHandler("onClientVehicleDamage", root, handleRhinoDamage)
xeon17 Posted December 30, 2014 Posted December 30, 2014 I guess the script type isn't defined in meta or it's server side but should be client side.
Xwad Posted December 30, 2014 Author Posted December 30, 2014 I create a folder and put 2 files meta.xml and tankkill.lua I wrote in meta.xml the following tankkill.lua local weaponsToDamageRhino = { [35] = true, -- basis RPG [36] = true, -- Heatseaking RPG -- You can add different weapons too apart from RPG, if not then a table isn't necessarily needed. -- The [number] is the weapon ID, true means it's valid, every other number returns false. } function handleRhinoDamage(attacker, weapon, loss, x, y, z, tyre) if (weapon and getElementModel(source) == 432 and loss > 0) then -- if the weapon exists and the vehicle being shot is a Rhino and -- the damage dealt isn't 0 but any number higher then do the following. if (weaponsToDamageRhino[weapon]) then -- if the weapon is one of the valid ID's above (35 'true' and 36 'true') then do the following. setElementHealth(source, getElementHealth(source) - loss) -- set the health (life points) of the Rhino (source is the vehicle being shot) -- too the current health minus the loss. end end end addEventHandler("onClientVehicleDamage", root, handleRhinoDamage)
xeon17 Posted December 30, 2014 Posted December 30, 2014 Please read the following link , it's time for you to learn about scripting. Read my last post also. https://wiki.multitheftauto.com/wiki/Meta.xml
Xwad Posted December 30, 2014 Author Posted December 30, 2014 i have read it but i dont know that what have i do wrong
xeon17 Posted December 30, 2014 Posted December 30, 2014 I guess the script type isn't defined in meta or it's server side but should be client side.
Xwad Posted December 30, 2014 Author Posted December 30, 2014 [2014-12-30 15:11:20] ERROR: Couldn't parse meta file for resource 'tankkill' [2014-12-30 15:11:20] Loading of resource 'tankkill' failed
MTA Team botder Posted December 30, 2014 MTA Team Posted December 30, 2014 <author="Xwad" type="script"/> Missing a node name ==> <info author="Xwad" type="script"/>
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