Negriukas Posted July 28, 2014 Share Posted July 28, 2014 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. Link to comment
Max+ Posted July 28, 2014 Share Posted July 28, 2014 Try this , ---ClientSide 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 addEvent( "onRankUp", true ) addEventHandler( "onRankUp", function ( ) local sound = playSound("sounds/level.mp3") setSoundVolume(sound, 0.5) setSoundMaxDistance( sound, 5000 ) addEventHandler("onClientRender", root, onRankUpGreet) setTimer( function () removeEventHandler ( "onClientRender", root, onRankUpGreet ) end, 6000, 1) end ) ---ServerSide addEventHandler("onElementDataChange",root, function (ElementData) if ( ElementData == "Army.rank" ) then local newValue = getElementData(source,ElementData) outputChatBox("Congratulations your rank now is #FFFFFF'"..tostring(newValue).."'",source, 255, 0, 0, true) triggerClientEvent(source, "onRankUp", source) end end ) /debugscrip 3 to see if there is any erros , Can you show me how do you set the element data for the killer ? Link to comment
-.Paradox.- Posted July 28, 2014 Share Posted July 28, 2014 Try this , ---ClientSide 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 addEvent( "onRankUp", true ) addEventHandler( "onRankUp", function ( ) local sound = playSound("sounds/level.mp3") setSoundVolume(sound, 0.5) setSoundMaxDistance( sound, 5000 ) addEventHandler("onClientRender", root, onRankUpGreet) setTimer( function () removeEventHandler ( "onClientRender", root, onRankUpGreet ) end, 6000, 1) end ) ---ServerSide addEventHandler("onElementDataChange",root, function (ElementData) if ( ElementData == "Army.rank" ) then local newValue = getElementData(source,ElementData) outputChatBox("Congratulations your rank now is #FFFFFF'"..tostring(newValue).."'",source, 255, 0, 0, true) triggerClientEvent(source, "onRankUp", source) end end ) /debugscrip 3 to see if there is any erros , Can you show me how do you set the element data for the killer ? Where is the second argument here? addEventHandler( "onRankUp", What's the point of removing the element check? That wont change anything... Link to comment
Negriukas Posted July 28, 2014 Author Share Posted July 28, 2014 Try this , ---ClientSide 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 addEvent( "onRankUp", true ) addEventHandler( "onRankUp", function ( ) local sound = playSound("sounds/level.mp3") setSoundVolume(sound, 0.5) setSoundMaxDistance( sound, 5000 ) addEventHandler("onClientRender", root, onRankUpGreet) setTimer( function () removeEventHandler ( "onClientRender", root, onRankUpGreet ) end, 6000, 1) end ) ---ServerSide addEventHandler("onElementDataChange",root, function (ElementData) if ( ElementData == "Army.rank" ) then local newValue = getElementData(source,ElementData) outputChatBox("Congratulations your rank now is #FFFFFF'"..tostring(newValue).."'",source, 255, 0, 0, true) triggerClientEvent(source, "onRankUp", source) end end ) /debugscrip 3 to see if there is any erros , Can you show me how do you set the element data for the killer ? Not working, I fixed the second argument in addEventHandler but still playing the sound and showing the Greet after logging in, Hope someone help, Thanks. Link to comment
TAPL Posted July 28, 2014 Share Posted July 28, 2014 Try this. function outputChange(dataName,oldValue) if getElementType(source) == "player" and dataName == "Army.rank" and oldValue 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) Link to comment
Negriukas Posted July 28, 2014 Author Share Posted July 28, 2014 Try this. function outputChange(dataName,oldValue) if getElementType(source) == "player" and dataName == "Army.rank" and oldValue 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) Thanks dude. 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