Hello people, I recently made a ranking system but it's kinda messed up it does play sound when player login is it possible to cancel it?
Server
function outputChange(dataName,oldValue)
if getElementType(source) == "player" and dataName == "Army.rank" then
local newValue = getElementData(source,dataName)
outputChatBox("Congratulations your rank now is #FFFFFF'"..tostring(newValue).."'",source, 255, 0, 0, true)
triggerClientEvent(source, "onRankUp", source)
end
end
addEventHandler("onElementDataChange",getRootElement(),outputChange)
Client
local sx, sy = guiGetScreenSize ( )
function onRankUpGreet()
dxDrawRectangle(sx*(707/1024), sy*(425/768), sx*(115/1024), sy*(27/768), tocolor(44, 44, 44, 221), true)
dxDrawText("Rank up+", sx*(716/1024), sy*(429/768), sx*(808/1024), sy*(448/768), tocolor(0, 255, 0, 221), 0.70, "bankgothic", "left", "top", false, false, true, false, false)
end
function onRankUp( killer )
local sound = playSound("sounds/level.mp3")
setSoundVolume(sound, 50)
setSoundMaxDistance( sound, 5000 )
addEventHandler("onClientRender", root, onRankUpGreet)
setTimer(
function ()
removeEventHandler ( "onClientRender", root, onRankUpGreet )
end, 6000, 1)
end
addEvent( "onRankUp", true )
addEventHandler( "onRankUp", getRootElement(), onRankUp )
P.S: My ranking script is working perfectly and no need to post it, It's a hard work though i dont want other get to it, Thanks in advance.