-ffs-AbodyRulez Posted August 18, 2013 Share Posted August 18, 2013 function HunterInfo(source, hunters, person) if person == nil and getAccountData(getPlayerAccount(source),"hunter.counts") == false then outputChatBox("#FFFFFFYou did not reach the Hunter yet.", source, 255,255,255,true) elseif person == nil and getAccountData(getPlayerAccount(source),"hunter.counts") == 1 then outputChatBox("#FFFFFFYou have reached the Hunter#FF0000 "..getAccountData(getPlayerAccount(source),"hunter.counts").." #FFFFFFtime.",source,255,255,255,true) elseif person == nil and getAccountData(getPlayerAccount(source),"hunter.counts") > 1 then outputChatBox("#FFFFFFYou have reached the Hunter#FF0000 "..getAccountData(getPlayerAccount(source),"hunter.counts").." #FFFFFFtimes.",source,255,255,255,true) elseif getAccountData(getPlayerAccount(getPlayerFromName(person)),"hunter.counts") == false then outputChatBox(getPlayerName(getPlayerFromName(person)).." #FFFFFFdid not reach the Hunter yet.", source, 255, 255, 255,true) elseif getAccountData(getPlayerAccount(getPlayerFromName(person)),"hunter.counts") == 1 then outputChatBox(getPlayerName(getPlayerFromName(person)).." #FFFFFFhas reached the Hunter #FF0000"..getAccountData(getPlayerAccount(getPlayerFromName(person)),"hunter.counts").." #FFFFFFtime.", source, 255, 255, 255,true) elseif getAccountData(getPlayerAccount(getPlayerFromName(person)),"hunter.counts") > 1 then outputChatBox(getPlayerName(getPlayerFromName(person)).." #FFFFFFhas reached the Hunter #FF0000"..getAccountData(getPlayerAccount(getPlayerFromName(person)),"hunter.counts").." #FFFFFFtimes.", source, 255, 255, 255,true) else outputChatBox("Sytanx: /hunters [Player]", source, 255, 0, 0,false) end end addCommandHandler("hunters", HunterInfo) When the hunter.counts is 0 it should display that player didn't reach hunter yet, and when player tries /hunter [person] it should show the same if they don't have hunter. Its not working Line 30 = line 9 btw Link to comment
bandi94 Posted August 18, 2013 Share Posted August 18, 2013 "getPlayerFromName(person)" - is using direct comparation between all player's and the gived name. So when you type in the name , you need to type the color cod's to. If you name is #00ff00Me , and you type in Me , it will not find you bk you don't entered the color code. Link to comment
-ffs-AbodyRulez Posted August 18, 2013 Author Share Posted August 18, 2013 I already use a nickname with no color codes or anything, that's totally not the mistake Link to comment
Castillo Posted August 18, 2013 Share Posted August 18, 2013 Try this: function HunterInfo ( source, _, person ) local person = getPlayerFromName ( person ) local account = getPlayerAccount ( source ) if ( not person and not getAccountData ( account, "hunter.counts" ) ) then outputChatBox ( "#FFFFFFYou did not reach the Hunter yet.", source, 255, 255, 255, true ) elseif ( not person and getAccountData ( account, "hunter.counts" ) == 1 ) then outputChatBox ( "#FFFFFFYou have reached the Hunter#FF0000 ".. getAccountData ( account, "hunter.counts" ) .." #FFFFFFtime.", source, 255, 255, 255, true ) elseif ( not person and getAccountData ( account, "hunter.counts" ) > 1 ) then outputChatBox ( "#FFFFFFYou have reached the Hunter#FF0000 ".. getAccountData ( account, "hunter.counts" ) .." #FFFFFFtimes.", source, 255, 255, 255, true ) elseif ( not getAccountData ( getPlayerAccount ( person ), "hunter.counts" ) ) then outputChatBox ( getPlayerName ( person ) .." #FFFFFFdid not reach the Hunter yet.", source, 255, 255, 255, true ) elseif ( getAccountData ( getPlayerAccount ( person ), "hunter.counts" ) == 1 ) then outputChatBox ( getPlayerName ( person ) .." #FFFFFFhas reached the Hunter #FF0000".. getAccountData ( getPlayerAccount ( person ), "hunter.counts" ) .." #FFFFFFtime.", source, 255, 255, 255, true ) elseif ( getAccountData ( getPlayerAccount ( person ), "hunter.counts" ) > 1 ) then outputChatBox ( getPlayerName ( person ) .." #FFFFFFhas reached the Hunter #FF0000".. getAccountData ( getPlayerAccount ( person ), "hunter.counts" ) .." #FFFFFFtimes.", source, 255, 255, 255, true ) else outputChatBox ( "Sytanx: /hunters [Player]", source, 255, 0, 0 ) end end addCommandHandler ( "hunters", HunterInfo ) Link to comment
-ffs-AbodyRulez Posted August 19, 2013 Author Share Posted August 19, 2013 Didn't work Snake. I'm a C programmer and pretty new to Lua, what i found out that Lua got a weird thing on its language == false == 0 == false or 0 < This will never work on getAccountData Not sure if its a bug or probably my mistake, thanks anyway Link to comment
bandi94 Posted August 19, 2013 Share Posted August 19, 2013 Didn't work Snake.I'm a C programmer and pretty new to Lua, what i found out that Lua got a weird thing on its language == false == 0 == false or 0 < This will never work on getAccountData Not sure if its a bug or probably my mistake, thanks anyway in C/C++ false = 0 if you use it in "if" , in lua it's note . Anyway :" getAccountData(....) or 0 " is working Link to comment
ixjf Posted August 19, 2013 Share Posted August 19, 2013 In Lua, numbers don't represent anything else than that: numbers. Boolean values are either true or false (it is case-sensitive, so TRUE and FALSE is not valid). in C/C++ false = 0 if you use it in "if" In C/C++, false always represents 0, no matter where you use it. 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