spAik Posted May 22, 2014 Share Posted May 22, 2014 Hi, I use getAccounts() in my teammanager. The teammanager displays every player with the right AccountData "clan" Its able to kick a player you have specified to kick. Lets say this player is called "spAik. "nick" would be spAik then. It works then. But with some nicks it doesnt work. For example the nick "!<~BoX|3R|~>!" nick = !<~BoX|3R|~>! for _,v in ipairs(getAccounts()) do if (getAccountData(v,"clannick") == nick) then acc = v break end end -- it works until here. the clannick "!<~BoX|3R|~>!" is found local accNick = getAccountData(acc,"clannick") --also this is working. It gets the accNick-Data outputChatBox("#ffffff"..getPlayerName(source).."#ffffff kicked "..accNick,getRootElement(),255,0,0,true) -- it displays the accNick-Data (just to check if it really got an account setAccountData(acc,"clan","0") -- this doesnt work though. It just doesnt delete the clan, although the acc should be valid Someone knows what might be the problem here? Link to comment
Karuzo Posted May 22, 2014 Share Posted May 22, 2014 Try this : setAccountData(acc,"clan",false) Link to comment
spAik Posted May 22, 2014 Author Share Posted May 22, 2014 hi krzo, thanks for the reply. it doesnt set the AccountData to false. But I only have this problem with some nicks and I dont know how. I mean its only if the player has a strange nickname. But what has the nickname to do with acc I wonder... Link to comment
Fury Posted May 22, 2014 Share Posted May 22, 2014 nick = !<~BoX|3R|~>! for _,v in ipairs(getAccounts()) do if (if string.find(getAccountData(v,"clannick"),nick,1,true) then -- this will be more usefull. acc = v break end end local accNick = getAccountData(acc,"clannick") outputChatBox("#ffffff"..getPlayerName(source).."#ffffff kicked "..accNick,getRootElement(),255,0,0,true) setAccountData(acc,"clan",0) -- you can't delete a account table by using lua, so instead of it set 0 Link to comment
spAik Posted May 22, 2014 Author Share Posted May 22, 2014 thanks fury ow now i found so much errors it also doesnt work because i had more accounts with the accountdata "!<~BoX|3R|~>!", so it always results in a table of accounts, not in 1 account Link to comment
Fury Posted May 23, 2014 Share Posted May 23, 2014 thanks fury ow now i found so much errors it also doesnt work because i had more accounts with the accountdata "!<~BoX|3R|~>!", so it always results in a table of accounts, not in 1 account no problem. so using nick data is may cost getting wrong account, instead of it use only account itself. you may wanna do it like that; you need a main element that will kick the player out of team, and the kicked element. function(source,kicked) -- use source element to check if it have rights to kick the other element. -- and then you can use kicked element to change its account data. -- finally you dont need to use getAccounts at this subject. end so basicly, use the element itself instead of nick data. Link to comment
Deepu Posted May 23, 2014 Share Posted May 23, 2014 Bro, whats acc? acc is not defined in the client nor in the server. Link to comment
Chronic Posted May 23, 2014 Share Posted May 23, 2014 Bro, whats acc? acc is not defined in the client nor in the server. it is defined... acc = v Link to comment
#DRAGON!FIRE Posted May 23, 2014 Share Posted May 23, 2014 u must set account data value string local nick = '!<~BoX|3R|~>!' local table = { } for _,v in ipairs( getAccounts( ) ) do if ( getAccountData( v, "clannick" ) == nick ) then table.insert ( table, v ) end end for i = 1, #table do local accNick = getAccountData( table[i], "clannick" ) end 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