KraZ Posted August 16, 2012 Share Posted August 16, 2012 There are no errors and im not sure what is wrong so I was wondering if someone could help me. addEvent ( "onZombieWasted", true ) function addEXP() local playerAccount = getPlayerAccount ( source ) if ( playerAccount ) and not isGuestAccount ( playerAccount ) then if ( attacker ) and ( attacker ~= source ) then givePlayerMoney(7, source) local experiance = getAccountData ( playerAccount, "levels.exp" ) if ( experiance ) then experiance = experiance + 1 setAccountData(playerAccount, "levels.exp", experiance) triggerClientEvent ( "expDisplay", getRootElement()) end end end end addEventHandler( "onZombieWasted", getRootElement(), addEXP) function LevelUP( source ) local playerAccount = getPlayerAccount ( source ) if ( playerAccount ) and not isGuestAccount ( playerAccount ) then local levels = getAccountData ( playerAccount, "levels.level" ) local experiance = getAccountData ( playerAccount, "levels.exp" ) if ( experiance == 300 ) then levels = levels + 1 outputChatBox ( "Congratulations To" ..getPlayerName(playerAccount)" He Is Now Level:" ..getAccountData ( playerAccount, "levels.level" ), 0,255,0 ) experiance = 0 setAccountData(playerAccount, "levels.level" ) setAccountData(playerAccount, "levels.exp" ) triggerClientEvent ( "lvlUPSound", getRootElement()) end end end Link to comment
Flaker Posted August 16, 2012 Share Posted August 16, 2012 Try this code for Zombie Wasted Event: addEvent ( "onZombieWasted", true ) function addEXP(killer) if (killer and killer ~= source) then local playerAccount = getPlayerAccount ( killer ) if ( playerAccount ) and not isGuestAccount ( playerAccount ) then givePlayerMoney(7, killer) local experiance = getAccountData ( playerAccount, "levels.exp" ) if ( experiance ) then experiance = experiance + 1 setAccountData(playerAccount, "levels.exp", experiance) triggerClientEvent ( killer, "expDisplay", killer ) else setAccountData(playerAccount, "levels.exp", 1) triggerClientEvent ( killer, "expDisplay", killer ) end end end end addEventHandler( "onZombieWasted", getRootElement(), addEXP) P.S. i can't find where u trigger LevelUP function. Link to comment
Xeno Posted August 16, 2012 Share Posted August 16, 2012 exports.scoreboard:addScoreboardColumn('Zombie kills') addEvent("onZombieWasted",true) addEventHandler("onZombieWasted",root, function (killer) givePlayerMoney(killer,100) addPlayerZombieKills(killer) end) function addPlayerZombieKills(killer) local account = getPlayerAccount(killer) if isGuestAccount(account) then return end local zombieKills = getAccountData(account,"Zombie kills") if not zombieKills then setAccountData(account,"Zombie kills",0) end setAccountData(account,"Zombie kills",tonumber(zombieKills)+1) end I used this in my old script, but it works only for the DXscoreboard. 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