Jump to content

account data


Amine#TN

Recommended Posts

0834a20269db453aa6036ce679039a0a.png

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
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

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 by SARSRPG
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...