PashaBiceps Posted March 26, 2019 Share Posted March 26, 2019 Hi guys, i have a problem on PlayerDamage. So, almost everything it's fine but my problem is, i want that when i hit someone give me the messages but just give me the messages when somebody hits me. What i can do here? Thanks in advance ! addEventHandler( "onPlayerDamage", root, function (targetElem) if (targetElem and targetElem:getType("player") and source:getWeapon() == 23) then if (source:getData("Venda:Police.Job")) then if (targetElem:getWantedLevel() == 0) then return addNotification(source, "Essa pessoa não está com nível de procurado!", "error"); elseif (not Boxs["Markers"]["Create"]["Vehicle"][source]) then return addNotification(source, "Nenhuma viatura encontrada para levar o sujeito!", "error"); end if (targetElem:getHealth() >= 31) then setElementVisibleTo(Boxs["Markers"]["Create"]["Jail"], source, true); targetElem:setAnimation("ped","CAR_dead_LHS"); targetElem:attach(Boxs["Markers"]["Create"]["Vehicle"][source], 0.2, -1.5, 0, 0, 0, 90); addNotification(targetElem, "Tu acabas-te de ser algemado e preso, espera ser encaminhado para a cadeia.", "info"); addNotification(source, "Tu prendes-te uma pessoa! Leva-a até ao departamento (Sirenes Azuis)", "info"); end end end end ) Link to comment
Oussema Posted March 26, 2019 Share Posted March 26, 2019 onPlayerDamage Source The source of this event is the player who was damaged. addEventHandler( "onPlayerDamage", root, function (attacker) if (attacker and attacker:getType("player") and attacker:getWeapon() == 23) then if (attacker:getData("Venda:Police.Job")) then if (source:getWantedLevel() == 0) then return addNotification(attacker, "Essa pessoa não está com nível de procurado!", "error"); elseif (not Boxs["Markers"]["Create"]["Vehicle"][attacker]) then return addNotification(attacker, "Nenhuma viatura encontrada para levar o sujeito!", "error"); end if (attacker:getHealth() >= 31) then setElementVisibleTo(Boxs["Markers"]["Create"]["Jail"], attacker, true); attacker:setAnimation("ped","CAR_dead_LHS"); attacker:attach(Boxs["Markers"]["Create"]["Vehicle"][attacker], 0.2, -1.5, 0, 0, 0, 90); addNotification(source, "Tu acabas-te de ser algemado e preso, espera ser encaminhado para a cadeia.", "info"); addNotification(attacker, "Tu prendes-te uma pessoa! Leva-a até ao departamento (Sirenes Azuis)", "info"); end end end end ) 1 Link to comment
PashaBiceps Posted March 26, 2019 Author Share Posted March 26, 2019 22 hours ago, Oussema said: onPlayerDamage Source The source of this event is the player who was damaged. addEventHandler( "onPlayerDamage", root, function (attacker) if (attacker and attacker:getType("player") and attacker:getWeapon() == 23) then if (attacker:getData("Venda:Police.Job")) then if (source:getWantedLevel() == 0) then return addNotification(attacker, "Essa pessoa não está com nível de procurado!", "error"); elseif (not Boxs["Markers"]["Create"]["Vehicle"][attacker]) then return addNotification(attacker, "Nenhuma viatura encontrada para levar o sujeito!", "error"); end if (attacker:getHealth() >= 31) then setElementVisibleTo(Boxs["Markers"]["Create"]["Jail"], attacker, true); attacker:setAnimation("ped","CAR_dead_LHS"); attacker:attach(Boxs["Markers"]["Create"]["Vehicle"][attacker], 0.2, -1.5, 0, 0, 0, 90); addNotification(source, "Tu acabas-te de ser algemado e preso, espera ser encaminhado para a cadeia.", "info"); addNotification(attacker, "Tu prendes-te uma pessoa! Leva-a até ao departamento (Sirenes Azuis)", "info"); end end end end ) Thanks 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