Negriukas Posted August 21, 2014 Share Posted August 21, 2014 Hello, Is it possible to ram players with cars? I mean like when i damage another player he instantly die, If it's possible please tell me events and function that would be useful to make that. Thank you Link to comment
DiSaMe Posted August 21, 2014 Share Posted August 21, 2014 "onPlayerDamage" or "onClientPlayerDamage" killPed Link to comment
Negriukas Posted August 21, 2014 Author Share Posted August 21, 2014 "onPlayerDamage" or "onClientPlayerDamage" killPed Thanks again! Link to comment
Negriukas Posted August 21, 2014 Author Share Posted August 21, 2014 I tried this but it didnt work, Debug shows nothing.. server function onPlayerRammed(target) if target and source then killPed(target, source, 49, 9) end end addEvent("onPlayerRammed",true) addEventHandler ( "onPlayerRammed", getRootElement (), onPlayerRammed) function onPedRammed(victim) if victim and source then killPed(victim, source, 49, 9) end end addEvent("onPedRammed",true) addEventHandler ( "onPedRammed", getRootElement (), onPedRammed) client addEvent("onClientPedRammed") addEvent("onClientPlayerRammed") function checkForRamming(killer, weapon, bodypart, loss) if wasEventCancelled() then return end if getVehicleOccupant(killer, 0) and getElementType(getVehicleOccupant(killer, 0)) == "player" and getVehicleOccupant(killer, 0) ~= localPlayer then return end if not getVehicleOccupant(killer, 0) and source ~= localPlayer then return end if getElementHealth(source) - loss <= 0 then return end if loss > 7 then setElementHealth(source, 0) if getElementType(source) == "player" then triggerServerEvent("onPlayerRammed", source, killer, weapon, bodypart, loss) else triggerServerEvent("onPedRammed", source, killer, weapon, bodypart, loss) end end end addEventHandler("onClientPedRammed", root, checkForRamming) addEventHandler("onClientPlayerRammed", root, checkForRamming) function onClientPedRammed(killer, weapon, bodypart, loss) if not getElementType(source) == "ped" then return end if weapon == 49 and getElementType(killer) == "vehicle" then triggerEvent("onClientPedRammed", source, killer, weapon, bodypart, loss) end end addEventHandler ("onClientPedDamage", root, onClientPedRammed) function onClientPlayerRammed(killer, weapon, bodypart, loss) if not getElementType(source) == "player" then return end if weapon == 49 and getElementType(killer) == "vehicle" then triggerEvent("onClientPlayerRammed", source, killer, weapon, bodypart, loss) end end addEventHandler ("onClientPlayerDamage", root, onClientPlayerRammed) 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