Drakath Posted December 31, 2013 Share Posted December 31, 2013 Client: function behehehe() player = localPlayer local kills = tonumber(getElementData(player,"Zombie kills")) if kills > 12 then outputChatBox("ok", 0,255,0) elseif not kills > 12 then outputChatBox("lol" ,255,0,0) setElementFrozen ( player, true ) else outputChatBox("wtf", 255,0,0) end end addCommandHandler("omg", behehehe) So if a player has more than 12 kills it outputs "ok". But if he doesn't, nothing happens. Why? Link to comment
toxicsmoke11 Posted December 31, 2013 Share Posted December 31, 2013 on line 6 you wrote 'else if' together,maybe that Link to comment
Drakath Posted December 31, 2013 Author Share Posted December 31, 2013 You have to write it together. Link to comment
Chaos Posted December 31, 2013 Share Posted December 31, 2013 Try that function behehehe() player = localPlayer local kills = tonumber(getElementData(player,"Zombie kills")) if kills > 12 then outputChatBox("ok", 0,255,0) end if not kills > 12 then outputChatBox("lol" ,255,0,0) setElementFrozen ( player, true ) else outputChatBox("wtf", 255,0,0) end end addCommandHandler("omg", behehehe) Link to comment
Chaos Posted December 31, 2013 Share Posted December 31, 2013 function behehehe() player = localPlayer kills = tonumber(getElementData(player,"Zombie kills")) if kills > 12 then outputChatBox("ok", 0,255,0) end if not kills > 12 then outputChatBox("lol" ,255,0,0) setElementFrozen ( player, true ) else outputChatBox("wtf", 255,0,0) end end addCommandHandler("omg", behehehe) Link to comment
Drakath Posted December 31, 2013 Author Share Posted December 31, 2013 Still doesn't work. Link to comment
Chaos Posted December 31, 2013 Share Posted December 31, 2013 function behehehe() player = localPlayer kills = getElementData(player,"Zombie kills") if kills > 12 then outputChatBox("ok", 0,255,0) else outputChatBox("lol" ,255,0,0) setElementFrozen ( player, true) end end addCommandHandler("omg", behehehe) Link to comment
Drakath Posted December 31, 2013 Author Share Posted December 31, 2013 Thanks for trying to help, but I already fixed it. Link to comment
Sasu Posted December 31, 2013 Share Posted December 31, 2013 function behehehe() player = localPlayer local kills = tonumber(getElementData(player,"Zombie kills")) or 0 if kills > 12 then outputChatBox("ok", 0,255,0) elseif kills < 12 then outputChatBox("lol" ,255,0,0) setElementFrozen ( player, true ) else outputChatBox("wtf", 255,0,0) end end addCommandHandler("omg", behehehe) 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