SF爱好求教:如何用lua实现游戏内调用数据库函数实现账号密码注册?
/**************************************
用户注册
**************************************/
ALTER PROCEDURE [dbo].[RegAccount]
@PlayerAccount char(20),
@PlayerPassword char (20),
@PlayerUserPwd char(20),
@RetuValue int output
as declare @MaxPlayerID bigint, @TimeNow datetime, @UIDIncreaseOffset int, @MaxRegCount bigint
begin set @PlayerPassword = rtrim(@PlayerPassword); select @TimeNow = GETDATE(); select @MaxPlayerID = IdValue + 1 from SumTable where IndexId = 501; --查找当前用户的最大的PlayerUID号
if exists(select PlayerUID from PlayerID where Account = @PlayerAccount) --判断用户注册的用户名是否被注册过
begin
set @RetuValue = -1
return ;
end
if exists(select PlayerUID from DreamWorkXYD_ESO.dbo.PlayerID where Account = @PlayerAccount)
begin
set @RetuValue = -1
return ;
end
if exists(select PlayerUID from DreamWorkXYD_Unused.dbo.PlayerInfo where Account = @PlayerAccount)
begin
set @RetuValue = -1
return;
end
update SumTable set IdValue = @MaxPlayerID where IndexId = 501;
begin Transaction
insert into PlayerID (Account,
PlayerUID)
values(@PlayerAccount,
@MaxPlayerID);
IF @@RowCount <> 1 GOTO Error
insert into PlayerAccount (PlayerUID, --保存用户信息
RegistTime,
UserPassword)
values (@MaxPlayerID,
@TimeNow,
rtrim(@PlayerUserPwd)
);
IF @@RowCount <> 1 GOTO Error
insert into PlayerSecureQA(PlayerUID)
values (@MaxPlayerID)
IF @@RowCount <> 1 GOTO Error
Declare @date datetime
select @date =dateAdd(minute,1000,getdate()) --加40分钟
insert into PlayerCardPoint(PlayerUID, --初始化用户游戏信息
--CardPoint,
[Password])
--FirstLogin,
--CardType,
--CardAvailableTime)
values (@MaxPlayerID,
--0,
rtrim(@PlayerPassword))
--convert(datetime, '1905-04-15'),
--0,
--null);
IF @@RowCount <> 1 GOTO Error Commit set @RetuValue = 1 return; Error: BEGIN ROLLBACK TRANSACTION SET @RetuValue = -1 RETURN END end
--------以下是游戏服务端lua脚本 RemoveObjectIndirect(111, 19033) CreateObjectIndirect( { regionId = 111,name = "注册",imageId = 0130, x = 8, y = 12 ,clickScript = 58339, dir = 4,objectType = 1, controlId = 19033} )
function OnClick58339()
Zhuce()
end
function Zhuce()
zhuce = zhuce or {
cleanup = true,
image_1 = "285,123,interface/faceplate/打造、鉴定1.spr",
text_2 = "300,205,%\120请输入%\161账号*",
text_3 = "300,250,%\120请输入%\161密码*",
text_4 = "300,295,%\120请确认%\161密码*",
ScriptEdit_8 = { pos = "400,205", Player = false,number = false, maxlength = 19},
ScriptEdit_9 = { pos = "400,250", Player = false,number = false, maxlength = 19},
ScriptEdit_10 = { pos = "400,295", Player = false,number = false, maxlength = 19},
SprButton_13 = { pos = "340,440", image = "Interface/okcancel/确定", action = "@rv,8,@rv,9,@rv,10,@rv,11,@rv,12,@E" },
SprButton_14 = { pos = "490,440", image = "Interface/okcancel/取消", action = "@E" },
}
WndCustomize( zhuce, "Zhuce1" )
end
function Zhuce1(Account,Password,UserPwd)
if(Account == "" or Password == "" or UserPwd == "" )then
SetMessage(0,"账号密码必填,不能为空!!!#确定#",0,0)
return
else
if(PlayerPassword ~= PlayerUserPwd)then
SetMessage(0,"两次密码不一致!!!#确定#",0,0)
return
else
local call = {dbtype = 0, sp = 'RegAccount', args = 3, [1] = Account, [2] = Password, [3] = UserPwd}
local callback = { callback = "Zhuce2", args = 1, [1] = "?4"}
DBRPC( call, callback )
end
end
end
function Zhuce2(args) if(args == 1)then SetMessage(0,"注册成功。#确定#",0,0) elseif(args == 0)then SetMessage(0,"注册失败。#确定#",0,0) else SetMessage(0,"此账号已被注册。#确定#",0,0) end end
- 【上海普陀区】内向猫网络招募【Skynet游戏框架Lua后端程序员】
- SF爱好求教:如何用lua实现游戏内调用数据库函数实现账号密码注册?
- Lua实现网站后台开发
- LUA错误显式返回,社区常见的规约是怎么样的
- lua5.3下载库失败
- 请问如何实现文本框内容和某个网页搜索框内容连接,并把网页输出来的结果反馈到另外一个文本框上
- lua lanes多线程使用
- 一个kv数据库
- openresty 有没有比较轻量的 docker 镜像
- 想问一下,有大佬用过luacurl吗
- 在Lua执行过程中使用Load函数出现问题
- 为什么 neovim 里没有显示一些特殊字符?
- Lua比较两个表的值(不考虑键的顺序)
- 有个lua简单的项目,外包,有意者加微信 liuheng600456详谈,最好在成都
- 如何在 Visual Studio 2022 中运行 Lua 代码?
- addEventListener 返回 nil Lua
- Lua中获取用户配置主目录的跨平台方法
- 如何编写 Lua 模式将字符串(嵌套数组)转换为真正的数组?
- 如何创建一个 lua 脚本以针对特定键为 fluentbit 进行限流
- 如何在Lua中将变量从Lua推送到C ++