Jump to content

Help add scorebord colum


E-mail

Recommended Posts

Hi all i need to add scorebord cloun [Exp]

and every exp update play sound levelup.mp3

1.function rewardOnWasted ( killer ) 
2.local exp = getElementData(killer,"exp") 
3.if exp then 
4.setElementData(killer,"exp",tonumber(getElementData(killer,"exp"))+5) 
5.outputChatBox("Experience gained +5! total ".. tonumber(exp)+5,killer,0,255,0) 
6.else 
7.setElementData(killer,"exp",5) 
8.   end 
9.end 
10.addEvent("onPlayerWasted",true) 
11.addEventHandler ( "onPlayerWasted", getRootElement(), rewardOnWasted ) 

Link to comment

client:

addEvent ( "playSound" , true ) 
addEventHandler ( "playSound" , root , 
function() 
playSound ( "levelup.mp3" , false ) 
end) 

server:

function rewardOnWasted ( killer ) 
local exp = getElementData(killer,"exp") 
if exp then 
setElementData(killer,"exp",tonumber(getElementData(killer,"exp"))+5) 
outputChatBox("Experience gained +5! total ".. tonumber(exp)+5,killer,0,255,0) 
triggerClientEvent ( killer , "playSound" , killer ) 
else 
setElementData(killer,"exp",5) 
triggerClientEvent ( killer , "playSound" , killer ) 
   end 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), rewardOnWasted ) 

Can't you try something yourself first?

And why are you adding onPlayerWasted.

It exists already.

Link to comment

Like This ?

function rewardOnWasted ( killer ) 
local exp = getElementData(killer,"exp") 
if exp then 
setElementData(killer,"exp",tonumber(getElementData(killer,"exp"))+3) 
outputChatBox("Experience gained +3! total ".. tonumber(exp)+5,killer,255,255,0) 
triggerClientEvent ( killer , "playSound" , killer ) 
else 
setElementData(killer,"exp",3) 
triggerClientEvent ( killer , "playSound" , killer ) 
     exports.scoreboard:addScoreboardColumn("exp") 
   end 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), rewardOnWasted ) 

:mrgreen:

Link to comment

JR10 Sorry I made ​​you tire me

see

function rewardOnWasted ( killer ) 
local exp = getElementData(killer,"exp") 
if exp then 
setElementData(killer,"exp",tonumber(getElementData(killer,"exp"))+5) 
outputChatBox("Experience gained +5! total ".. tonumber(exp)+5,killer,255,255,0) 
triggerClientEvent ( killer , "playSound" , killer ) 
else 
setElementData(killer,"exp",5) 
triggerClientEvent ( killer , "playSound" , killer ) 
     exports.scoreboard:addScoreboardColumn("exp") 
   end 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), rewardOnWasted ) 

:mrgreen:

By the way you and soldSnake14 are the Best best assistants in in section

Link to comment
function rewardOnWasted ( killer ) 
local exp = getElementData(killer,"exp") 
if exp then 
setElementData(killer,"exp",tonumber(getElementData(killer,"exp"))+5) 
outputChatBox("Experience gained +5! total ".. tonumber(exp)+5,killer,255,255,0) 
triggerClientEvent ( killer , "playSound" , killer ) 
else 
setElementData(killer,"exp",5) 
triggerClientEvent ( killer , "playSound" , killer ) 
   end 
end 
addEventHandler ( "onPlayerWasted", getRootElement(), rewardOnWasted ) 
  
addEventHandler("onResourceStart" , resourceRoot , 
function() 
 exports.scoreboard:addScoreboardColumn("exp") 
end) 

I told you to add it on resource start.

Link to comment

addEventHandler("onResourceStart",resourceRoot, function ()

exports.scoreboard:addScoreboardColumn("exp")

end)

function rewardOnWasted ( killer )

local exp = getElementData(killer,"exp")

if exp then

setElementData(killer,"exp",tonumber(getElementData(killer,"exp"))+5)

outputChatBox("Experience gained +5! total ".. tonumber(exp)+5,killer,255,255,0)

triggerClientEvent ( killer , "playSound" , killer )

else

setElementData(killer,"exp",5)

triggerClientEvent ( killer , "playSound" , killer )

end

end

addEventHandler ( "onPlayerWasted", getRootElement(), rewardOnWasted )

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...