Jump to content

StefanAlmighty

Members
  • Posts

    143
  • Joined

  • Last visited

Everything posted by StefanAlmighty

  1. How can I move dxDrawText infront of GUI?
  2. How do I make it function like a normal edit box though?
  3. Okay so I'm not sure how to create a custom edit box, as I don't want to use the normal GUI ones: As seen in the image, it looks ugly with the white-backed edit boxes, I saw it on another server where they had their own edit box style. How could I go about doing this?
  4. And how do I slide an image across the screen like a transition?
  5. One more thing, how do I make edit boxes have an invisible white background? I want to use an edit box for a custom login screen, but I only want to use the text part and remove the white background area. I've seen it done before.
  6. addEventHandler("onClientGUIClick", guiRoot, onClickButton() local statement = nil if source == cpCopyAccount then statement = guiGetText(cpInfoAccount2) setClipboard(statement) outputChatBox("Copied: " .. statement) elseif source == cpCopySerial then statement = guiGetText(cpInfoSerial2) setClipboard(statement) outputChatBox("Copied: " .. statement) elseif source == cpCopyIP then statement = guiGetText(cpInfoIP2) setClipboard(statement) outputChatBox("Copied: " .. statement) elseif source == cpBanReason then guiSetText(cpBanReason, "") elseif source == cpBanTime then guiSetText(cpBanTime, "") elseif source == cpJailReason then guiSetText(cpJailReason, "") elseif source == cpJailTime then guiSetText(cpJailTime, "") elseif source == cpWarnReason then guiSetText(cpWarnReason, "") end end) Later.. removeEventHandler("onClientGUIClick", source, onClickButton)
  7. When I replace 'function' with a name, it still doesn't work.
  8. removeEventHandler("onClientGUIClick", source, function) Gives me errors such as expected symbol (, but when I add it, it doesn't work. Seems like it doesn't recognise function.
  9. Is there a way to destroy/kill an event?
  10. Okay so I have the following event handler inside of a function: addEventHandler("onClientGUIClick", source, function() local statement = nil if source == cpCopyAccount then statement = guiGetText(cpInfoAccount2) setClipboard(statement) outputChatBox("Copied: " .. statement) elseif source == cpCopySerial then statement = guiGetText(cpInfoSerial2) setClipboard(statement) outputChatBox("Copied: " .. statement) elseif source == cpCopyIP then statement = guiGetText(cpInfoIP2) setClipboard(statement) outputChatBox("Copied: " .. statement) elseif source == cpBanReason then guiSetText(cpBanReason, "") elseif source == cpBanTime then guiSetText(cpBanTime, "") elseif source == cpJailReason then guiSetText(cpJailReason, "") elseif source == cpJailTime then guiSetText(cpJailTime, "") elseif source == cpWarnReason then guiSetText(cpWarnReason, "") end end) cpCopyAccount button should copy the players account name to the clipboard, and it does. However, if I open the menu and copy once it works fine. If I close the menu, open it again and click the button it copies it twice. If I close it again and open it, it copies it three times and so on. Could somebody please help?
  11. Okay I want a GUI to appear for all players who are logged out once a resource starts. function onAccountsStart() local players = getElementsByType ( "player" ) for theKey, thePlayer in ipairs(players) do if getElementData(thePlayer, "account:logged") == false then triggerClientEvent(thePlayer, "loadLoginPanel", thePlayer) end end end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), onAccountsStart) It loops through all players and if account:logged is false then it triggers a client event. But for some reason, it isn't triggering the event and is not giving off any errors in the console or debugscript. Any help is appreciated.
  12. Hello guys I am in need of a little help. So I am custom mapping a City Hall in Los Santos for my Roleplay server but I am having an issue, I have removed the original building and replaced with the new as seen here: http://imgur.com/iluExNr But whenever I move my camera ever so slightly this happens: http://imgur.com/EsCcJfU I need your help as I have no idea what to do when this occurs. Thank you.
  13. When I look at my mapping from one angle I see this. But then when I look at it from another angle I see this. I need to know if there is a way to fix it, it is only when I move the camera, also on local servers it renders in just fine, but on my server when I add it, it just seems to glitch.
  14. I am having trouble with a few world objects in which I cannot select within the map editor, I was wondering if there is any way to do so. The object is a non coilision item. The windows you can see in this screenshot are what I am trying to remove, they only appear at night
  15. Okay so I'm triggering a clientside event in my serverside script: triggerClientEvent(source, "showGui", getRootElement()) It triggers this in the clientside script: function showGui() showCursor(true) guiSetInputEnabled(true) loadLoginPanel() end addEvent("showGui", true) addEventHandler("showGui", getRootElement(), showGui) I get this error in my debugscript: ERROR: Server triggered clientside event showGui but event is not added clientside Any help is appreciated.
  16. FML, I just realised "OnPlayerQuit" was supposed to be "onPlayerQuit", thanks!
  17. function onQuit() if getElementData(source, "account:logged") then -- logged in account --[[local lAccount = getElementData(source, "account:id") local preparedQuery1 = "UPDATE `accounts` SET `admin_level`='".. getElementData(source, "account:admin") .."' WHERE `id`='".. lAccount .."'" local Q1 = mysql:query(preparedQuery1) if not Q1 then outputDebugString("Error saving account " .. getElementData(source, "account:username"), 1) return false end outputDebugString("Successfully saved account " .. getElementData(source, "account:username"))]] end if getElementData(source, "character:logged") then -- logged in a character local lCharacter = getElementData(source, "character:id") local x, y, z = getElementPosition(source) local rz, ry, rz = getElementRotation(source) local dim, int, model = getElementDimension(source), getElementInterior(source), getElementModel(source) local preparedQuery2 = "UPDATE `characters` SET `x`='".. x .."', `y`='".. y .."', `z`='".. z .."', `rz`='".. rz .."', `dimension`='".. dim .."', `interior`='".. int .."', `skin`='".. model .."' WHERE `id`='".. lCharacter .."'" local Q2 = mysql:query(preparedQuery2) if not Q2 then outputDebugString("Error saving character " .. getElementData(source, "character:name"), 1) return false end mysql:free_result(Q2) outputDebugString("Successfully saved character " .. getElementData(source, "character:name")) end end addEventHandler("OnPlayerQuit", getRootElement(), onQuit) This doesn't seem to be working. It doesn't show errors in debugscript & doesn't save anything to the database. Ignore the quoted out part.
  18. Turns out I have to spam click "register" for it to finally create the account, how do I fix it so I only have to click it once?
  19. So I've pretty much made this myself but for some reason it doesn't create an account. It ends up telling me "successfully created" but never adds it to the database. Code: function accountCreate(username, password, email) local preparedQuery1 = "SELECT `id` FROM `accounts` WHERE `username`='".. mysql:escape_string(username) .."' OR `email`='".. mysql:escape_string(email) .."' " local Q1 = mysql:query(preparedQuery1) -- check mysql conn if not Q1 then outputDebugString("MYSQL error when creating account.") triggerClientEvent(source, "setErrorText", getRootElement(), "MySQL Error 001", 255, 0, 0) return false end -- check if exists if (mysql:num_rows(Q1) > 0) then triggerClientEvent(source, "setErrorText", getRootElement(), "Username or email already exists.", 255, 0, 0) mysql:free_result(Q1) return false end -- check if player already has acc local mtaSerial = getPlayerSerial(source) local preparedQuery2 = "SELECT `last_serial`, `username`, `id` FROM `accounts` WHERE `last_serial`='".. toSQL(mtaSerial) .."' LIMIT 1" local Q2 = mysql:query(preparedQuery2) if not Q2 then triggerClientEvent(source, "setErrorText", getRootElement(), "MySQL Error 002", 255, 0, 0) return false end local usernameExisted = mysql:fetch_assoc(Q2) if (mysql:num_rows(Q2) > 0) and usernameExisted["id"] ~= "1" then triggerClientEvent(source, "setErrorText", getRootElement(), "You already have an account registered (" .. tostring(usernameExisted["username"]) .. ").", 255, 0, 0) return false end mysql:free_result(Q2) -- begin creating it local encryptionRule = tostring(math.random(0,9))..tostring(math.random(0,9))..tostring(math.random(0,9))..tostring(math.random(0,9))..tostring(math.random(0,9))..tostring(math.random(0,9))..tostring(math.random(0,9))..tostring(math.random(0,9))..tostring(math.random(0,9))..tostring(math.random(0,9)) local encryptedPW = string.lower(md5(string.lower(md5(password)) .. encryptionRule)) local ipAddress = getPlayerIP(source) preparedQuery3 = "INSERT INTO `accounts` SET `username`='"..toSQL(username).."', `password`='"..toSQL(encryptedPW).."', `email`='"..toSQL(email).."', `security_question` = 'nil', `security_answer` = 'nil', `last_serial`='"..mtaSerial.."', `last_ip`='"..toSQL(ipAddress).."', `salt`='"..toSQL(encryptionRule).."'" local id = mysql:query_insert_free(preparedQuery3) if id and tonumber(id) then triggerClientEvent(source, "setErrorText", getRootElement(), "Successfully created account " .. username .. "!", 0, 255, 0) return true else triggerClientEvent(source, "setErrorText", getRootElement(), "Error creating account.", 255, 0, 0) return false end end addEvent("accountCreate", true) addEventHandler("accountCreate", getRootElement(), accountCreate) All help will be appreciated.
  20. Okay now, I want the static image to remain as the back layer (so it doesn't come to the front when clicked).
  21. Does not seem to be working. Every time I connect it gives a plain black screen.
  22. function loadLoginPanel() -- config stuff spawnPlayer(getLocalPlayer(), 0, 0, 0) showChat(false) showCursor(true) fadeCamera(true, 5) setCameraMatrix(2016.966796875, -1786.8369140625, 32.701007843018, 1947.2470703125, -1751.3662109375, 13.3828125) guiSetInputEnabled(true) local Width,Height = 350,350 local X = (sWidth/2) - (Width/2) local Y = (sHeight/5) - (Height/5) -- -- login panel login_panel = guiCreateStaticImage( X, Y + 110, 350, 350, "img/box.png", false ) --logo = guiCreateStaticImage( X + 75,Y + 115,200,80, "img/logo.png", false ) title = guiCreateLabel( X + 23, Y + 395, 301, 20, "Welcome to Los Santos County Roleplay!", false) guiLabelSetVerticalAlign(title,"center") guiLabelSetHorizontalAlign(title,"center",false) bLogin = guiCreateButton ( X + 23, Y + 349, 143, 45, "Login", false) lUsername = guiCreateLabel(X + 20,Y + 200,310,20,"Username",false) tUsername = guiCreateEdit(X + 20,Y + 220,310,35,"",false) lPassword = guiCreateLabel(X + 20,Y + 275,310,20,"Password",false) tPassword = guiCreateEdit(X + 20,Y + 295,310,35,"",false) guiEditSetMaxLength ( tUsername,25) guiEditSetMaxLength ( tPassword,25) guiEditSetMasked ( tPassword, true ) guiSetProperty( tPassword, 'MaskCodepoint', '8226' ) lbl_about_legth = guiCreateLabel(142,42,184,18,"",false) guiLabelSetColor(lbl_about_legth,253,255,68) guiLabelSetVerticalAlign(lbl_about_legth,"center") guiLabelSetHorizontalAlign(lbl_about_legth,"center",false) checkbox_save = guiCreateCheckBox(X + 230,Y + 275,100,20,"(Remember me!)",false,false) guiSetFont(checkbox_save,"default-small") login_tab_error_msg = guiCreateLabel(X,Y + 325,364,31,"Error_login_tab",false) guiLabelSetColor(login_tab_error_msg,255,0,0) guiLabelSetVerticalAlign(login_tab_error_msg,"center") guiLabelSetHorizontalAlign(login_tab_error_msg,"center",false) guiSetFont(login_tab_error_msg,"default-bold-small") login_tab_authen_msg = guiCreateLabel(X,Y + 325,364,31,"Authen_login_tab",false) guiLabelSetColor(login_tab_authen_msg,0,255,0) guiLabelSetVerticalAlign(login_tab_authen_msg,"center") guiLabelSetHorizontalAlign(login_tab_authen_msg,"center",false) guiSetFont(login_tab_authen_msg,"default-bold-small") shSignup = guiCreateButton ( X + 182, Y + 349, 143, 45, "Register", false) lbl_reg_top_info = guiCreateLabel(X + 20,Y + 180,310,35,"",false) guiLabelSetColor(lbl_reg_top_info,255,234,55) guiLabelSetVerticalAlign(lbl_reg_top_info,"center") guiLabelSetHorizontalAlign(lbl_reg_top_info,"center",false) guiSetFont(lbl_reg_top_info,"default-bold-small") guiSetVisible(lbl_reg_top_info,false) edit_account_name = guiCreateEdit(X + 20,Y + 215,310,35,"",false) edit_account_name_l = guiCreateLabel(X + 20,Y + 195,310,35,"Account Name",false) guiEditSetMaxLength ( edit_account_name,25) guiSetVisible(edit_account_name,false) guiSetVisible(edit_account_name_l,false) addEventHandler("onClientGUIChanged", edit_account_name, resetRegButtons) edit__reg_tab_password = guiCreateEdit(X + 20,Y + 290,310,35,"",false) edit__reg_tab_password_l = guiCreateLabel(X + 20,Y + 270,310,35,"Password",false) guiEditSetMaxLength ( edit__reg_tab_password,25) guiEditSetMasked ( edit__reg_tab_password, true ) guiSetProperty(edit__reg_tab_password, 'MaskCodepoint', '8226') guiSetVisible(edit__reg_tab_password,false) guiSetVisible(edit__reg_tab_password_l,false) addEventHandler("onClientGUIChanged", edit__reg_tab_password, resetRegButtons) edit__reg_tab_Repassword = guiCreateEdit(X + 20,Y + 365,310,35,"",false) edit__reg_tab_Repassword_l = guiCreateLabel(X + 20,Y + 345,310,35,"Confirm Password",false) guiEditSetMaxLength ( edit__reg_tab_Repassword,25) guiEditSetMasked ( edit__reg_tab_Repassword, true ) guiSetProperty(edit__reg_tab_Repassword, 'MaskCodepoint', '8226') guiSetVisible(edit__reg_tab_Repassword,false) guiSetVisible(edit__reg_tab_Repassword_l,false) guiSetEnabled (edit__reg_tab_Repassword, true) edit__reg_tab_email = guiCreateEdit(X + 20,Y + 435,310,35,"",false) edit__reg_tab_email_l = guiCreateLabel(X + 20,Y + 415,310,35,"Email",false) guiEditSetMaxLength ( edit__reg_tab_email,100) guiSetVisible(edit__reg_tab_email,false) guiSetVisible(edit__reg_tab_email_l,false) guiSetEnabled (edit__reg_tab_email, true) shRegister2 = guiCreateButton ( X + 182, Y + 401+6+offsetY, 143, 45, "Submit", false ) guiSetVisible(shRegister2,false) shCancel = guiCreateButton ( X + 23, Y + 401+6+offsetY, 143, 45, "Back", false ) guiSetVisible(shCancel,false) showCursor(true) guiSetText(login_tab_error_msg, "") guiSetText(login_tab_authen_msg, "") end addEventHandler("onClientPlayerJoin", getRootElement(), loadLoginPanel)
  23. I changed it to onPlayerJoin but now when I reconnect it's just a plain black screen.
  24. I tried debugscript but for some reason it's not appearing in the bottom of my screen. login: You successfully logged in debugscript058; Your debug mode was set to 3
×
×
  • Create New...