WolfPire Posted March 18, 2012 Share Posted March 18, 2012 So... there's a problem here, seems like it won't pass the "elseif" s no matter what i do... Kill Rewards (Server) function getWhere( ammo, killer, weapon, bodyPartID ) if (bodyPartID == 9 and exports.exp:getPlayerEXP(source) > 0) then givePlayerMoney(killer, 500) exports.exp:addPlayerEXP(killer,10) exports.exp:addPlayerEXP(source, -10) outputChatBox ( "You've earned 10 exp points!" , killer, 0, 255, 0 ) outputChatBox ( "You've lost 10 exp points!" , source, 255, 0, 0 ) else givePlayerMoney(killer, 500) elseif (bodyPartID == 9 and exports.exp:getPlayerEXP(source) > 0) then givePlayerMoney(killer, 500) exports.exp:addPlayerEXP(killer,10) exports.exp:addPlayerEXP(source, -10) outputChatBox ( "You've earned 10 exp points!" , killer, 0, 255, 0 ) outputChatBox ( "You've lost 10 exp points!" , source, 255, 0, 0 ) else givePlayerMoney(killer, 500) elseif (bodyPartID == 9 and exports.exp:getPlayerEXP(source) > 0) then givePlayerMoney(killer, 300) exports.exp:addPlayerEXP(killer,5) exports.exp:addPlayerEXP(source, -5) outputChatBox ( "You've earned 5 exp points!" , killer, 0, 255, 0 ) outputChatBox ( "You've lost 5 exp points!" , source, 255, 0, 0 ) else givePlayerMoney(killer, 300) elseif (bodyPartID == 9 and exports.exp:getPlayerEXP(source) > 0) then givePlayerMoney(killer, 300) exports.exp:addPlayerEXP(killer,5) exports.exp:addPlayerEXP(source, -5) outputChatBox ( "You've earned 5 exp points!" , killer, 0, 255, 0 ) outputChatBox ( "You've lost 5 exp points!" , source, 255, 0, 0 ) elseif (bodyPartID == 9 and exports.exp:getPlayerEXP(source) > 0) then givePlayerMoney(killer, 300) exports.exp:addPlayerEXP(killer,5) exports.exp:addPlayerEXP(source, -5) outputChatBox ( "You've earned 5 exp points!" , killer, 0, 255, 0 ) outputChatBox ( "You've lost 5 exp points!" , source, 255, 0, 0 ) else givePlayerMoney(killer, 300) elseif (bodyPartID == 9 and exports.exp:getPlayerEXP(source) > 0) then givePlayerMoney(killer, 300) exports.exp:addPlayerEXP(killer,5) exports.exp:addPlayerEXP(source, -5) outputChatBox ( "You've earned 5 exp points!" , killer, 0, 255, 0 ) outputChatBox ( "You've lost 5 exp points!" , source, 255, 0, 0 ) else givePlayerMoney(killer, 300) elseif (bodyPartID == 9 and exports.exp:getPlayerEXP(source) > 0) then givePlayerMoney(killer, 1000) exports.exp:addPlayerEXP(killer,50) exports.exp:addPlayerEXP(source, -50) outputChatBox ( "You've earned 50 exp points!" , killer, 0, 255, 0 ) outputChatBox ( "You've lost 50 exp points!" , source, 255, 0, 0 ) else givePlayerMoney(killer, 1000) end end addEventHandler ( "onPlayerWasted", root, getWhere ) _________ I want them to do this: Link to comment
arezu Posted March 18, 2012 Share Posted March 18, 2012 Its so messy.. but first; why are you using so many elseif with the same conditions? And you should see the problem if you type /debugscript 3 in game while being inlogged as admin and then restart script Link to comment
WolfPire Posted March 18, 2012 Author Share Posted March 18, 2012 Its so messy.. but first; why are you using so many elseif with the same conditions?And you should see the problem if you type /debugscript 3 in game while being inlogged as admin and then restart script Not really messy. "elseif" to get each bodypart and give determined money depending where the player was killed. Link to comment
Castillo Posted March 18, 2012 Share Posted March 18, 2012 You're using the same condition for each 'elseif'. Link to comment
WolfPire Posted March 18, 2012 Author Share Posted March 18, 2012 You're using the same condition for each 'elseif'. I need to, to get all the bodyparts, my problem is the getPlayerEXP. Which doesn't seem to pass. I'm implying that if the player has "0" exp points, the killer will just be given money and the killed player wont loose any exp points. Maybe i'm kinda blind or confused, correct my point if i'm wrong. EDIT: Can someone please put me an epic facepalm please? 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