xXMADEXx Posted February 18, 2013 Share Posted February 18, 2013 (edited) Hey guys, i made this basic medic script, but for some reason it will not take money from the source, or give money to the attacker... Any advice? addEventHandler('onClientPlayerDamage',root, function (attacker,weapon) if (getElementData(attacker,"Job")=="Medic") then if (weapon == 14) then if (getElementHealth(source) < 100) then takePlayerMoney(source,200-getElementHealth(source)) givePlayerMoney(attacker,200-getElementHealth(source)) triggerEvent("message:addMessage",attacker,"Medic: You have healed "..getPlayerName(source)) setElementHealth(source,getElementHealth(source) + 20) else triggerEvent("message:addMessage",attacker,"Medic: "..getPlayerName(source).." is not injured.") end end end end ) Edited February 18, 2013 by Guest Link to comment
50p Posted February 18, 2013 Share Posted February 18, 2013 Client-side script to give/take money of remote players? Sounds silly to me. Do it server-side. Link to comment
xXMADEXx Posted February 18, 2013 Author Share Posted February 18, 2013 Client-side script to give/take money of remote players? Sounds silly to me. Do it server-side. hum.. Ill try on server side Link to comment
xXMADEXx Posted February 18, 2013 Author Share Posted February 18, 2013 I ended up with this code, but no luck addEventHandler("onPlayerDamage ",root, function (attacker,weapon) if (getElementData(attacker,"Job")=="Medic") then if (weapon==14) then if (getElementHealth(source) < 100) then givePlayerMoney(attacker,350 - getElementHealth(source)) takePlayerMoney(source,350 - getElementHealth(source)) setElementHealth(source,getElementHealth(source) + 20) triggerClientEvent(attacker,'message:addMessage',attacker,'Medic: You healed '..getPlayerName(source)) triggerClientEvent(source,'message:addMessage',source,"Medic: "..getPlayerName(attacker).." has healed you.") else triggerClientEvent(attacker,"message:addMessage",attacker,"Medic: "..getPlayerName(source).." is not injured.") end end end end ) Link to comment
Cadu12 Posted February 18, 2013 Share Posted February 18, 2013 addEventHandler("onPlayerDamage ",root, ...) You have one space in event. 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