Xwad Posted March 17, 2015 Share Posted March 17, 2015 Hi. Please help I need a script for my server that makes possible to change the explosion demage on the s.w.a.t. vehicle. I mean if I shoot the s.w.a.t. vehicle with an rpg then it will only demage 500hp becaouse I dont like that the vehicle is blowing up after 1 shoot. Thanks. Link to comment
Tekken Posted March 17, 2015 Share Posted March 17, 2015 onClientVehicleDemage cancelEvent() setElementHealth Link to comment
Tekken Posted March 17, 2015 Share Posted March 17, 2015 But i am not sure if will work beacause when you shoot with RPG explode instantly Link to comment
Xwad Posted March 17, 2015 Author Share Posted March 17, 2015 Is it correct? And is it server side? local weapons = { [36] = true, -- Heat-Seeking RPG [35] = true, -- Rocket Launcher } function ChangeDemage(attacker, weapon, loss, x, y, z, tyre) if (weapons[weapon] and getElementModel(source) == 601 then if (getElementHealth(source) < 1000) then setElementHealth(source,getElementHealth(source) - 500) setVehicleDamageProof(source, false) end end addEventHandler("onClientVehicleDemage",getRootElement(),ChangeDemage) Link to comment
novo Posted March 17, 2015 Share Posted March 17, 2015 onClientVehicleDamage is client-side only, would be onVehicleDamage server-side. Actually, you should do it client-side as you might want to utilize all the arguments it offers. Link to comment
Xwad Posted March 17, 2015 Author Share Posted March 17, 2015 now good? local weapons = { [36] = true, -- Heat-Seeking RPG [35] = true, -- Rocket Launcher } function ChangeDemage(attacker, weapon, loss, x, y, z, tyre) if (weapons[weapon] and getElementModel(source) == 601 then if (getElementHealth(source) < 1000) then setElementHealth(source,getElementHealth(source) - 500) setVehicleDamageProof(source, false) end end addEventHandler("onVehicleDemage",getRootElement(),ChangeDemage) Link to comment
Xwad Posted March 17, 2015 Author Share Posted March 17, 2015 ohh client side sry. Can you makE me an example with client side? Link to comment
HUNGRY:3 Posted March 20, 2015 Share Posted March 20, 2015 (edited) EDIT: just a mistake Edited March 20, 2015 by Guest Link to comment
xeon17 Posted March 20, 2015 Share Posted March 20, 2015 Replace onVehicleDemage with onVehicleDamage and see if it works. Link to comment
HUNGRY:3 Posted March 20, 2015 Share Posted March 20, 2015 local weaponsToDamageSwat = { [36] = true, [35] = true, } function handleSwatDamage(attacker, weapon, loss, x, y, z, tyre) if (weapon and getElementModel(source) == 601 and loss > 0) then if (weaponsToDamageSwat[weapon]) then setElementHealth(source,getElementHealth(source) - 500) setVehicleDamageProof(source, false) end end end end addEventHandler("onClientVehicleDamage", root, handleSwatDamage) Link to comment
Tekken Posted March 20, 2015 Share Posted March 20, 2015 local weaponsToDamageSwat = { [36] = true, [35] = true, } function handleSwatDamage(attacker, weapon, loss, x, y, z, tyre) if (weapon and getElementModel(source) == 601 and loss > 0) then if (weaponsToDamageSwat[weapon]) then setElementHealth(source,getElementHealth(source) - 500) setVehicleDamageProof(source, false) end end end end addEventHandler("onClientVehicleDamage", root, handleSwatDamage) Wath is the problem ? Link to comment
HUNGRY:3 Posted March 21, 2015 Share Posted March 21, 2015 What does debugscript say? Link to comment
Enargy, Posted March 21, 2015 Share Posted March 21, 2015 Here: local weapons = { [1] = true,[22] = true,[31] = true,[42] = true,[15] = true, [2] = true,[23] = true,[32] = true,[43] = true,[16] = true, [3] = true,[24] = true,[33] = true,[44] = true,[17] = true, [4] = true,[25] = true,[34] = true,[45] = true,[18] = true, [5] = true,[26] = true,[37] = true,[46] = true, [6] = true,[27] = true,[38] = true,[10] = true, [7] = true,[28] = true,[39] = true,[11] = true, [8] = true,[29] = true,[40] = true,[12] = true, [9] = true,[30] = true,[41] = true,[14] = true, } function damage(attacker, weapon, loss, x, y, z, tyre) if weapon and not weapons[weapon] then if getElementModel(source) == 601 then cancelEvent() setElementHealth(source,getElementHealth(source) - 100) end end end addEventHandler("onClientVehicleDamage", root, damage) Link to comment
Mr.unpredictable. Posted March 22, 2015 Share Posted March 22, 2015 Use id 51 ----- It's explosion id Eg: This will make all vehicle lose 300hp with explosive weapons like rocket laucher,rpg..., It won't explode the vehicle. function noob(attacker, weapon, loss, x, y, z, tyre) if (weapon == 51 and getElementType(source) == "vehicle") then setElementHealth(source,getElementHealth(source) - 300) cancelEvent() end end addEventHandler("onClientVehicleDamage", root, noob) You can find the actual weapon id for a weapon using this outputDebugString("Test: weaponid: " .. tostring(weapon)) Link to comment
Xwad Posted March 22, 2015 Author Share Posted March 22, 2015 its buggy its dosent blow up pls help Link to comment
Mr.unpredictable. Posted March 22, 2015 Share Posted March 22, 2015 its buggy its dosent blow up pls help Can you explain what are you trying to do? My code won't explod the vehicle but it will do 30% damage the vehicle Link to comment
Xwad Posted March 22, 2015 Author Share Posted March 22, 2015 And is it not possible to make a trigger server event for blow under 100 hp? Link to comment
Mr.unpredictable. Posted March 22, 2015 Share Posted March 22, 2015 And is it not possible to make a trigger server event for blow under 100 hp? Just add my script client side and it will work fine Link to comment
Xwad Posted March 22, 2015 Author Share Posted March 22, 2015 i convert the script that only swat vehicle will blow after 3 shoot but it dosent work pls help!! function noob(attacker, weapon, loss, x, y, z, tyre) if (weapon == 51 and getElementModel(source) == 601 then setElementHealth(source,getElementHealth(source) - 255) cancelEvent() end end addEventHandler("onClientVehicleDamage", root, noob) Link to comment
Enargy, Posted March 23, 2015 Share Posted March 23, 2015 line #3 -- You forgot close parenthesis ')' if (weapon == 51 and getElementModel(source) == 601) then Link to comment
Xwad Posted March 23, 2015 Author Share Posted March 23, 2015 Cool its working now thanks man:D 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