function playerRegister(login, password)
local player = source
local mynick getPlayerName(source)
local mylogin = getAccount(login)
local mypassword = getAccount(password)
if not getAccount(login) then
addAccount(login, password)
dbQuery(db, "INSERT INTO users(login, nickname, password, status, hp, money, level) VALUES(" .. tostring( mylogin ) .. ", " .. tostring( mynick ) .. ", " .. tostring( mypassword ) .. ", 1, 100, 1500, 16)")
outputChatBox('Аккаунт успешно создан.', player)
else
outputChatBox('Аккаунт с таким логином существует!', player)
end
end
addEvent('playerRegister', true)
addEventHandler('playerRegister', root, playerRegister)
function playerRegister(login, password)
outputChatBox('Enter playerRegister...')
outputChatBox('login=',login,' password=',password)
local player = source
outputChatBox('player=',player)
local mynick getPlayerName(source)
outputChatBox('mynick=',mynick)
local mylogin = getAccount(login)
outputChatBox('mylogin=',mylogin)
local mypassword = getAccount(password)
outputChatBox('mypassword=',mypassword)
if not getAccount(login) then
outputChatBox('Creatre new account (' .. tostring(login) .. ')...')
addAccount(login, password)
outputChatBox('dbQuery:')
local query = "INSERT INTO users(login, nickname, password, status, hp, money, level) VALUES("
.. tostring( mylogin ) .. ", " .. tostring( mynick ) .. ", " .. tostring( mypassword ) .. ", 1, 100, 1500, 16)"
outputChatBox(query)
dbQuery(db, query)
outputChatBox('Аккаунт успешно создан.', player)
else
outputChatBox('Аккаунт с таким логином существует!', player)
end
end
addEvent('playerRegister', true)
addEventHandler('playerRegister', root, playerRegister)