Jump to content

Variable


Vadlmok

Recommended Posts

Good evening. 
When creating the script, there was a question, variable pInfo.money be one character (on the server side) or will it be global for everyone?
If it is global, how to make individual?
Thanks for the reply. I apologize for my English, my native language, Russian

 

pInfo = {
    password = {},
    money = {},
    login = {},
    level = {},
    exp = {},
    online = {}
}
addEventHandler("onPlayerJoin", root, function ()
  triggerClientEvent ( source, "Login_User", source, active_login_system)
end)
addEventHandler ( "onPlayerQuit", root, function()
  if(pInfo.online[6] == 1) then
    local Query = dbQuery(connect_db, "UPDATE `account` SET \
      `Money` = ?,\
      `Level` = ?, `Exp` = ?\
     WHERE `Name` = ?",
      pInfo.money[2],
      pInfo.level[4], 
      pInfo.exp[5], 
      pInfo.login[3])
    dbFree(Query)
  end
end )

 

Edited by Vadlmok
Link to comment
8 hours ago, Mr.Loki said:

Создайте таблицу для каждого игрока. Pinfo [player] = {money = 6969, login = "loki", level = 9000, exp = 94, online = "Вероятно"}
Используйте passwordHash / passwordVerify при сохранении паролей в базе данных по соображениям безопасности.

 

Thank you for your advice. A question about player need to either declare? As for security, I have already used these functions

An error appeared, "attempt to index global 'info' (a nil value) "

Edited by Vadlmok
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...