Nonameman Posted July 9, 2011 Share Posted July 9, 2011 Hello! I've just finished my user system, but i cannot use it because of the old one, commands are the same. How can I fully remove the original user system and from which resource? Thanks Nonameman Link to comment
Castillo Posted July 9, 2011 Share Posted July 9, 2011 What do you mean? just remove the old resource and start new? I don't really get you. Link to comment
Buffalo Posted July 9, 2011 Share Posted July 9, 2011 You can remove command 'register' from admin resource. 'Login' is hardcoded however. I would recommend you to create login GUI. Link to comment
Jaysds1 Posted July 9, 2011 Share Posted July 9, 2011 here is a Login GUI: https://community.multitheftauto.com/index.php?p=resources&s=details&id=2247 it actually adds the person account and if they type in /logout then they actually log out. Link to comment
Nonameman Posted July 9, 2011 Author Share Posted July 9, 2011 What do you mean? just remove the old resource and start new? I don't really get you. Yes, I'm going to use my own, but I want to use /register and /login commands, like in the old resource. But when I type in the commands, the old one writes the good syntax into the chat, my GUI doesn't appear. Link to comment
Castillo Posted July 9, 2011 Share Posted July 9, 2011 The command /login can't be removed because is built-in MTA, but.. you can remove the /register one, you can get it in the admin panel by lil toady, just search for "register" keyword. Link to comment
Cadu12 Posted July 9, 2011 Share Posted July 9, 2011 Solidsnake14, It is possible to remove login, Im created my own functions get/setAccountData, and isGuestAccount https://wiki.multitheftauto.com/wiki/OnPlayerLogin ( Create a table player if player logged in ) https://wiki.multitheftauto.com/wiki/CancelEvent ( WARNING: Admin panel doesnt work, you have to edit it ) Create your own functions get/setAccountData, and isGuestAccount, I dont give you a source code. Im making my own admin panel Here is image: http://imageshack.us/photo/my-images/59 ... login.jpg/ Link to comment
Castillo Posted July 9, 2011 Share Posted July 9, 2011 Yes, but if i'm right, he said he still want's to use the MTA login system, and with this, you can't really use it. Link to comment
Nonameman Posted July 9, 2011 Author Share Posted July 9, 2011 Thank you guys! Yes, but if i'm right, he said he still want's to use the MTA login system, and with this, you can't really use it. No, I want to replace it with mine, just commands would be the same. Sorry if I told it wrong. My last question: Can you take a look at my code? GUI window doesn't appear. (It's very basic, but I've just started to learn lua) Client: http://pastebin.com/bVJy5B56 Server: http://pastebin.com/pndjcrG2 Link to comment
JR10 Posted July 9, 2011 Share Posted July 9, 2011 You didn't use those functions function showLoginWindow() createLoginWindow() if loginWindow then guiSetVisible(loginWindow, true) showCursor(true) guiSetInputEnabled(true) else outputChatBox("A bejelentkező panel jelenleg nem üzemel") end end function showRegistWindow() createRegistWindow() if registWindow then guiSetVisible(registWindow, true) showCursor(true) guiSetInputEnabled(true) else outputChatBox("A regisztrációs panel jelenleg nem üzemel") end end So it won't show up use it like this addEventHandler("onClientResourceStart", resourceRoot, function() showLoginWindow() end) Link to comment
Nonameman Posted July 9, 2011 Author Share Posted July 9, 2011 I triggerClientEvent() these Server-side, check my other link. Link to comment
JR10 Posted July 9, 2011 Share Posted July 9, 2011 You didn't add the event and handle it. triggerClientEvent uses event not function. example: --client side addEvent("showLoginWindow", true) addEventHandler("showLoginWindow", root, function() showLoginWindow() end) You CAN'T use triggerClientEvent or triggerServerEvent to trigger a function you must add the function to the event. And it's addEventHandler not AddEventHandler. Link to comment
Nonameman Posted July 9, 2011 Author Share Posted July 9, 2011 Ohh, you're absolutely right, I didn't know it, thanks a lot! Link to comment
Nonameman Posted July 11, 2011 Author Share Posted July 11, 2011 Debugscript writes bad argument type errors to these lines: addEventHandler("onClientGUIClick", buttonLoginToRegist, changeLoginToRegist, false) addEventHandler("onClientGUIClick", buttonPassChangeSubmit, submitPassChange, false) addEventHandler("onClientGUIClick", buttonExit, exitAuth, false) addEventHandler("onClientGUIClick", buttonRegistToLogin, changeRegistToLogin, false) addEventHandler("onClientGUIClick", buttonLoginSubmit, submitLogin, false) addEventHandler("onClientGUIClick", buttonRegistSubmit, submitRegist, false) Link to comment
Nonameman Posted July 12, 2011 Author Share Posted July 12, 2011 Did you add the Functions? "onClientGUIClick" is a built-in function, isn't it? Link to comment
Castillo Posted July 12, 2011 Share Posted July 12, 2011 onClientGUIClick is a EVENT handler, not a function. https://wiki.multitheftauto.com/wiki/Cli ... GUI_events Link to comment
Nonameman Posted July 12, 2011 Author Share Posted July 12, 2011 Yes, my mistake. And I added the functions. Link to comment
JR10 Posted July 12, 2011 Share Posted July 12, 2011 Yes, but it's not what he meant, if i'm right he meant adding the functions like: addEventHandler("onClientGUIClick", buttonLoginToRegist, changeLoginToRegist, false) addEventHandler("onClientGUIClick", buttonPassChangeSubmit, submitPassChange, false) addEventHandler("onClientGUIClick", buttonExit, exitAuth, false) addEventHandler("onClientGUIClick", buttonRegistToLogin, changeRegistToLogin, false) addEventHandler("onClientGUIClick", buttonLoginSubmit, submitLogin, false) addEventHandler("onClientGUIClick", buttonRegistSubmit, submitRegist, false) Did you add these functions? changeLoginToRegist submitPassChange exitAuth changeRegistToLogin submitLogin submitRegist Link to comment
Nonameman Posted July 12, 2011 Author Share Posted July 12, 2011 Yes, all of them are added. Link to comment
JR10 Posted July 12, 2011 Share Posted July 12, 2011 use /debugscript 3 and post any errors or warnings here. Link to comment
Nonameman Posted July 12, 2011 Author Share Posted July 12, 2011 6x Bad Argument @ 'addEventHandler' nothing more.. Link to comment
JR10 Posted July 12, 2011 Share Posted July 12, 2011 Post both server side and client side here between [lua] tags Link to comment
Nonameman Posted July 12, 2011 Author Share Posted July 12, 2011 addEvent("onAuthExit", true) addEventHandler("onAuthExit", getRootElement(), function () kickPlayer(source) end ) addEvent("onAuthLogin", true) addEventHandler("onAuthLogin", getRootElement(), function (username, password) if getAccount(username, password) then logIn(source, username, password) outputChatBox("Sikeresen bejelentkeztel", source) spawnPlayer(source, 1959.55, -1714.46, 11) fadeCamera(source, true) setCameraTarget(source, source) else outputChatBox("Nem letezik ilyen felhasznalo, probald ujra vagy regisztralj", source) triggerClientEvent("onLoginStart", source) end end ) addEvent("onAuthRegist", true) addEventHandler("onAuthRegist", getRootElement(), function (username, password) if getAccount(username) then outputChatBox("Mar letezik ilyen nevu felhasznalo, jelentkezz be, vagy valassz masik felhasznalonevet", source) triggerClientEvent("onRegistStart", source) else addAccount(username, password) triggerClientEvent("onLoginStart", source) outputChatBox("Sikeres regisztracio, most mar bejelentkezhetsz", source) end end ) function passwordChange(playerSource) if isGuestAccount(getPlayerAccount(playerSource)) then outputChatBox("Be kell jelentkezned hogy hasznalhasd ezt a parancsot", source) else triggerClientEvent("onPassChangeStart", source) end end addCommandHandler("jelszocsere", passwordChange) addEvent("onAuthPassChange", getRootElement(), function (newpass) setAccountPassword(getPlayerAccount(source), newpass) outputChatBox("Sikeres jelszocsere", source) end ) local windowLogin local editLoginUser local editLoginPass local loginToRegist local buttonLoginSubmit local windowRegist local editRegistUser local editRegistPass local registToLogin local buttonRegistSubmit local windowPassChange local editPassChangeNew local editPassChangeRe local buttonPassChangeSubmit local buttonExit addEventHandler("onClientResourceStart", resourceRoot, function () createLoginWindow() createRegistWindow() createPassChangeWindow() showLoginWindow() end ) addEvent("onLoginStart", true) addEventHandler("onLoginStart", getRootElement(), showLoginWindow) addEvent("onRegistStart", true) addEventHandler("onRegistStart", getRootElement(), showRegistWindow) addEvent("onPassChangeStart", true) addEventHandler("onPassChangeStart", getRootElement(), showPassChangeWindow) addEventHandler("onClientGUIClick", buttonLoginToRegist, changeLoginToRegist, false) addEventHandler("onClientGUIClick", buttonPassChangeSubmit, submitPassChange, false) addEventHandler("onClientGUIClick", buttonExit, exitAuth, false) addEventHandler("onClientGUIClick", buttonRegistToLogin, changeRegistToLogin, false) addEventHandler("onClientGUIClick", buttonLoginSubmit, submitLogin, false) addEventHandler("onClientGUIClick", buttonRegistSubmit, submitRegist, false) function showLoginWindow() if not windowLogin then outputChatBox("A bejelentkezo rendszer nem mukodik rendesen, kerlek jelentsd a weboldalon") outputChatBox("www."..webSite..".hu") end guiSetVisible(windowLogin, true) showCursor(true) guiSetInputEnabled(true) end function showRegistWindow() if not windowRegist then outputChatBox("A bejelentkezo rendszer nem mukodik rendesen, kerlek jelentsd a weboldalon") outputChatBox("www."..webSite..".hu") end guiSetVisible(windowRegist, true) showCursor(true) guiSetInputEnabled(true) end function showPassChangeWindow() if not windowPassChange then outputChatBox("Ez a funkcio jelenleg inaktiv, hamarosan vissza lesz allitva") end guiSetVisible(windowRegist, true) showCursor(true) guiSetInputEnabled(true) end function createLoginWindow() local GUIEditor_Label = {} windowLogin = guiCreateWindow(0.3484,0.3242,0.3,0.2,"Bejelentkezes",true) guiWindowSetSizable(windowLogin,false) GUIEditor_Label[1] = guiCreateLabel(0.1,0.2,0.4453,0.1268,"Felhasznalonev:",true,windowLogin) guiLabelSetColor(GUIEditor_Label[1],255, 255, 255) GUIEditor_Label[2] = guiCreateLabel(0.1,0.4,0.3281,0.0927,"Jelszo:",true,windowLogin) guiLabelSetColor(GUIEditor_Label[2],255, 255, 255) editLoginUser = guiCreateEdit(0.401,0.2,0.5,0.1024,"",true,windowLogin) guiEditSetMaxLength(editLoginUser,64) editLoginPass = guiCreateEdit(0.401,0.4,0.5,0.1024,"",true,windowLogin) guiEditSetMaxLength(editLoginPass,64) buttonLoginSubmit = guiCreateButton(0.099,0.6488,0.2005,0.2,"Elfogad",true,windowLogin) buttonLoginToRegist = guiCreateButton(0.349,0.6488,0.2995,0.2,"Regisztracio",true,windowLogin) buttonExit = guiCreateButton(0.7005,0.6488,0.2005,0.2,"Kilepes",true,windowLogin) guiSetVisible(windowLogin, false) end function createRegistWindow() local GUIEditor_Label = {} windowRegist = guiCreateWindow(0.3484,0.3242,0.3,0.2,"Regisztracio",true) guiWindowSetSizable(windowRegist,false) GUIEditor_Label[1] = guiCreateLabel(0.1,0.2,0.4453,0.1268,"Felhasznalonev:",true,windowRegist) guiLabelSetColor(GUIEditor_Label[1],255, 255, 255) GUIEditor_Label[2] = guiCreateLabel(0.1,0.4,0.3281,0.0927,"Jelszo:",true,windowRegist) guiLabelSetColor(GUIEditor_Label[2],255, 255, 255) editRegistUser = guiCreateEdit(0.401,0.2,0.5,0.1024,"",true,windowRegist) guiEditSetMaxLength(editRegistUser,64) editRegistPass = guiCreateEdit(0.401,0.4,0.5,0.1024,"",true,windowRegist) guiEditSetMaxLength(editRegistPass,64) buttonRegistSubmit = guiCreateButton(0.099,0.6488,0.2005,0.2,"Elfogad",true,windowRegist) buttonRegistToLogin = guiCreateButton(0.349,0.6488,0.2995,0.2,"Bejelentkezes",true,windowRegist) buttonExit = guiCreateButton(0.7005,0.6488,0.2005,0.2,"Kilepes",true,windowRegist) guiSetVisible(windowRegist, false) end function createPassChangeWindow() local GUIEditor_Label = {} windowPassChange = guiCreateWindow(0.3484,0.3242,0.3,0.2,"Jelszocsere",true) guiWindowSetSizable(windowPassChange,false) GUIEditor_Label[1] = guiCreateLabel(0.1,0.2,0.4453,0.1268,"Uj jelszo:",true,windowPassChange) guiLabelSetColor(GUIEditor_Label[1],255, 255, 255) GUIEditor_Label[2] = guiCreateLabel(0.1,0.4,0.3281,0.0927,"Megerosites:",true,windowPassChange) guiLabelSetColor(GUIEditor_Label[2],255, 255, 255) editPassChangeNew = guiCreateEdit(0.401,0.2,0.5,0.1024,"",true,windowPassChange) guiEditSetMaxLength(editPassChangeNew,64) editPassChangeRe = guiCreateEdit(0.401,0.4,0.5,0.1024,"",true,windowPassChange) guiEditSetMaxLength(editPassChangeRe,64) buttonPassChangeSubmit = guiCreateButton(0.099,0.6488,0.2005,0.2,"Csere",true,windowPassChange) buttonExit = guiCreateButton(0.7005,0.6488,0.2005,0.2,"Kilepes",true,windowPassChange) guiSetVisible(windowPassChange, false) end function changeLoginToRegist(button, state) if button == "left" and state == "up" then guiSetVisible(windowLogin, false) showRegistWindow() end end function changeRegistToLogin(button, state) if button == "left" and state == "up" then guiSetVisible(windowRegist, false) showLoginWindow() end end function exitAuth(button, state) if button == "left" and state == "up" then if windowLogin then guiSetVisible(windowLogin, false) end if windowRegist then guiSetVisible(windowRegist, false) end if windowPassChange then guiSetVisible(windowPassChange, false) end showCursor(false) guiSetInputEnabled(false) triggerServerEvent("onAuthExit", getLocalPlayer()) end end function submitLogin(button, state) if button == "left" and state == "up" then local username = guiGetText(editLoginUser) local password = guiGetText(editLoginPass) if string.len(username) == 0 or string.len(password) == 0 then outputChatBox("Mindket mezo kitoltese kotelezo") else guiSetVisible(windowLogin, false) showCursor(false) guiSetInputEnabled(false) triggerServerEvent("onAuthLogin", getLocalPlayer(), username, password) end end end function submitRegist(button, state) if button == "left" and state == "up" then local username = guiGetText(editRegistUser) local password = guiGetText(editRegistPass) if string.len(username) == 0 or string.len(password) == 0 then outputChatBox("Mindket mezo kitoltese kotelezo") elseif string.len(fiusernameeld1) < 4 then outputChatBox("A felhasznalonevnek minimum 4 karakter hosszunak kell lennie") else guiSetVisible(windowRegist, false) destroyElement(windowRegist) showCursor(false) guiSetInputEnabled(false) triggerServerEvent("onAuthRegist", getLocalPlayer(), username, password) end end end function submitPassChange(button, state) if button == "left" and state == "up" then local newpass = guiGetText(editPassChangeNew) local repass = guiGetText(editPassChangeRe) if string.len(newpass) == 0 or string.len(repass) == 0 then outputChatBox("Mindket mezo kitoltese kotelezo") elseif string.len(newpass) < 4 then outputChatBox("Az új jelszónak minimum 4 karakter hosszunak kell lennie") elseif newpass ~= repass then outputChatBox("Az új jelszó és a megerősítés nem egyeznek") else guiSetVisible(windowPassChange, false) showCursor(false) guiSetInputEnabled(false) triggerServerEvent("onAuthPassChange", getLocalPlayer(), newpass) end end end Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now