Blinker. Posted March 26, 2015 Share Posted March 26, 2015 Hello Folks, i've a problem with string.find , i am trying to do if the guy who's spectating another guy is on the list then highlight his name. i have 2 tables : 1 - deathlist 2 - speclist if the guy in the speclist is 1 of the people in deathlist then highlight his name thats my code for i ,v in ipairs (speclist) do for k , s in ipairs (deathlist) do if string.find(getUncolored(v),getUncolored(s),3,false) then r ,g ,b = 255,153,0 outputDebugString("spectator: ".. getUncolored(v).." "..getUncolored(s)) else r ,g ,b = 255,255,255 outputDebugString("no spectator: ".. getUncolored(v).." "..getUncolored(s)) end end end i don't know why it's not working the color stays white , when i am spectating a guy called KnoX, it outputs: INFO:no spectator: [LoA]KnoX 3) [LoA]KnoX ... i don't know why it doesn't find [LoA]KnoX in 3) [LoA]KnoX thanks in advance. Link to comment
ALw7sH Posted March 26, 2015 Share Posted March 26, 2015 for i ,v in ipairs (speclist) do for k , s in ipairs (deathlist) do local v = v:gsub("([%*%+%?%.%(%)%[%]%{%}%\%/%|%^%$%-])","%%%1") local s = s:gsub("([%*%+%?%.%(%)%[%]%{%}%\%/%|%^%$%-])","%%%1") if string.find(getUncolored(v),getUncolored(s),3,false) then r ,g ,b = 255,153,0 outputDebugString("spectator: ".. getUncolored(v).." "..getUncolored(s)) else r ,g ,b = 255,255,255 outputDebugString("no spectator: ".. getUncolored(v).." "..getUncolored(s)) end end end because there's [ in his name ( not only if there's [ even if there's [,],(,) etc ) Link to comment
Blinker. Posted March 26, 2015 Author Share Posted March 26, 2015 still its not working Link to comment
ALw7sH Posted March 26, 2015 Share Posted March 26, 2015 at first you dont have to use string.find just use equal (v == s) second are you sure your tables looks like that or something like that table = {"Player1","Player2","Player3"} Link to comment
Blinker. Posted March 26, 2015 Author Share Posted March 26, 2015 no man i have to use string.find because i use PlayerRank..") " .. playername in tables it will return like that table = {"1) Blinker" , "2) anyone"} Link to comment
'LinKin Posted March 26, 2015 Share Posted March 26, 2015 wtf? Use player elements, or serials if u want the script to highlight the spectator's nick even after he reconnected Link to comment
ALw7sH Posted March 26, 2015 Share Posted March 26, 2015 wtf?Use player elements, or serials if u want the script to highlight the spectator's nick even after he reconnected ithink he's script a deathlist so he dont have to use elements as you said. Idont know if this is exactly what do you want to do, table1 = {"1) Player1","2) Player2","3) Player3"} table2 = {"2) Player2","1) Player1"} for k,v1 in ipairs(table1) do for k,v2 in ipairs(table2) do if v1:gsub(".-%) ","") == v2:gsub(".-%) ","") then print(v1:gsub(".-%) ","").." - "..v2:gsub(".-%) ","")) end end end Link to comment
Blinker. Posted March 26, 2015 Author Share Posted March 26, 2015 no man , deathlist = { 1) playername1 (whokilledplayer1) , 2) playername2 , 3)playername3 speclist = { spectatorname1 , spectatorname2 } player2 and player3 no one killed them so no "(whokilledplayer)" Link to comment
ALw7sH Posted March 26, 2015 Share Posted March 26, 2015 Can you just explain more what you are trying to do and post your codes? Link to comment
Blinker. Posted March 26, 2015 Author Share Posted March 26, 2015 ALw7sH do you have free time ? , if yes come my server i can show u the problem. Link to comment
Blinker. Posted March 26, 2015 Author Share Posted March 26, 2015 ok add me at skype : Mikaelkh98 , i will come after 30 mins because i have a clanwar now sorry , thank you Link to comment
Blinker. Posted March 26, 2015 Author Share Posted March 26, 2015 topic can be locked, ALw7sH came to my server and helped me there , thanks. 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