Dimos7

Members
  • Content count

    882
  • Joined

  • Last visited

Community Reputation

30 Good

3 Followers

About Dimos7

Details

  • Location
    Greece

Recent Profile Visitors

1,118 profile views
  1. random occurrence of objects

    First heat do you mean random ? random object I'd and second the objects is table you need a loop for that
  2. [Question] Towing -system

    I want to make a tow system what function did i need?
  3. dx notification

    You need the event onClientRender for that
  4. [Help] I need shove a problem

    Anyone
  5. [Help] I need shove a problem

    local GUIEditor = { window = {}, label = {}, edit = {}, button = {}, checkbox = {}, } function createLoginWndow() backgroundL = guiCreateStaticImage(0, 0 , 3840, 2400, "587449097-ultra-hd-gaming-wallpapers.jpg", false) local screenW,screenH = guiGetScreenSize() local windowW,windowH = 480, 453 local left, top = (screenW-windowW)/2, (screenH-windowH)/2 GUIEditor.window[1] = guiCreateWindow(left, top, windowW, windowH, "Login", false) guiWindowSetMovable(GUIEditor.window[1], false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.label[1] = guiCreateLabel(38, 65, 63, 18, "Username:", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[1], "left") guiLabelSetVerticalAlign(GUIEditor.label[1], "top") GUIEditor.edit[1] = guiCreateEdit(169, 65, 234, 39, "", false, GUIEditor.window[1]) GUIEditor.label[2] = guiCreateLabel(38, 117, 63, 18, "Password:", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[2], "left") guiLabelSetVerticalAlign(GUIEditor.label[2], "top") GUIEditor.edit[2] = guiCreateEdit(169, 117, 234, 39, "", false, GUIEditor.window[1]) guiEditSetMasked(GUIEditor.edit[2], true) GUIEditor.checkbox[1] = guiCreateCheckBox(38, 175, 100,15, "Remember me", false, false, GUIEditor.window[1]) GUIEditor.button[1] = guiCreateButton(169, 175, 119, 16, "Forget Password", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(201, 253, 119, 47, "Login", false, GUIEditor.window[1]) GUIEditor.button[3] = guiCreateButton(201, 327, 119, 47, "Register", false, GUIEditor.window[1]) addEventHandler("onClientGUIClick", GUIEditor.button[1], createForgetPasswordWindow) addEventHandler("onClientGUIClick", GUIEditor.button[2], onClientSubmitLogin) addEventHandler("onClientGUIClick", GUIEditor.button[3], createRegisterWindow) addEventHandler("onClientGUIClick", GUIEditor.checkbox[1], saveInfo) end function createRegisterWindow() backgroundR = guiCreateStaticImage(0, 0 , 3840, 2400, "587449097-ultra-hd-gaming-wallpapers.jpg", false) local screenW, screenH = guiGetScreenSize() local windowW, windowH = 480, 453 local left, top = (screenW-windowW)/2 , (screenH-windowH)/2 GUIEditor.window[2] = guiCreateWindow(left, top, windowW, windowH, "Registration", false) guiWindowSetMovable(GUIEditor.window[2], false) guiWindowSetSizable(GUIEditor.window[2], false) GUIEditor.label[3] = guiCreateLabel(38, 65, 63, 18, "Username:", false, GUIEditor.window[2]) guiLabelSetHorizontalAlign(GUIEditor.label[3], "left") guiLabelSetVerticalAlign(GUIEditor.label[3], "top") GUIEditor.edit[3] = guiCreateEdit(169, 65, 234, 39, "", false, GUIEditor.window[2]) GUIEditor.label[4] = guiCreateLabel(38, 117, 63, 18, "Email:", false, GUIEditor.window[2]) guiLabelSetHorizontalAlign(GUIEditor.label[4], "left") guiLabelSetVerticalAlign(GUIEditor.label[4], "top") GUIEditor.edit[4] = guiCreateEdit(169, 117, 234, 39, "", false, GUIEditor.window[2]) GUIEditor.label[5] = guiCreateLabel(38, 175, 63, 18, "Password:", false, GUIEditor.window[2]) guiLabelSetHorizontalAlign(GUIEditor.label[5], "left") guiLabelSetVerticalAlign(GUIEditor.label[5], "top") GUIEditor.edit[5] = guiCreateEdit(169, 175, 234, 39, "", false, GUIEditor.window[2]) guiEditSetMasked(GUIEditor.edit[5], true) GUIEditor.button[4] = guiCreateButton(201, 253, 119, 47, "Register", false, GUIEditor.window[2]) GUIEditor.button[5] = guiCreateButton(201, 327, 119, 47, "Back", false, GUIEditor.window[2]) guiSetVisible(GUIEditor.window[1], false) guiSetVisible(GUIEditor.window[2], true) addEventHandler("onClientGUIClick", GUIEditor.button[4], onClientSubmitRegister) addEventHandler("onClientGUIClick", GUIEditor.button[5], hideRegisterWindow) end function createPasswordWindow() local screenW, screenH = guiGetScreenSize() local windowW, windowH = 480, 453 local left, top = (screenW-windowW)/2, (screenH-windowH)/2 GUIEditor.window[3] = guiCreateWindow(left, top, windowW, windowH, "Change Password:", false) guiWindowSetMovable(GUIEditor.window[3], false) guiWindowSetSizable(GUIEditor.window[3], false) GUIEditor.label[6] = guiCreateLabel(38, 65, 63, 18, "Password:", false, GUIEditor.window[3]) guiLabelSetHorizontalAlign(GUIEditor.label[6], "left") guiLabelSetVerticalAlign(GUIEditor.label[6], "top") GUIEditor.edit[6] = guiCreateEdit(169, 65, 234, 39, "", false, GUIEditor.window[3]) guiEditSetMasked(GUIEditor.edit[6], true) GUIEditor.label[7] = guiCreateLabel(38, 117, 63, 18, "Repeat", false, GUIEditor.window[3]) guiLabelSetHorizontalAlign(GUIEditor.label[7], "left") guiLabelSetVerticalAlign(GUIEditor.label[7], "top") GUIEditor.edit[7] = guiCreateEdit(169, 117, 234, 39, "", false, GUIEditor.window[3]) guiEditSetMasked(GUIEditor.edit[7], true) GUIEditor.button[6] = guiCreateButton(201, 253, 119, 47, "Change", false, GUIEditor.window[3]) GUIEditor.button[7] = guiCreateButton(201, 327, 119, 47, "Cancel", false, GUIEditor.window[3]) addEventHandler("onClientGUIClick", GUIEditor.button[6], onClientSubmitChangepw) addEventHandler("onClientGUIClick", GUIEditor.button[7], hidePasswordWindow) end function createForgetPasswordWindow() backgroundF = guiCreateStaticImage(0, 0 , 3840, 2400, "587449097-ultra-hd-gaming-wallpapers.jpg", false) local screenW, screenH = guiGetScreenSize() local windowW, windowH = 480, 453 local left, top = (screenW-windowW)/2, (screenH-windowH)/2 GUIEditor.window[4] = guiCreateWindow(left, top, windowW, windowH, "Forget Password:", false) guiWindowSetMovable(GUIEditor.window[3], false) guiWindowSetSizable(GUIEditor.window[3], false) GUIEditor.label[8] = guiCreateLabel(38, 65, 63, 18, "Email:", false, GUIEditor.window[4]) guiLabelSetHorizontalAlign(GUIEditor.label[8], "left") guiLabelSetVerticalAlign(GUIEditor.label[8], "top") GUIEditor.edit[8] = guiCreateEdit(169, 65, 234, 39, "", false, GUIEditor.window[4]) GUIEditor.label[9] = guiCreateLabel(38, 117, 63, 18, "Password:", false, GUIEditor.window[4]) guiLabelSetHorizontalAlign(GUIEditor.label[9], "left") guiLabelSetVerticalAlign(GUIEditor.label[9], "top") GUIEditor.edit[9] = guiCreateEdit(169, 117, 234, 39, "", false, GUIEditor.window[4]) guiEditSetMasked(GUIEditor.edit[9], true) GUIEditor.label[10] = guiCreateLabel(38, 175, 63, 18, "Repeat:", false, GUIEditor.window[4]) guiLabelSetHorizontalAlign(GUIEditor.label[10], "left") guiLabelSetVerticalAlign(GUIEditor.label[10], "top") GUIEditor.edit[10] = guiCreateEdit(169, 175, 234, 39, "", false, GUIEditor.window[4]) guiEditSetMasked(GUIEditor.edit[10], true) GUIEditor.button[8] = guiCreateButton(201, 253, 119, 47, "Change", false, GUIEditor.window[4]) GUIEditor.button[9] = guiCreateButton(201, 327, 119, 47, "Back", false, GUIEditor.window[4]) guiSetVisible(GUIEditor.window[1], false) guiSetVisible(GUIEditor.window[4], true) addEventHandler("onClientGUIClick", GUIEditor.button[8], onClientSubmitNewpw) addEventHandler("onClientGUIClick", GUIEditor.button[9], hideForgetPasswordWindow) end function resourceStart() createLoginWndow() if not GUIEditor.window[1] ~= nil then guiSetVisible(GUIEditor.window[1], true) else exports["notification-system"]:sendClientMessage("ERROR: A error has been occuopied!", 255, 0, 0) end guiSetInputEnabled(true) guiSetInputMode("no_binds_when_editing") showCursor(true) end function checkDetails() local username = guiGetText(GUIEditor.edit[1]) local password = guiGetText(GUIEditor.edit[2]) if username ~= "" and password ~= "" then if guiCheckBoxGetSelected(GUIEditor.checkbox[1]) then appendSavedData("username", tostring(username)) appendSavedData("password", tostring(password)) else appendSavedData("username", "") appendSavedData("password", "") end else exports["notification-system"]:sendClientMessage("ERROR: You need put username and password!", 255, 0, 0) end end function Chnagepw() createPasswordWindow() guiSetVisible(GUIEditor.window[3], true) guiSetInputEnabled(true) guiSetInputMode("no_binds_when_editing") showCursor(true) end local xmlFileName = "accounts.xml" function appendSavedData(parameter, value) local xmlFile = xmlLoadFile(xmlFileName) if not xmlFile then xmlFile = xmlCreateFile(xmlFileName, "login") end xmlNode = xmlFindChild(xmlFile, parameter, 0) if not xmlNode then xmlNode = xmlCreateChild(xmlFile, parameter) end xmlNodeSetValue(xmlNode, value) xmlSaveFile(xmlFile) xmlUnloadFile(xmlFile) end function loadSavedData(parameter, value) local xmlRoot = xmlLoadFile(xmlFileName) if (xmlRoot) then local xmlNode = xmlFindChild(xmlRoot, parameter, 0) if (xmlNode) then return xmlNodeGetValue(xmlNode) end end end function saveInfo(button, state) if source == GUIEditor.checkbox[1] and button == "left" and state == "up" then if guiCheckBoxGetSelected(GUIEditor.checkbox[1]) then guiCheckBoxSetSelected(GUIEditor.checkbox[1], true) guiSetText(GUIEditor.edit[1], tostring(loadSavedData("username", ""))) guiSetText(GUIEditor.edit[2], tostring(loadSavedData("password", ""))) else guiCheckBoxSetSelected(GUIEditor.checkbox[1], false) guiSetText(GUIEditor.edit[1], "") guiSetText(GUIEditor.edit[2], "") end end end function onClientSubmitLogin(button, state) if source == GUIEditor.button[2] and button == "left" and state == "up" then local username = guiGetText(GUIEditor.edit[1]) local password = guiGetText(GUIEditor.edit[2]) if username ~= "" and password ~= "" then triggerServerEvent("onSubmitLogin", root, localPlayer, username, password) else exports["notification-system"]:sendClientMessage("ERROR: You need enter username and password!", 255, 0, 0) end end end function onClientSubmitRegister(button, state) if source == GUIEditor.button[4] and button == "left" and state == "up" then local username = guiGetText(GUIEditor.edit[3]) local email = guiGetText(GUIEditor.edit[4]) local password = guiGetText(GUIEditor.edit[5]) if username ~= "" and email ~= "" and password ~= "" then triggerServerEvent("onSubmitRegister", root, localPlayer, username, email, password) else exports["notification-system"]:sendClientMessage("ERROR: You need username, email and password for register!", 255, 0, 0) end end end function onClientSubmitChangepw(button, state) if source == GUIEditor.button[6] and button == "left" and state == "up" then local password = guiGetText(GUIEditor.edit[6]) local rpassword = guiGetText(GUIEditor.edit[7]) if password ~= "" and rpassword ~= "" then triggerServerEvent("onSubmitChangepw", root, localPlayer, password, rpassword) else exports["notification-system"]:sendClientMessage("ERROR: You need password and repeat password!", 255, 0 , 0) end end end function onClientSubmitNewpw(button, state) if source == GUIEditor.button[8] and button == "left" and state == "up" then local email = guiGetText(GUIEditor.edit[8]) local password = guiGetText(GUIEditor.edit[9]) local rpassword = guiGetText(GUIEditor.edit[10]) if email ~= "" and password ~= "" and rpassword ~= "" then triggerServerEvent("onSubmitNewpw", root, localPlayer, email, password, rpassword) else exports["notification-system"]:sendClientMessage("ERROR: You need email, password and repeat password!", 255, 0 , 0) end end end function hidePasswordWindow() guiSetVisible(GUIEditor.window[3], false) guiSetInputEnabled(false) showCursor(false) end function hideForgetPasswordWindow() guiSetVisible(GUIEditor.window[4], false) guiSetVisible(backgroundF, false) resourceStart() end function hideLoginWindow() guiSetVisible(GUIEditor.window[1], false) showCursor(false) guiSetInputEnabled(false) guiSetVisible(backgroundL, false) end function hideRegisterWindow() guiSetVisible(GUIEditor.window[2], false) guiSetVisible(backgroundR, false) resourceStart() end addEvent("hideLoginWindow", true) addEvent("hidePasswordWindow", true) addEvent("hideRegisterWindow", true) addEvent("hideForgetPasswordWindow", true) addEventHandler("hideLoginWindow", root, hideLoginWindow) addEventHandler("hidePasswordWindow", root, hidePasswordWindow) addEventHandler("hideForgetPasswordWindow", root, hideForgetPasswordWindow) addEventHandler("hideRegisterWindow", root, hideRegisterWindow) addEventHandler("onClientResourceStart", resourceRoot, resourceStart) addCommandHandler("changepw", Chnagepw) function resourceStart() connection = dbConnect("mysql", "dbname=mtatest; host=127.0.0.1", "root", "9852174563") end addEventHandler("onResourceStart", resourceRoot, resourceStart) function passwordHandler(thePlayer, password, rpassword) local account = getPlayerAccount(thePlayer) local accountName = getAccountName(account) local query = dbQuery(connection, "SELECT *FROM accounts WHERE username=?",tostring(accountName)) local result, num_affected_rows = dbPoll(query, -1) if not isGuestAccount(account) and num_affected_rows > 1 then if password == rpassword then if string.len(password) >= 6 then local spassword = tostring(password) local safepassword = md5(spassword) setAccountPassword(account, password) triggerClientEvent(thePlayer, "hidePasswordWindow", root) dbExec(connection, "UPDATE accounts SET password='"..safepassword.."WHERE username='"..tostring(accountName).."'") outputChatBox("You succefull change your password!", thePlayer, 0, 255, 0) else outputChatBox("Your new password must be at least 6 characters long!", thePlayer, 255, 0, 0) end else outputChatBox("The password and repeat password are not the same!", thePlayer, 255, 0, 0) end else outputChatBox("You aren't logged in!.", thePlayer, 255, 0, 0) end end function forgetpasswordHandler(thePlayer, email, password, rpassword) local account = getPlayerAccount(getPlayerName(thePlayer)) local query = dbQuery(connection, "SELECT * FROM accounts WHERE email =?", tostring(email)) local result, num_affected_rows = dbPoll(query, -1) if num_affected_rows > 1 then if password == rpassword then if string.len(password) >= 6 then local spassword = tostring(password) local safepassword = md5(spassword) setAccountPassword(account, password) dbExec(connection, "UPDATE accounts SET password ='"..safepassword.." WHERE email ='"..tostring(email).."'") triggerClientEvent(thePlayer, "hideForgetPasswordWindow", root) exports["notification-system"]:sendClientMessage("INFO: You succefull change your password!", thePlayer, 0, 255, 0) else exports["notification-system"]:sendClientMessage("ERROR: Your new password must be at least 6 characters long!", thePlayer, 255, 0, 0) end else exports["notification-system"]:sendClientMessage("ERROR: Password and repeat password are not the same!", thePlayer, 255, 0, 0) end else exports["notification-system"]:sendClientMessage("ERROR: That email dosen't exist!", thePlayer, 255, 0, 0) end end function loginHandler(thePlayer, username, password) local account = getAccount(username, password) local safeusername = tostring(username) local spassword = tostring(password) local safepassword = md5(spassword) local query = dbQuery(connection, "SELECT * FROM accounts WHERE username='"..safeusername.."' and password='"..safepassword.."'") local result, num_affected_rows = dbPoll(query, -1) if account ~= nil and num_affected_rows > 1 then if logIn(thePlayer, account, password) == true then triggerClientEvent(thePlayer, "hideLoginWindow", root) exports["notification-system"]:sendClientMessage("INFO: You succefull logged in!", thePlayer, 0, 255, 0) dbExec(connection, "UPDATE account SET lastlogin= NOW()") else exports["notification-system"]:sendClientMessage("ERROR: Username or password are ivaild!", thePlayer, 255, 0, 0) end else exports["notification-system"]:sendClientMessage("ERROR: That account is already logged in!", thePlayer, 255, 0, 0) end end function registerHandler(thePlayer, username, email, password) local account = getAccount(username, password) local safeusername = tostring(username) local query = dbQuery(connection, "SELECT * FROM accounts WHERE username='"..safeusername.."'") local result, num_affected_rows= dbPoll(query, -1) if account ~= nil and num_affected_rows > 1 then exports["notification-system"]:sendClientMessage("ERROR: That account already exists!", thePlayer, 255, 0, 0) else if string.len(username) > 3 then if string.len(password) >= 6 then account = addAccount(username, password) local safeusername2 = tostring(username) local spassword = tostring(password) local safepassword = md5(spassword) local r = getRealTime() local playerIP = getPlayerIP(thePlayer) local playerSerial =getPlayerSerial(thePlayer) local playerName = getPlayerName(thePlayer) local timeString = ("%04d-%02d-%02d %02d:%02d:%02d"):format(r.year+1900, r.month+1, r.monthday, r.hour, r.minute, r.second) dbExec(connection, "INSERT INTO accounts SET username='"..safeusername2.."', password='"..safepassword.."', registerdate='"..tostring(timeString).."',ip='"..tostring(playerIP).."', serial='"..tostring(playerSerial).."',email='"..tostring(email).."', charactername='"..tostring(playerName).."'") exports["notification-system"]:sendClientMessage("INFO: You succefull register!", thePlayer, 0, 255, 0) triggerClientEvent(thePlayer, "hideRegisterWindow", root) else exports["notification-system"]:sendClientMessage("ERROR: Password must be at least 6 characters long!" , thePlayer, 255, 0, 0) end else exports["notification-system"]:sendClientMessage("ERROR: Usernamer is too short it must be more than 3 characters long!", thePlayer, 255, 0, 0) end end end addEvent("onSubmitChangepw", true) addEvent("onSubmitNewpw", true) addEvent("onSubmitLogin", true) addEvent("onSubmitRegister", true) addEventHandler("onSubmitChangepw", root, passwordHandler) addEventHandler("onSubmitNewpw", root, forgetpasswordHandler) addEventHandler("onSubmitLogin", root, loginHandler) addEventHandler("onSubmitRegister", root, registerHandler) c_login 185 and 186 bad argument #1 tostring(value expected)
  6. [Help] I need shove a problem

    i don't understandi know how to sql i want first fix the problem i have with my background image and window not load
  7. [Help] I need shove a problem

    local GUIEditor = { window = {}, label = {}, edit = {}, button = {}, checkbox = {}, } function createLoginWndow() local screenW,screenH = guiGetScreenSize() local windowW,windowH = 480, 453 local left, top = (screenW-windowW)/2, (screenH-windowH)/2 GUIEditor.window[1] = guiCreateWindow(left, top, windowW, windowH, "Login", false) guiWindowSetMovable(GUIEditor.window[1], false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.label[1] = guiCreateLabel(38, 65, 63, 18, "Username:", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[1], "left") guiLabelSetVerticalAlign(GUIEditor.label[1], "top") GUIEditor.edit[1] = guiCreateEdit(169, 65, 234, 39, "", false, GUIEditor.window[1]) GUIEditor.label[2] = guiCreateLabel(38, 117, 63, 18, "Password:", false, GUIEditor.window[1]) guiLabelSetHorizontalAlign(GUIEditor.label[2], "left") guiLabelSetVerticalAlign(GUIEditor.label[2], "top") GUIEditor.edit[2] = guiCreateEdit(169, 117, 234, 39, "", false, GUIEditor.window[1]) guiEditSetMasked(GUIEditor.edit[2], true) GUIEditor.checkbox[1] = guiCreateCheckBox(38, 175, 100,15, "Remember me", false, false, GUIEditor.window[1]) GUIEditor.button[1] = guiCreateButton(169, 175, 119, 16, "Forget Password", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(201, 253, 119, 47, "Login", false, GUIEditor.window[1]) GUIEditor.button[3] = guiCreateButton(201, 327, 119, 47, "Register", false, GUIEditor.window[1]) addEventHandler("onClientGUIClick", GUIEditor.button[1], createForgetPasswordWindow) addEventHandler("onClientGUIClick", GUIEditor.button[2], onClientSubmitLogin) addEventHandler("onClientGUIClick", GUIEditor.button[3], createRegisterWindow) addEventHandler("onClientGUIClick", GUIEditor.checkbox[1], saveInfo) end function createRegisterWindow() local screenW, screenH = guiGetScreenSize() local windowW, windowH = 480, 453 local left, top = (screenW-windowW)/2 , (screenH-windowH)/2 GUIEditor.window[2] = guiCreateWindow(left, top, windowW, windowH, "Registration", false) guiWindowSetMovable(GUIEditor.window[2], false) guiWindowSetSizable(GUIEditor.window[2], false) GUIEditor.label[3] = guiCreateLabel(38, 65, 63, 18, "Username:", false, GUIEditor.window[2]) guiLabelSetHorizontalAlign(GUIEditor.label[3], "left") guiLabelSetVerticalAlign(GUIEditor.label[3], "top") GUIEditor.edit[3] = guiCreateEdit(169, 65, 234, 39, "", false, GUIEditor.window[2]) GUIEditor.label[4] = guiCreateLabel(38, 117, 63, 18, "Email:", false, GUIEditor.window[2]) guiLabelSetHorizontalAlign(GUIEditor.label[4], "left") guiLabelSetVerticalAlign(GUIEditor.label[4], "top") GUIEditor.edit[4] = guiCreateEdit(169, 117, 234, 39, "", false, GUIEditor.window[2]) GUIEditor.label[5] = guiCreateLabel(38, 175, 63, 18, "Password:", false, GUIEditor.window[2]) guiLabelSetHorizontalAlign(GUIEditor.label[5], "left") guiLabelSetVerticalAlign(GUIEditor.label[5], "top") GUIEditor.edit[5] = guiCreateEdit(169, 175, 234, 39, "", false, GUIEditor.window[2]) guiEditSetMasked(GUIEditor.edit[5], true) GUIEditor.button[4] = guiCreateButton(201, 253, 119, 47, "Register", false, GUIEditor.window[2]) GUIEditor.button[5] = guiCreateButton(201, 327, 119, 47, "Back", false, GUIEditor.window[2]) guiSetVisible(GUIEditor.window[1], false) guiSetVisible(GUIEditor.window[2], true) addEventHandler("onClientGUIClick", GUIEditor.button[4], onClientSubmitRegister) addEventHandler("onClientGUIClick", GUIEditor.button[5], resourceStart) end function createPasswordWindow() local screenW, screenH = guiGetScreenSize() local windowW, windowH = 480, 453 local left, top = (screenW-windowW)/2, (screenH-windowH)/2 GUIEditor.window[3] = guiCreateWindow(left, top, windowW, windowH, "Change Password:", false) guiWindowSetMovable(GUIEditor.window[3], false) guiWindowSetSizable(GUIEditor.window[3], false) GUIEditor.label[6] = guiCreateLabel(38, 65, 63, 18, "Password:", false, GUIEditor.window[3]) guiLabelSetHorizontalAlign(GUIEditor.label[6], "left") guiLabelSetVerticalAlign(GUIEditor.label[6], "top") GUIEditor.edit[6] = guiCreateEdit(169, 65, 234, 39, "", false, GUIEditor.window[3]) guiEditSetMasked(GUIEditor.edit[6], true) GUIEditor.label[7] = guiCreateLabel(38, 117, 63, 18, "Repeat", false, GUIEditor.window[3]) guiLabelSetHorizontalAlign(GUIEditor.label[7], "left") guiLabelSetVerticalAlign(GUIEditor.label[7], "top") GUIEditor.edit[7] = guiCreateEdit(169, 117, 234, 39, "", false, GUIEditor.window[3]) guiEditSetMasked(GUIEditor.edit[7], true) GUIEditor.button[6] = guiCreateButton(201, 253, 119, 47, "Change", false, GUIEditor.window[3]) GUIEditor.button[7] = guiCreateButton(201, 327, 119, 47, "Cancel", false, GUIEditor.window[3]) addEventHandler("onClientGUIClick", GUIEditor.button[6], onClientSubmitChangepw) addEventHandler("onClientGUIClick", GUIEditor.button[7], hidePasswordWindow) end function createForgetPasswordWindow() local screenW, screenH = guiGetScreenSize() local windowW, windowH = 480, 453 local left, top = (screenW-windowW)/2, (screenH-windowH)/2 GUIEditor.window[4] = guiCreateWindow(left, top, windowW, windowH, "Forget Password:", false) guiWindowSetMovable(GUIEditor.window[3], false) guiWindowSetSizable(GUIEditor.window[3], false) GUIEditor.label[8] = guiCreateLabel(38, 65, 63, 18, "Email:", false, GUIEditor.window[4]) guiLabelSetHorizontalAlign(GUIEditor.label[8], "left") guiLabelSetVerticalAlign(GUIEditor.label[8], "top") GUIEditor.edit[8] = guiCreateEdit(169, 65, 234, 39, "", false, GUIEditor.window[4]) GUIEditor.label[9] = guiCreateLabel(38, 117, 63, 18, "Password:", false, GUIEditor.window[4]) guiLabelSetHorizontalAlign(GUIEditor.label[9], "left") guiLabelSetVerticalAlign(GUIEditor.label[9], "top") GUIEditor.edit[9] = guiCreateEdit(169, 117, 234, 39, "", false, GUIEditor.window[4]) guiEditSetMasked(GUIEditor.edit[9], true) GUIEditor.label[10] = guiCreateLabel(38, 175, 63, 18, "Repeat:", false, GUIEditor.window[4]) guiLabelSetHorizontalAlign(GUIEditor.label[10], "left") guiLabelSetVerticalAlign(GUIEditor.label[10], "top") GUIEditor.edit[10] = guiCreateEdit(169, 175, 234, 39, "", false, GUIEditor.window[4]) guiEditSetMasked(GUIEditor.edit[10], true) GUIEditor.button[8] = guiCreateButton(201, 253, 119, 47, "Change", false, GUIEditor.window[4]) GUIEditor.button[9] = guiCreateButton(201, 327, 119, 47, "Back", false, GUIEditor.window[4]) guiSetVisible(GUIEditor.window[1], false) guiSetVisible(GUIEditor.window[4], true) addEventHandler("onClientGUIClick", GUIEditor.button[8], onClientSubmitNewpw) addEventHandler("onClientGUIClick", GUIEditor.button[9], resourceStart) end function resourceStart() createLoginWndow() if GUIEditor.window[1] ~= nil then guiSetVisible(GUIEditor.window[1], true) else outputChatBox("A error has been occuopied!", 255, 0, 0) end guiSetInputEnabled(true) guiSetInputMode("no_binds_when_editing") guiSetVisible(GUIEditor.window[2], false) guiSetVisible(GUIEditor.window[4], false) showCursor(true) background = guiCreateStaticImage(0, 0 , 3840, 2400, "587449097-ultra-hd-gaming-wallpapers.jpg", false) end function checkDetails() local username = guiGetText(GUIEditor.edit[1]) local password = guiGetText(GUIEditor.edit[2]) if username ~= "" and password ~= "" then if guiCheckBoxGetSelected(GUIEditor.checkbox[1]) then appendSavedData("username", tostring(username)) appendSavedData("password", tostring(password)) else appendSavedData("username", "") appendSavedData("password", "") end else outputChatBox("You need put username and password!", 255, 0, 0) end end function Chnagepw() createPasswordWindow() addEventHandler("onClientRender", localPlayer, createPasswordWindow) guiSetVisible(GUIEditor.window[3], true) guiSetInputEnabled(true) guiSetInputMode("no_binds_when_editing") showCursor(true) showChat(true) setPlayerHudComponentVisible("all", true) guiSetVisible(background, false) end local xmlFileName = "accounts.xml" function appendSavedData(parameter, value) local xmlFile = xmlLoadFile(xmlFileName) if not xmlFile then xmlFile = xmlCreateFile(xmlFileName, "login") end xmlNode = xmlFindChild(xmlFile, parameter, 0) if not xmlNode then xmlNode = xmlCreateChild(xmlFile, parameter) end xmlNodeSetValue(xmlNode, value) xmlSaveFile(xmlFile) xmlUnloadFile(xmlFile) end function loadSavedData(parameter, value) local xmlRoot = xmlLoadFile(xmlFileName) if (xmlRoot) then local xmlNode = xmlFindChild(xmlRoot, parameter, 0) if (xmlNode) then return xmlNodeGetValue(xmlNode) end end end function saveInfo(button, state) if source == GUIEditor.checkbox[1] and button == "left" and state == "up" then if guiCheckBoxGetSelected(GUIEditor.checkbox[1]) then guiCheckBoxSetSelected(GUIEditor.checkbox[1], true) guiSetText(GUIEditor.edit[1], tostring(loadSavedData("username", ""))) guiSetText(GUIEditor.edit[2], tostring(loadSavedData("password", ""))) else guiCheckBoxSetSelected(GUIEditor.checkbox[1], false) guiSetText(GUIEditor.edit[1], "") guiSetText(GUIEditor.edit[2], "") end end end function onClientSubmitLogin(button, state) if source == GUIEditor.button[1] and button == "left" and state == "up" then local username = guiGetText(GUIEditor.edit[1]) local password = guiGetText(GUIEditor.edit[2]) if username ~= "" and password ~= "" then triggerServerEvent("onSubmitLogin", root, localPlayer, username, password) else outputChatBox("You need enter username and password!", 255, 0, 0) end end end function onClientSubmitRegister(button, state) if source == GUIEditor.button[4] and button == "left" and state == "up" then local username = guiGetText(GUIEditor.edit[3]) local email = guiGetText(GUIEditor.edit[4]) local password = guiGetText(GUIEditor.edit[5]) if username ~= "" and email ~= "" and password ~= "" then triggerServerEvent("onSubmitRegister", root, localPlayer, username, email, password) else outputChatBox("You need username, email and password for register!", 255, 0, 0) end end end function onClientSubmitChangepw(button, state) if source == GUIEditor.button[6] and button == "left" and state == "up" then local password = guiGetText(GUIEditor.edit[6]) local rpassword = guiGetText(GUIEditor.edit[7]) if password ~= "" and rpassword ~= "" then triggerServerEvent("onSubmitChangepw", root, localPlayer, password, rpassword) else outputChatBox("You need password and repeat password!", 255, 0 , 0) end end end function onClientSubmitNewpw(button, state) if source == GUIEditor.button[8] and button == "left" and state == "up" then local email = guiGetText(GUIEditor.edit[8]) local password = guiGetText(GUIEditor.edit[9]) local rpassword = guiGetText(GUIEditor.edit[10]) if email ~= "" and password ~= "" and rpassword ~= "" then triggerServerEvent("onSubmitNewpw", root, localPlayer, email, password, rpassword) else outputChatBox("You need email, password and repeat password!", 255, 0 , 0) end end end function hidePasswordWindow() removeEventHandler("onClientRender", localPlayer, createPasswordWindow) guiSetVisible(GUIEditor.window[3], false) guiSetInputEnabled(false) showCursor(false) end function hideForgetPasswordWindow() guiSetVisible(GUIEditor.window[4], false) resourceStart() end function hideLoginWindow() guiSetVisible(GUIEditor.window[1], false) showCursor(false) guiSetInputEnabled(false) guiSetVisible(background, false) end function hideRegisterWindow() guiSetVisible(GUIEditor.window[2], false) resourceStart() end addEvent("hideLoginWindow", true) addEvent("hidePasswordWindow", true) addEvent("hideRegisterWindow", true) addEvent("hideForgetPasswordWindow", true) addEventHandler("hideLoginWindow", root, hideLoginWindow) addEventHandler("hidePasswordWindow", root, hidePasswordWindow) addEventHandler("hideForgetPasswordWindow", root, hideForgetPasswordWindow) addEventHandler("hideRegisterWindow", root, hideRegisterWindow) addEventHandler("onClientResourceStart", resourceRoot, resourceStart) addCommandHandler("changepw", Chnagepw) function resourceStart() connection = dbConnect("mysql", "dbname=mtatest; host=127.0.0.1", "root", "9852174563") end addEventHandler("onResourceStart", resourceRoot, resourceStart) function passwordHandler(thePlayer, password, rpassword) local account = getPlayerAccount(thePlayer) local accountName = getAccountName(account) local query = dbQuery(connection, "SELECT *FROM accounts WHERE username=?",tostring(accountName)) local result = dbPoll(query, -1) if not isGuestAccount(account) and #result > 1 then if password == rpassword then if string.len(password) >= 6 then local spassword = tostring(password) local safepassword = md5(spassword) setAccountPassword(account, password) triggerClientEvent(thePlayer, "hidePasswordWindow", root) dbExec(connection, "UPDATE accounts SET password='"..safepassword.."WHERE username='"..tostring(accountName).."'") outputChatBox("You succefull change your password!", thePlayer, 0, 255, 0) else outputChatBox("Your new password must be at least 6 characters long!", thePlayer, 255, 0, 0) end else outputChatBox("The password and repeat password are not the same!", thePlayer, 255, 0, 0) end else outputChatBox("You aren't logged in!.", thePlayer, 255, 0, 0) end end function forgetpasswordHandler(thePlayer, email, password, rpassword) local account = getPlayerAccount(getPlayerName(thePlayer)) local query = dbQuery(connection, "SELECT * FROM accounts WHERE eamil =?", tostring(email)) local result = dbPoll(query, -1) if #result > 1 then if password == rpassword then if string.len(password) >= 6 then local spassword = tostring(password) local safepassword = md5(spassword) setAccountPassword(account, password) dbExec(connection, "UPDATE accounts SET password ='"..safepassword.." WHERE email ='"..tostring(email).."'") triggerClientEvent(thePlayer, "hideForgetPasswordWindow", root) outputChatBox("You succefull change your password!", thePlayer, 0, 255, 0) else outputChatBox("Your new password must be at least 6 characters long!", thePlayer, 255, 0, 0) end else outputChatBox("Password and repeat password are not the same!", thePlayer, 255, 0, 0) end else outputChatBox("ERROR: That email dosen't exist!", thePlayer, 255, 0, 0) end end function loginHandler(thePlayer, username, password) local account = getAccount(username, password) local safeusername = tostring(username) local spassword = tostring(password) local safepassword = md5(spassword) local query =dbQuery(connection, "SELECT * FROM accounts WHERE username='"..safeusername.."',password ='"..safepassword.."'") local result = dbPoll(query, -1) if account ~= nil and #result > 1 then if (logIn(thePlayer, account, password) == true) then triggerClientEvent(thePlayer, "hideLoginWindow", root) outputChatBox("INFO: You succefull logged in!", thePlayer, 0, 255, 0) dbExec(connection, "UPDATE account SET lastlogin= NOW()") else outputChatBox("Username or password are ivaild!", thePlayer, 255, 0, 0) end else outputChatBox("That account is already logged in!", thePlayer, 255, 0, 0) end end function registerHandler(thePlayer, username, email, password) local account = getAccount(username) local safeusername = tostring(username) local query = dbQuery(connection, "SELECT * FROM accounts WHERE username='"..safeusername.."'") local result = dbPoll(query, -1) if account ~= nil and #result > 1 then outputChatBox("That account already exists!", thePlayer, 255, 0, 0) else if string.len(username) > 3 then if string.len(password) >= 6 then account = addAccount(username, password) local safeusername2 = tostring(username) local spassword = tostring(password) local safepassword = md5(spassword) local r = getRealTime() local playerIP = getPlayerIP(thePlayer) local playerSerial =getPlayerSerial(thePlayer) local playerName = getPlayerName(thePlayer) local timeString = ("%04d-%02d-%02d %02d:%02d:%02d"):format(r.year+1900, r.month+1, r.monthday, r.hour, r.minute, r.second) dbExec(connection, "INSERT INTO accounts SET username='"..safeusername2.."', password='"..safepassword.."', registerdate='"..tostring(timeString).."'ip='"..tostring(playerIP).."', serial='"..tostring(playerSerial).."', email='"..tostring(email).."', charactersname='"..tostring(playerName).."'") outputChatBox("You succefull register!", thePlayer, 0, 255, 0) triggerClientEvent(thePlayer, "hideRegisterWindow", root) else outputChatBox("Password must be at least 6 characters long!" , thePlayer, 255, 0, 0) end else outputChatBox("Usernamer is too short it must be more than 3 characters long!", thePlayer, 255, 0, 0) end end end addEvent("onSubmitChangepw", true) addEvent("onSubmitNewpw", true) addEvent("onSubmitLogin", true) addEvent("onSubmitRegister", true) addEventHandler("onSubmitChangepw", root, passwordHandler) addEventHandler("onSubmitNewpw", root, forgetpasswordHandler) addEventHandler("onSubmitLogin", root, loginHandler) addEventHandler("onSubmitRegister", root, registerHandler) My first problem is i want that image be on background but the thing is the window its not showed and the other when i try register i have a warning about the email wrong syxtax mysql
  8. [Help] Deadline mod (like gta v) Scripting

    you need use the event onClientRender and take local player position in each frame and draw the line
  9. Help Please

    Make again that function of use the data store that he is mechanic
  10. [Question] GUIButton

    the thing is i want to make it so when press the button to have wait for 45 seconds how to do that
  11. [Question] GUIButton

    92
  12. [Question] GUIButton

    i tried make it like that local lscarShop = createMarker(552, -1266.90, 15.69, "cylinder", 3, 0, 70, 0, 255) local sfcarShop = createMarker(-1649, 1203.90, 6.3, "cylinder", 3, 0, 70, 0, 255) local lvcarShop = createMarker(2171.69, 1410.19, 10.19, "cylinder", 3, 0, 70, 0, 255) local lsapcarShop = createMarker(1924.5, -2242.30, 12.5, "cylinder", 3, 0, 70, 0, 255) local sfapcarShop = createMarker(-1350.19, -516.40, 13.19, "cylinder", 3, 0, 70, 0, 255) local lvapcarShop = createMarker(1292, 1359.69, 9.6, "cylinder", 3, 0, 70, 0 , 255) local baysidecarShop = createMarker(-2329, 2292.8, 3.5, "cylinder", 3, 0, 70, 0, 255) local vehiclePrices ={{445,100000}, {602,150000},{429,210000}, {536,200000}, {496,100000}, {402,2600000},{541,3000000}, {415,2500000},{589,100000}, {480, 1500000},{562, 2000000},{587,700000},{533, 700000}, {434, 500000}, {494, 2000000}, {503, 2000000}, {502, 2000000}, {579, 1200000}, {411, 2500000}, {559, 1500000}, {400, 2000000}, {500, 500000}, {603, 1000000}, {475, 400000}, {495, 700000}, {405, 1300000}, {535, 1000000}, {409, 1700000}, {560, 1500000},{506, 3000000}, {451, 3200000}, {558, 2000000}, {555, 1500000}, {477, 1000000}, {482, 1000000}, {581, 70000}, {521, 100000}, {463, 80000},{522, 200000}, {461, 100000}, {468, 80000},{592, 5000000}, {577, 4000000}, {511, 500000}, {512, 500000}, {593, 300000}, {553, 3000000}, {476, 3500000}, {519, 2000000}, {460, 1500000}, {513, 2000000}, {417, 800000},{487, 1500000},{469, 800000},{473, 200000}, {493, 500000}, {452, 700000}, {454, 200000}} function createcarShopwindow() local screenW, screenH = guiGetScreenSize() local windowW, windowH = 714, 556 local left, top = (screenW-windowW)/2, (screenH-windowH)/2 carShopwindow = guiCreateWindow(left, top, windowW, windowH, "Carshop", false) guiWindowSetMovable(carShopwindow, false) guiWindowSetSizable(carShopwindow, false) carGridList = guiCreateGridList(33, 29, 502, 333, false, carShopwindow) columnName = guiGridListAddColumn(carGridList, "Name", 0.8) columnPrice = guiGridListAddColumn(carGridList, "Price", 0.8) for i , v in ipairs (vehiclePrices) do if isElementWithinMarker(localPlayer, lscarShop) or isElementWithinMarker(localPlayer, sfcarShop) or isElementWithinMarker(localPlayer, lvcarShop) then local notAcceptableVehicles = {Plane = true, Helicopter = true, Boat = true} local vehicleType = getVehicleType(v[1]) if not notAcceptableVehicles[vehicleType] then local row = guiGridListAddRow(carGridList) local name = getVehicleNameFromModel(v[1]) guiGridListSetItemText(carGridList, row, columnName, name, false, false) guiGridListSetItemData(carGridList, row, columnName, v[1]) guiGridListSetItemText(carGridList, row, columnPrice, v[2].." $", false, false) guiGridListSetItemData(carGridList, row, columnPrice, v[2]) end elseif isElementWithinMarker(localPlayer, lsapcarShop) or isElementWithinMarker(localPlayer, sfapcarShop) or isElementWithinMarker(localPlayer, lvapcarShop) then local notAcceptableVehicles = {Automobile = true, Bike = true, Boat = true} local vehicleType = getVehicleType(v[1]) if not notAcceptableVehicles[vehicleType] then local row = guiGridListAddRow(carGridList) local name = getVehicleNameFromModel(v[1]) guiGridListSetItemText(carGridList, row, columnName, name, false, false) guiGridListSetItemData(carGridList, row, columnName, v[1]) guiGridListSetItemText(carGridList, row, columnPrice, v[2].." $", false, false) guiGridListSetItemData(carGridList, row, columnPrice, v[2]) end elseif isElementWithinMarker(localPlayer, baysidecarShop) then local notAcceptableVehicles = {Plane = true, Helicopter = true, Automobile = true, Bike= true} local vehicleType = getVehicleType(v[1]) if not notAcceptableVehicles[vehicleType] then local row = guiGridListAddRow(carGridList) local name = getVehicleNameFromModel(v[1]) guiGridListSetItemText(carGridList, row, columnName, name, false, false) guiGridListSetItemData(carGridList, row, columnName, v[1]) guiGridListSetItemText(carGridList, row, columnPrice, v[2].." $", false, false) guiGridListSetItemData(carGridList, row, columnPrice, v[2]) end end end buy = guiCreateButton(43, 407, 96, 49, "Buy", false, carShopwindow) preview = guiCreateButton(224, 407, 96, 49, "Preview", false, carShopwindow) cancel = guiCreateButton(373, 407, 96, 49, "Cancel", false, carShopwindow) end function showcarShopWindow() createcarShopwindow() if carShopwindow ~= nil then guiSetVisible(carShopwindow, true) else outputChatBox("An error has been ocupited!", 255, 0 , 0) end showCursor(true) end addEventHandler("onClientMarkerHit", root, showcarShopWindow) addEventHandler("onClientGUIClick", root, function() if not carShopwindow or not guiGetVisible(carShopwindow) then return end if source == buy then if guiGridListGetSelectedItem(carGridList) == -1 then outputChatBox("Select one vehicle!", 255, 0, 0) return end local modelID = guiGridListGetItemData(carGridList, guiGridListGetSelectedItem(carGridList), 1) local price = guiGridListGetItemData(carGridList, guiGridListGetSelectedItem(carGridList), 2) local modelID = tonumber(modelID) local price = tonumber(price) triggerServerEvent("buyCar", root, modelID, price) guiSetVisible(carShopwindow, false) showCursor(false) elseif source == preview then if guiGridListGetSelectedItem(carGridList) == -1 then outputChatBox("Select one vehicle!", 255, 0, 0) return end local modelID = guiGridListGetItemData(carGridList, guiGridListGetSelectedItem(carGridList), 1) local modelID = tonumber(modelID) x, y, z = getElementPosition(localPlayer) vehicle = createVehicle(modelID, x+10, y, z - 10) if not getTickCount() < 45000 then outputChatBox("You need wait 45 seconds to see another vehicle!", 255, 0, 0) end local ptimer = setTimer(function() destroyElement(vehicle) end, 45000, 1) elseif source == cancel then guiSetVisible(carShopwindow,false) showCursor(false) end end ) function resourceStart() createBlipAttachedTo(lsapcarShop, 55, 2) createBlipAttachedTo(sfapcarShop, 55, 2) createBlipAttachedTo(lvapcarShop, 55, 2) createBlipAttachedTo(lscarShop, 55, 2) createBlipAttachedTo(sfcarShop, 55, 2) createBlipAttachedTo(lvcarShop, 55, 2) createBlipAttachedTo(baysidecarShop, 55, 2) end addEventHandler("onClientResourceStart", resourceRoot, resourceStart) that i want is when a player click preview button for 45 seocnds he can't press it again and apear a message say that you need wait seconds for see another vehicle but a get error i try compare bollen with a number
  13. loading custom infernus models for each player.

    i think that its shaders change but idk if you can synce so all players see that i think its for local only
  14. [Question] GUIButton

    Hello guys i want ask a question for be sure before do it i want when i click a gui button i know that event name but i want make it so when someone click a button need wait some time i need getTickCount or setTimer for that?
  15. Tips for railroad

    That it not scripting but map go to map editor open it click object a and go to type dances and you will find it