StefanAlmighty
Members-
Posts
143 -
Joined
-
Last visited
Everything posted by StefanAlmighty
-
Hi, I've created a login panel GUI but for some reason it just wont appear on your screen after you type /lp. Code: function loadLoginPanel() -- config stuff 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 addCommandHandler("lp", loadLoginPanel)
-
Hi, so I've created a very basic script which loads text into a GUI Memo from XML. I'm working on making it so in-game admins are able to edit the text in-game and make it save back to the XML. However my issue is the following: Everything works, except when the resource is restarted, the XML loads the old text and not what has been edited before the restart. I'm assuming it's not saving properly to the XML file. Here is my code which saves it: local function updateContent(theTab) xmlFile, theText = nil, nil if theTab == tabRules then xmlFile = xmlLoadFile( "rules.xml" ) theText = guiGetText(memoRules) elseif theTab == tabAdmins then xmlFile = xmlLoadFile("admins.xml") theText = guiGetText(memoAdmins) elseif theTab == tabScripts then xmlFile = xmlLoadFile("scripts.xml") theText = guiGetText(memoScripts) else outputChatBox("Error 02") return false end xmlNodeSetValue(xmlFile, theText) xmlSaveFile(xmlFile) --Save the xml from memory for use next time xmlUnloadFile(xmlFile) --Unload the xml from memory outputChatBox("Saved.") end addEventHandler ("onClientGUIClick", root, function () if source == buttonRules then updateContent(tabRules) elseif source == buttonAdmins then updateContent(tabAdmins) elseif source == buttonScripts then updateContent(tabScripts) end end) function ClientResourceStop () xmlSaveFile(xmlFile) --Save the xml from memory for use next time xmlUnloadFile(xmlFile) --Unload the xml from memory end addEventHandler ("onClientResourceStop", resourceRoot, ClientResourceStop )
-
What about if I added my other ranks? function isPlayerAdmin(player) if not player or not isElement(player) or not getElementType(player) == "player" then return false end return isPlayerJuniorAdmin(player) or isPlayerGeneralAdmin(player) or isPlayerSeniorAdmin(player) or isPlayerHeadAdmin(player) or isPlayerCommunityDirector(player) or isPlayerHelper(player) or isPlayerScripter(player) end getElementData(player, "scripter_rank") getElementData(player, "helper_rank")
-
I have several admin ranks saved to a database and I have seperate functions for recognizing each admin rank. But now, I need a function which recognizes all admin ranks. Here is that function: function isPlayerAdmin(player) if not player or not isElement(player) or not getElementType(player) == "player" then return false end return isPlayerJuniorAdmin(player) or isPlayerGeneralAdmin(player) or isPlayerSeniorAdmin(player) or isPlayerHeadAdmin(player) or isPlayerCommunityDirector(player) end My issue is, it doesn't recognize the final "isPlayerCommunityDirector(player)" when using it in commands. For example I have an admin chat (/a) which uses "exports.chat:isPlayerAdmin(source)". It works for every admin except Community Directors, where it simply doesn't allow them to use the command. All of the others are able to use it. Here is the function, which works fine in any other scenario: function isPlayerCommunityDirector(player) if not player or not isElement(player) or not getElementType(player) == "player" then return false end local rank = getElementData(player, "admin_rank") or 0 return (rank >= 5) end
-
How can I broadcast a 'playSound' to everybody in the server? Is this possible & how can I accomplish this?
-
How can I disable an animation?
-
I've sorted it now, one more thing though. How do I disable a players animation?
-
It needs to be tables, so is there a way? SQL won't help me here because I don't need to store data. The system is for a robbery system where players can rob a house, and items are randomly generated into the table.
-
For every house on my server I want a separate table. So for example, if I wanted to access house with ID 2041 I'd use this houseTable[2041] = { } but I don't want to manually add all of those tables.
-
Hmm okay, do I have to manually add mainTable[1], mainTable[2]. I require like 2000+ plus of these.
-
Is it possible to nest table? eg; mainTable = { subTable1 = { innerTable1 = { } } subTable2 = { innerTable2 = { } } -- etc.. }
-
Is it possible to create a table using a function like table.create? I looked but I couldn't find anything of the sort, or is there any alternatives? I want a unique table per player who runs the script. Any help is appreciated.
-
Quick question for a future project I am working on: how can I create a loop which only loops 10 times? For example: local example = 0 for index, val in ipairs do example + 1 end So in theory, example would end at 10. How would I do this?
-
Is there a math function for adding, subtracting & dividing? local upperbound = valc[5]/2+valc[5] -- halves and adds on to original local lowerbound = valc[5]/2-valc[5] -- halves and subtracts from original This, for me gives off a lot of random numbers. In my scenario, it loops through a table. for indexc, valc in ipairs (data) do local upperbound = valc[5]/2+valc[5] -- halves and adds on to original local lowerbound = valc[5]/2-valc[5] -- halves and removes from original valc[6] = math.random(lowerbound, upperbound) end But when I load the GUI in-game, the numbers are completely random. They range from like -300 to 600 and they shouldn't. It seems to be an issue with the sum?
-
Fixed, thank you very much.
-
Okay so when I try to trigger this client side: triggerServerEvent("unlockTheProperty", resourceRoot, theProperty, thePlayer) I get this issue in the console: ERROR: Client (Stefan) triggered serverside event unlockTheProperty, but event is not added serverside Serverside: addEvent ("unlockTheInterior",true) addEventHandler ("unlockTheInterior",root, function (targetProperty, targetPlayer) outputChatBox("To be continued..") end) And yes, the both the server and client scripts are added in meta.xml
-
LSC-RP.com mtasa://51.254.117.45:22003 Realistic Economy Despite just opening, our administration team are dedicated to ensure the server remains as fair as possible which includes ensuring the economy is fair with realistic prices. We have dozens of ways of making money on our server, including trucking, fishing and lots more! Grab a sandwich from the local 24-7 and fill your hunger! Factions Dozens of factions include the Los Santos Police Department who enforce law in the city or perhaps you prefer the medical side of things? We have legal factions such as Los Santos Express, Sunset Corporation or even the Bank of Los Santos! Create your own company, organisation or gang by developing your ideas with your friends! Vehicles We have hundreds of unique vehicles with realistic models, such as BMW or Lamborghini. Every single vehicle has unique handling. Multiple dealerships span Los Santos, or contact a private dealer to purchase an imported vehicle! Businesses & properties Thousands of businesses and properties located across Los Santos which are available to buy. Create your own business, hire a shopkeeper and sell goods ranging from Snooker tables to clothes! You can purchase your own house and store anything you want inside!
-
How can I set the camera directly behind a player? So when the player teleports, the camera is adjusted directly behind them.
-
Alright, that fixed it. When I restart the resource, any teleports added will be removed so how do I save teleports via XML?
-
That didn't seem to fix it, any other issues with my code?
-
Okay so I've been working on a teleport GUI and it works fine, but I'm at the stage of adding teleports to a table whilst in-game. For some reason, it's not working. My table: local data = { -- X Y Z Int Dim Rot [1] = {"1", "Los Santos", "Pershing Square", 1479.9873046875, -1710.9453125, 13.36874961853, 0, 0, 0}, [2] = {"2", "San Fierro", "Doherty", -1988.5693359375, 507.0029296875, 35.171875, 0, 0, 90}, [3] = {"3", "Las Venturas", "Las Venturas Airport", 1691.6801757813, 1449.1293945313, 10.765375, 0, 0, 268}, } The function I made which adds a teleport to this table: addEvent ("addTeleport",true) addEventHandler ("addTeleport",root, function (tpname, tpdesc) local x, y, z = getElementPosition(source) local rx, ry, rz = getElementRotation(source) -- fetch all the necessary info for the teleport local int = getElementInterior(source) local dim = getElementDimension(source) local nextindex = findNextTeleportID() local nextindexs = tostring(nextindex) table.insert(data, [nextindex] = {nextindexs, tpname, tpdesc, x, y, z, int, dim, rz}) end) The function which finds the next available ID in the table: function findNextTeleportID() for index, val in ipairs (data) do local finalnum = 0 finalnum + 1 end return finalnum + 1 end Any help is appreciated, thanks.
-
Thanks.
-
Quick question. How can I convert an integer value to a string? For example: k = math.random(1,100) I want to convert k from an integer into a string. So if the value k is 41, then I want to convert it to "41". Appreciated, thanks.
-
Sent it again. Also, everything is working anyway, it's just the code to insert a row to the data table.
