DutchCaffeine Posted May 17, 2008 Share Posted May 17, 2008 Hello folks, Today I went to test my user registration system, and guess what a real strange error pops up. It tells me, I need to contact the application support team. Here we go: Assertion failed: szName, file .\logic\CStaticFunctionDefinitions.cpp, line 6365 This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. I also give the lua source, so maybe i make a mistake in there: user.lua [sERVER SIDE] --[[ user.lua ============== Server system. Alexander de Jong © 2008 This script will do every interacting with the client gui user system. ]]-- --[[ -- CLIENT.LUA addEvent ( "showWindow", true ) addEventHandler ( "showWindow", getRootElement(), function ( name ) guiCreateWindow ( 0.4, 0.4, 0.2, 0.2, name, true ) end ) -- -- SERVER.LUA addCommandHandler ( "test", function ( player ) triggerClientEvent ( player, "showWindow", getRootElement(), "Hello world" ) end ) -- ]]-- --[[ Register a user ]] function userRegister(username, password) -- Extra check of the user exists local Player = getPlayerFromNick(username) local account = getAccount(Player) if(isGuestAccount(account)) then message = " allready exists, you can't register your self." local r,g,b = getPlayerNametagColor(Player) outputChatBox(username .. "#FFFFFF" .. message, Player, r, g, b, true) return false end if(username ~= "" and username ~= nil and password ~= "" and password ~= nil) then local addAcc = addAccount(username, password) if(addAcc) then logIn(Player, account, password) outputChatBox("#00FF00Thank you " .. username .. " for your registration to lexlife! You are automaticly loged in!", Player) else outputChatBox("#FF0000There went something wrong, you can't register", Player) end end end addEvent("lex_onUserRegister", true) addEventHandler("lex_onUserRegister", getRootElement(), userRegister) user.lua client site --[[ user.lua ============ GUI system for the user system, like the register for, login form, and much more Alexander de Jong © 2008 ]]-- wndReg = nil -- Create the registration array reg = {} function userRegister() -- Create the registration window if wndReg == nil then local x, y = guiGetScreenSize() wndReg = guiCreateWindow(x / 2 - 310, y / 2 - 260, 600, 300, "LexLife - Registration", false) -- We need to have a tab in other to let it really work tabPanel = guiCreateTabPanel(0.01, 0.07, 0.98, 0.90, true, wndReg) reg.tabInfo = guiCreateTab("Info", tabPanel) reg.tabForm = guiCreateTab("Register", tabPanel) reg.tabExtra = guiCreateTab("Extra info", tabPanel) -- Create a memo in the tabInfo reg.memoInfo = guiCreateMemo(0.03, 0.03, 0.70, 0.80, "information", true, reg.tabInfo) -- Create a form in tabForm reg.labelPass = guiCreateLabel(0.03, 0.03, 0.25, 0.04, "Password:", true, reg.tabForm) reg.editPass = guiCreateEdit(0.03, 0.10, 0.16, 0.10, "", true, reg.tabForm) reg.btnSend = guiCreateButton(0.03, 0.15, 0.26, 0.10, "Send data", true, reg.tabForm) addEventHandler("onClientGUIClick", reg.btnSend, register) showCursor(false) guiSetVisible(wndReg, false) else showCursor(false) guiSetVisbile(wndReg, false) end end function register() if(source == reg.btnSend) then local player = getLocalPlayer() local pname = getPlayerName(player) triggerServerEvent("lex_onUserRegister", player, pname, guiGetText(reg.editPass)) end end function onCRStart() outputChatBox("Client resource start") userRegister() unbindKey("1", 'down') bindKey("1", 'down', toggleReg) end function toggleReg() if(guiGetVisible(wndReg) == true) then showCursor(false) guiSetVisible(wndReg, false) else showCursor(true) guiSetVisible(wndReg, true) end end addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), onCRStart) Alexander de jong Link to comment
DutchCaffeine Posted May 17, 2008 Author Share Posted May 17, 2008 Hello folks, Today I went to test my user registration system, and guess what a real strange error pops up. It tells me, I need to contact the application support team. Here we go: Assertion failed: szName, file .\logic\CStaticFunctionDefinitions.cpp, line 6365 This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. I also give the lua source, so maybe i make a mistake in there: user.lua [sERVER SIDE] --[[ user.lua ============== Server system. Alexander de Jong © 2008 This script will do every interacting with the client gui user system.]]-- --[[-- CLIENT.LUAaddEvent ( "showWindow", true )addEventHandler ( "showWindow", getRootElement(), function ( name ) guiCreateWindow ( 0.4, 0.4, 0.2, 0.2, name, true )end )-- -- SERVER.LUAaddCommandHandler ( "test", function ( player ) triggerClientEvent ( player, "showWindow", getRootElement(), "Hello world" )end )--]]-- --[[ Register a user]]function userRegister(username, password) -- Extra check of the user exists local Player = getPlayerFromNick(username) local account = getAccount(Player) if(isGuestAccount(account)) then message = " allready exists, you can't register your self." local r,g,b = getPlayerNametagColor(Player) outputChatBox(username .. "#FFFFFF" .. message, Player, r, g, b, true) return false end if(username ~= "" and username ~= nil and password ~= "" and password ~= nil) then local addAcc = addAccount(username, password) if(addAcc) then logIn(Player, account, password) outputChatBox("#00FF00Thank you " .. username .. " for your registration to lexlife! You are automaticly loged in!", Player) else outputChatBox("#FF0000There went something wrong, you can't register", Player) end endend addEvent("lex_onUserRegister", true)addEventHandler("lex_onUserRegister", getRootElement(), userRegister) user.lua client site --[[ user.lua ============ GUI system for the user system, like the register for, login form, and much more Alexander de Jong © 2008]]-- wndReg = nil -- Create the registration arrayreg = {} function userRegister() -- Create the registration window if wndReg == nil then local x, y = guiGetScreenSize() wndReg = guiCreateWindow(x / 2 - 310, y / 2 - 260, 600, 300, "LexLife - Registration", false) -- We need to have a tab in other to let it really work tabPanel = guiCreateTabPanel(0.01, 0.07, 0.98, 0.90, true, wndReg) reg.tabInfo = guiCreateTab("Info", tabPanel) reg.tabForm = guiCreateTab("Register", tabPanel) reg.tabExtra = guiCreateTab("Extra info", tabPanel) -- Create a memo in the tabInfo reg.memoInfo = guiCreateMemo(0.03, 0.03, 0.70, 0.80, "information", true, reg.tabInfo) -- Create a form in tabForm reg.labelPass = guiCreateLabel(0.03, 0.03, 0.25, 0.04, "Password:", true, reg.tabForm) reg.editPass = guiCreateEdit(0.03, 0.10, 0.16, 0.10, "", true, reg.tabForm) reg.btnSend = guiCreateButton(0.03, 0.15, 0.26, 0.10, "Send data", true, reg.tabForm) addEventHandler("onClientGUIClick", reg.btnSend, register) showCursor(false) guiSetVisible(wndReg, false) else showCursor(false) guiSetVisbile(wndReg, false) endend function register() if(source == reg.btnSend) then local player = getLocalPlayer() local pname = getPlayerName(player) triggerServerEvent("lex_onUserRegister", player, pname, guiGetText(reg.editPass)) endend function onCRStart() outputChatBox("Client resource start") userRegister() unbindKey("1", 'down') bindKey("1", 'down', toggleReg)end function toggleReg() if(guiGetVisible(wndReg) == true) then showCursor(false) guiSetVisible(wndReg, false) else showCursor(true) guiSetVisible(wndReg, true) endend addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), onCRStart) Alexander de jong Link to comment
eAi Posted May 17, 2008 Share Posted May 17, 2008 It clearly shouldn't be crashing - I'm trying to see if we've already fixed this or not. You're passing a player to getAccount, despite the syntax being 'string username, [string password]'. Fix that and the crash will probably go away. Edit: This crash has been fixed in DP3. Link to comment
eAi Posted May 17, 2008 Share Posted May 17, 2008 It clearly shouldn't be crashing - I'm trying to see if we've already fixed this or not. You're passing a player to getAccount, despite the syntax being 'string username, [string password]'. Fix that and the crash will probably go away. Edit: This crash has been fixed in DP3. Link to comment
DutchCaffeine Posted May 17, 2008 Author Share Posted May 17, 2008 Thanks, Is there any other way to get the account of the user, to check of the user exists? Or do need to add the password. Alexander [edit] It's fixed, but it doesn't register, need to get the debug warnings, but that's a piece of cake Link to comment
DutchCaffeine Posted May 17, 2008 Author Share Posted May 17, 2008 Thanks, Is there any other way to get the account of the user, to check of the user exists? Or do need to add the password. Alexander [edit] It's fixed, but it doesn't register, need to get the debug warnings, but that's a piece of cake Link to comment
Recommended Posts