Franc[e]sco Posted January 9, 2008 Share Posted January 9, 2008 function onPlayerDeath (ammo, attacker, weapon, bodypart) setTimer(spawnThePlayer, 10000, 1, source) sendClientMsg("You died! 10 seconds till respawn", source, "red") if attacker then setElementData( attacker, "score", getElementData(attacker, "score")+1 ) setElementData( attacker, "killingspree", getElementData(attacker, "killingspree")+1 ) if (bodypart == 9) then sendClientMsgToAll("* " .. getClientName(attacker) .. " just headshotted " .. getClientName(source) .. " !", "green") elseif (bodypart == 4) then sendClientMsgToAll("* " .. getClientName(attacker) .. " just ass shotted " .. getClientName(source) .. " ! Ow, that hurts :(", "green") end if (getElementData(attacker, "killingspree") == 5) then killingSpreeMsg = textCreateTextItem(getClientName(attacker) .. " is dominating!", 0.3, 0.5) textDisplayAddText(killingSpreeDisplay, killingSpreeMsg) textItemSetColor(killingSpreeMsg, 255, 255, 255, 180) setTimer(textDisplayRemoveText, 5000, 1, killingSpreeMsg, killingSpreeDisplay) elseif (getElementData(attacker, "killingspree") == 10) then killingSpreeMsg = textCreateTextItem(getClientName(attacker) .. " is on a killing spree!", 0.3, 0.5) textDisplayAddText(killingSpreeDisplay, killingSpreeMsg) textItemSetColor(killingSpreeMsg, 255, 255, 0, 180) setTimer(textDisplayRemoveText, 5000, 1, killingSpreeMsg, killingSpreeDisplay) sendClientMsg("* You get 5 granades for your 10 kills", attacker) giveWeapon(attacker, 16, 5) elseif (getElementData(attacker, "killingspree") == 15) then killingSpreeMsg = textCreateTextItem(getClientName(attacker) .. " is unstoppable!", 0.3, 0.5) textDisplayAddText(killingSpreeDisplay, killingSpreeMsg) textItemSetColor(killingSpreeMsg, 255, 128, 64, 180) sendClientMsg("* You get 5 more granades for your 15 kills", attacker) giveWeapon(attacker, 16, 5) setTimer(textDisplayRemoveText, 5000, 1, killingSpreeMsg, killingSpreeDisplay) elseif (getElementData(attacker, "killingspree") == 20) then killingSpreeMsg = textCreateTextItem(getClientName(attacker) .. " owned the entire server!", 0.3, 0.5) textDisplayAddText(killingSpreeDisplay, killingSpreeMsg) textItemSetColor(killingSpreeMsg, 200, 0, 0, 180) setTimer(textDisplayRemoveText, 5000, 1, killingSpreeMsg, killingSpreeDisplay) sendClientMsg("* You get 10 more granades for your 20 kills", attacker) giveWeapon(attacker, 16, 10) end if (getElementData(source, "killingspree") > 5) then sendClientMsgToAll("* " .. getClientName(attacker) .. " stopped " .. getClientName(source) .. " from doing " .. getElementData(source, "killingspree")+1 .. " straight kills!", "grey") end if(killingSpreeMsg) then textItemSetScale(killingSpreeMsg, 5.0) end end setElementData( source, "killingspree", 0 ) end addEventHandler("onPlayerWasted", getRootElement (), onPlayerDeath) I just can't understand whatìs whrong with this script... the killing spree textItems are displayed, but when they should disappear (after 5 secs) they don't and they stay there forever.... help? ps: sendClientMsg and sendClientMsgToAll are my own functions and they work Link to comment
Franc[e]sco Posted January 10, 2008 Author Share Posted January 10, 2008 Anyone?.... i can't fix it Link to comment
Shadd00 Posted January 11, 2008 Share Posted January 11, 2008 Prova a creare una funzione a parte per rimuovere il testo ed aziona questa funzione con un timer di 5 secondi. Try to create a separate function to remove the textItem and active this function with a 5 seconds timer. Link to comment
RottWeiller Posted January 11, 2008 Share Posted January 11, 2008 Hi, Where do you initialize the "killingSpreeDisplay"? Do you get any warning messages in debug console? Link to comment
Franc[e]sco Posted January 12, 2008 Author Share Posted January 12, 2008 NVM, i solved removing also the observers from the text display when i remove the textItem 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