Amine#TN Posted April 16, 2017 Share Posted April 16, 2017 hi all i hope all fine i want to know if i can use this to change an account data like kills or zombies kills and if it possible give me an exemple of the command to change the data and if it is not possible here can any one give me a resource to change the account data of the player i need it soon as possible i lost some data of players and thanx all Link to comment
Amine#TN Posted April 16, 2017 Author Share Posted April 16, 2017 exemple of a command for exemple for "myZom" "5000" as an account data the full command Link to comment
Captain Cody Posted April 16, 2017 Share Posted April 16, 2017 setAccountData(getPlayerFromName("CodyJ"),"myZom",5000) Link to comment
Amine#TN Posted April 16, 2017 Author Share Posted April 16, 2017 setAccountData(getPlayerFromName("striker"),"Boss kills",5000) i used this and i get Command executed Result: false and when i use setElementData(getPlayerFromName("striker"),"Boss Kills",5000) i get Command executed Result: True and my Boss kills change but when i reconnect changes lost Link to comment
Fist Posted April 16, 2017 Share Posted April 16, 2017 58 minutes ago, CodyJ(L) said: setAccountData(getPlayerFromName("CodyJ"),"myZom",5000) It won't work, it's not setElementData. You have to get account of the player not player itself. this should work. setAccountData(getPlayerAccount(getPlayerFromName("CodyJ")),"myZom",5000) Link to comment
Amine#TN Posted April 16, 2017 Author Share Posted April 16, 2017 it is working thanx can you give me the command to change the account without getting the player name i want to change some data when players are offline Link to comment
Fist Posted April 16, 2017 Share Posted April 16, 2017 2 hours ago, NOONE said: it is working thanx can you give me the command to change the account without getting the player name i want to change some data when players are offline Just replace getPlayerFromName("CodyJ") with player data to get account from variable data. Link to comment
Captain Cody Posted April 17, 2017 Share Posted April 17, 2017 Oh yeah sorry, forgot about that; was up late last night. Also use setAccountData(getAccount("CodyJ"),"myZom",5000) Link to comment
Infinity# Posted April 17, 2017 Share Posted April 17, 2017 (edited) Online players: setElementData(getPlayerFromName("playerName"), "myZom", amount) -- To update the current data setAccountData(getPlayerAccount(getPlayerFromName("playerName")), "myZom", amount) -- To make sure the data saves upon disconnection Offline players: setAccountData(getAccount("accountName"), "myZom", amount) -- To change the data from an offline account Or instead of using the run code command, you can use this instead. -- /setonlinekills playerName newKills -- Online command function changeOnlineData(player, command, name, amount) if player and command and name then local account = getAccountName(getPlayerAccount(player)) if account and isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then if getPlayerFromPartialName(name) then local nameElement = getPlayerFromPartialName(name) local nameAccount = getPlayerAccount(nameElement) setElementData(nameElement, "myZomb", amount) setAccountData(nameAccount, "myZomb", amount) outputChatBox("".. getPlayerName(nameElement) .." kills has been set to ".. amount ..".", player, 0, 200, 0, false) end end end end addCommandHandler("setonlinekills", changeOnlineData) -- /setofflinekills accountName newKills -- Offline command function changeOfflineData(player, command, name, amount) if player and command and name then local account = getAccountName(getPlayerAccount(player)) if account and isObjectInACLGroup("user."..accName, aclGetGroup("Admin")) then if getAccount(name) then local nameAccount = getAccount(name) setAccountData(nameAccount, "myZomb", amount) outputChatBox("".. name .." kills has been set to ".. amount ..".", player, 0, 200, 0, false) end end end end addCommandHandler("setofflinekills", changeOfflineData) function getPlayerFromPartialName(thePlayerName) local thePlayer = getPlayerFromName(thePlayerName) if thePlayer then return thePlayer end for _,thePlayer in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then return thePlayer end end return false end Edited April 17, 2017 by SARSRPG Link to comment
Amine#TN Posted April 17, 2017 Author Share Posted April 17, 2017 Thanx all it is working fine 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