Xeno Posted February 2, 2012 Share Posted February 2, 2012 Ok, so I'm setting up ranks for this script, and it checks to see if a player has a certain ammount of kills every kill, if the player has 50 kills, it triggers a server event, but it doesn't seem to work... ( not triggering the server event..) heres the script: function lvlKills(player, killer) local rank = getElementData(player, "Rank") if (player and getElementType(player) == "player") then local kills = tonumber(getElementData(player,"Zombie kills")) if (not kills) then setElementData(player, "Zombie kills", 0) kills = 0 end if (kills == 50) then triggerClientEvent(killer,"triggerLvl",killer) outputChatBox("#FF0000*GAME: #FFFF00You have leveled up to rank "..rank.."!", player, 255, 0, 0, true) elseif (kills == 150) then triggerClientEvent("triggerLvl", getRootElement()) outputChatBox("#FF0000*GAME: #FFFF00You have leveled up to rank "..rank.."!", player, 255, 0, 0, true) elseif (kills == 300) then triggerClientEvent("triggerLvl", getRootElement()) outputChatBox("#FF0000*GAME: #FFFF00You have leveled up to rank "..rank.."!", player, 255, 0, 0, true) elseif (kills == 600) then triggerClientEvent("triggerLvl", getRootElement()) outputChatBox("#FF0000*GAME: #FFFF00You have leveled up to rank "..rank.."!", player, 255, 0, 0, true) elseif (kill == 800) then triggerClientEvent("triggerLvl", getRootElement()) outputChatBox("#FF0000*GAME: #FFFF00You have leveled up to rank "..rank.."!", player, 255, 0, 0, true) elseif (kills == 1200) then triggerClientEvent(killer,"triggerLvl",killer) outputChatBox("#FF0000*GAME: #FFFF00You have leveled up to rank "..rank.."!", player, 255, 0, 0, true) end end end Please help me, Xeno Link to comment
Castillo Posted February 2, 2012 Share Posted February 2, 2012 Mind showing me how are you using the function: "lvlKills"? Link to comment
Xeno Posted February 2, 2012 Author Share Posted February 2, 2012 function lvlingUp() dxDrawText ( "You have leveled up!", 200,screenHeight - 400, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 2, "pricedown" ) dxDrawText ( "You have leveled up!", 200, screenHeight - 402, screenWidth, screenHeight, tocolor ( 255, 0, 0, 255 ), 2, "pricedown" ) end function triggerLvl() addEventHandler("onClientRender",rootElement, lvlingUp) setSoundVolume(sound, 0.5) local sound = playSound("lvl.mp3", false) setTimer(dxDrawReLvl,3000,1) end addEvent("triggerLvl", true) --addEventHandler("onClientResourceStart", getRootElement(), triggerLvl) function dxDrawReLvl() removeEventHandler("onClientRender", rootElement, lvlingUp) end addEventHandler("triggerLvl", getLocalPlayer(), triggerLvl) Link to comment
Castillo Posted February 2, 2012 Share Posted February 2, 2012 You got me wrong, I mean how are you using the function: lvlKills, not how are you triggering the event to the client side. Example: lvlKills(source, source) Link to comment
Xeno Posted February 2, 2012 Author Share Posted February 2, 2012 Oh sorry, addEventHandler("onZombieWasted", getRootElement(), lvlKills) Link to comment
Xeno Posted February 2, 2012 Author Share Posted February 2, 2012 Fixed. Thanks Castillo. 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