Jump to content

XeroXipher

Members
  • Posts

    19
  • Joined

  • Last visited

Everything posted by XeroXipher

  1. Hey guys... I've been getting help with things in MTA SA. I have 3 major questions... 1) I am thinking of making a Community Resource to spread Good Karma from all the help I am getting. Would people use a Community Resource from 2025? 2)In 2025 (by hosting the server not selling it), is there any profit in being a Server Host? 3)If I can make a profit how should I go about generating an income? (QUESTION 1 IS ASKING IF IM WASTING MY TIME MAKING A COMMUNITY RESOURCE AND QUESTIONS 2 AND 3 ARE QUESTIONS ABOUT MY SERVER)
  2. Hey guys... I post for help almost everyday and I do feel bad about that... I want to be able to stand on my feet and hopefully after I figure this out I'll be able to focus on things I'm good at. I downloaded this resource on the MTA SA Community (Resources). It is a Square Minimap (Radar) and F11 Full Screen Map. These are pictures of my Server based around the Map so far: Picture of MTA SA with Minimap (Radar) Picture of MTA SA with F11 Map (Full Size Map) I did manage to get the ShowCursor() function to work and it works well, but to move Left (Press Left Button) Right (Press Right Button) Up (Press Up Button) Down (Press Down Button) I need to actually use the Buttons and can't use the Mouse. ZoomIn is (num_add) ZoomOut is (num_sub) I tried to add a keybind for ZoomIn/ZoomOut but it didn't work... Can someone show me how to Keybind a Function within the F11 Map (Like Zoom In / Out, Grab Map with Mouse and Move it) This is my code so far: --[[---------------------------------------------------- -- client script main -- @author Banex -- @update 24/03/2016 ----------------------------------------------------]]-- function onClientResourceStart() map = Map.new():init() map:setBounds(x*30,y*30,x*1306,y*708) map:setAlpha(200) radar = Map.new():init() radar:setBounds(x*20, y*560, x*281, y*193) radar:setStyle(2) radar:setAlpha(200) radar:setBlipSize(x*24) radar:setVisible(true) map.Switch = function() toggleCursor() mapKeys() map:setVisible(not map:isVisible()) radar:setVisible(not map:isVisible()) showChat(not map:isVisible()) end bindKey('F11', 'down', map.Switch) setPlayerHudComponentVisible("radar",false) toggleControl("radar",false) end function toggleCursor() local cursorState = isCursorShowing() -- Retrieve the state of the player's cursor local cursorStateOpposite = not cursorState -- The logical opposite of the cursor state showCursor(cursorStateOpposite) -- Setting the new cursor state end function mapKeys() bindKey("mouse_wheel_up", "down", radar_zoom_in) --This doesn't work bindKey("mouse_wheel_down", "down", radar_zoom_out) --And This doesn't work end addEventHandler("onClientResourceStart",resourceRoot,onClientResourceStart) function onClientResourceStop() setPlayerHudComponentVisible("radar",true) toggleControl("radar",true) end addEventHandler("onClientResourceStop",resourceRoot,onClientResourceStop) I'll stop blowing up this forum after this question has been resolved
  3. Hello GTA Scripters... I don't like the fact that I am asking a new question everyday that passes but I've tried to resolve this problem and I have had no luck (I did come close though) When I press F11 to open Radar-Map, I can't drag or zoomin with my mouse because the map is in front of me but the Games Controls are still focused on the Player Camer. I have tried to setCameraMatrix(Player, a, b, c, d, e, f) AND setElementFrozen(the Player, true) This froze my Player and Camera which is what I wanted but I still couldn't zoom in or scroll the map with my mouse... I feel like an amateur because it is almost the default setup on the MTA Servers to have a Map you can zoom in or add a waypoint to. I can figure out how to zoom in / out on the map, my question right now is, how do I freeze camera when in Menu's (like a Custom Menu on F2) or Radar Map on F11?
  4. Okay, 2 things, first of all the problem had come back but I uninstalled and reinstalled MTA SA and I have been running the game for several hours without a crash... But how do I render the HUD without onClientRender()? I am willing to adept to a better way.
  5. RESOLVED In the past I have used different languages that ignored whitespace in code... I guess MTA SA runs through the whitespace and I think that's where the memory leak was... I deleted all whitespace (Sometimes I find it easier to read code if there are linebreaks in the code) but I deleted these linebreaks and the client doesn't Freeze/Crasha anymore.
  6. Hey, sorry, I didn't know if you would get my last post because it was flagged... I don't know how to fix a Memory Sink but I do believe that it what it is... This is: HUD.lua local sx,sy = guiGetScreenSize() local px,py = 1600,900 local x,y = (sx/px), (sy/py) function HUDDrawing() local playerHealth = getElementHealth ( getLocalPlayer() ) local playerArmor = getPedArmor ( getLocalPlayer() ) local playerMoney = getPlayerMoney( getLocalPlayer() ) local time = getRealTime() local hours = time.hour local minutes = time.minute local seconds = time.second local monthday = time.monthday local month = time.month local year = time.year local formattedTime = string.format("%04d-%02d-%02d %02d:%02d", year + 1900, month + 1, monthday, hours, minutes) local Inventory = dxCreateTexture("Inventory.png") dxDrawRectangle(x*1085,y*0,x*1490,y*160, tocolor( 46, 46, 42, 150 )) -- Create our black transparent MOTD background Rectangle. dxDrawRectangle(x*1265,y*0,x*1368,y*36, tocolor( 120, 120, 120, 180), true) dxDrawRectangle(x*1265,y*0,x*1368/400*playerHealth ,y*36, tocolor( 169, 48, 48, 200), true) dxDrawText(" Health: "..math.floor(tonumber(playerHealth)).."%", x*1265, y*0, x*1365, y*36, tocolor(255, 255, 255, 255), 1.10, "default-bold", "center", "center", false, false, true, false, false) dxDrawRectangle(x*1265, y*36, x*1368, y*36, tocolor(120, 120, 120, 180), true) dxDrawRectangle(x*1265, y*36, x*1368/400*playerArmor, y*36, tocolor(24, 60, 176, 200), true) dxDrawText(" Armor: "..math.floor(tonumber(playerArmor)).."%", x*1265, y*36, x*1365, y*74, tocolor(255, 255, 255, 255), 1.10, "default-bold", "center", "center", false, false, true, false, false) dxDrawText(" $"..math.floor(tonumber(playerMoney)).."", x*1300, y*72, x*1268, y*114, tocolor(255, 255, 255, 255), 1.10, "pricedown", "center", "center", false, false, true, false, false) dxDrawRectangle(x*1265,y*72,x*1368, y*36, tocolor( 115, 210, 90, 200), true) dxDrawText("Local Time: "..formattedTime.."", x*1480, y*112, x*1368, y*135, tocolor(255,255,255,255), 0.50, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText("Virox Roleplay", x*9, y*880, x*246, y*890, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, true, false, false) -- Your Text Bottom Left end -- attach the event handler to the root element of the resouce -- this means it will only trigger when its own resource is started function moveHUDComponent() setPlayerHudComponentVisible( "weapon", true ) setPlayerHudComponentVisible( "ammo", true ) setPlayerHudComponentProperty("weapon", "position", 950, 0) setPlayerHudComponentProperty("ammo", "position", 1000, 100) end addEventHandler("onClientResourceStart", resourceRoot, moveHUDComponent) addEventHandler("onClientRender", root, HUDDrawing) meta.xml <meta> <script src="HUD.lua" tpye="client" /> </meta> (I am going to delete my previous post, it got flagged, I think for Directly responding to you rather than quoting you.)
  7. Is it proper practice to QUOTE previous replies? I pinged the Moderator that responded to my post and I got a Hidden RedBox from my post which needs to be approved by Moderators... I didn't abuse anything so I don't know if it was my (@) comment or if it was just a safety precaution.
  8. Hey @IIYAMA, this is my coding around the area: HUD.lua local sx,sy = guiGetScreenSize() local px,py = 1600,900 local x,y = (sx/px), (sy/py) function HUDDrawing() local playerHealth = getElementHealth ( getLocalPlayer() ) local playerArmor = getPedArmor ( getLocalPlayer() ) local playerMoney = getPlayerMoney( getLocalPlayer() ) local time = getRealTime() local hours = time.hour local minutes = time.minute local seconds = time.second local monthday = time.monthday local month = time.month local year = time.year local formattedTime = string.format("%04d-%02d-%02d %02d:%02d", year + 1900, month + 1, monthday, hours, minutes) local Inventory = dxCreateTexture("Inventory.png") dxDrawRectangle(x*1085,y*0,x*1490,y*160, tocolor( 46, 46, 42, 150 )) -- Create our black transparent MOTD background Rectangle. dxDrawRectangle(x*1265,y*0,x*1368,y*36, tocolor( 120, 120, 120, 180), true) dxDrawRectangle(x*1265,y*0,x*1368/400*playerHealth ,y*36, tocolor( 169, 48, 48, 200), true) dxDrawText(" Health: "..math.floor(tonumber(playerHealth)).."%", x*1265, y*0, x*1365, y*36, tocolor(255, 255, 255, 255), 1.10, "default-bold", "center", "center", false, false, true, false, false) dxDrawRectangle(x*1265, y*36, x*1368, y*36, tocolor(120, 120, 120, 180), true) dxDrawRectangle(x*1265, y*36, x*1368/400*playerArmor, y*36, tocolor(24, 60, 176, 200), true) dxDrawText(" Armor: "..math.floor(tonumber(playerArmor)).."%", x*1265, y*36, x*1365, y*74, tocolor(255, 255, 255, 255), 1.10, "default-bold", "center", "center", false, false, true, false, false) dxDrawText(" $"..math.floor(tonumber(playerMoney)).."", x*1300, y*72, x*1268, y*114, tocolor(255, 255, 255, 255), 1.10, "pricedown", "center", "center", false, false, true, false, false) dxDrawRectangle(x*1265,y*72,x*1368, y*36, tocolor( 115, 210, 90, 200), true) dxDrawText("Local Time: "..formattedTime.."", x*1480, y*112, x*1368, y*135, tocolor(255,255,255,255), 0.50, "bankgothic", "center", "center", false, false, true, false, false) dxDrawText("Virox Roleplay", x*9, y*880, x*246, y*890, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, true, false, false) -- Your Text Bottom Left end -- attach the event handler to the root element of the resouce -- this means it will only trigger when its own resource is started function moveHUDComponent() setPlayerHudComponentVisible( "weapon", true ) setPlayerHudComponentVisible( "ammo", true ) setPlayerHudComponentProperty("weapon", "position", 950, 0) setPlayerHudComponentProperty("ammo", "position", 1000, 100) end addEventHandler("onClientResourceStart", resourceRoot, moveHUDComponent) addEventHandler("onClientRender", root, HUDDrawing) meta.xml <meta> <script src = "HUD.lua" type = "client" /> </meta>
  9. Hey guys... I spent the whole day removing the built in GTA SA Hud and rebuilding my own Hud with Health, Armor, Money, Weapon and Time. I used dxDrawRect for the bars and dxDrawText for the Text. I love what it looks like now, but tonight I noticed it will only run for about 15 minutes then freeze and eventually crash. I used: addEventHandler("onClientRender", root, DrawHud) which works well... But as I was reading the Wiki I saw that onClientRender updates every frame so if your 60 or 90FPS it will redraw the Hud 60 to 90 times a second. I think that's why it is crashing. Is there a better way to use dxDrawRect and dxDrawText then onClientRender?
  10. I finally managed to get it working... In Resources you make a Folder for your GameMode for the Server... But when you seperate Admin_Commands or Vehicle_System, does this go in it's own Resource Folder or in a Folder of your original GameMode folder?
  11. I think that: addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() ViroxLoginWindow() -- if the GUI was successfully created, then show the GUI to the player if (ViroxLogin ~= nil) then guiSetVisible(ViroxLogin, true) outputChatBox("Welcome to Virox Roleplay v.0.001, please log in.") else -- if the GUI hasn't been properly created, tell the player outputChatBox("An unexpected error has occurred and the login GUI has not been created.") end ^THIS^ (guiSetVisible) isn't being called and I don't know why... I partly think it is because of how I am using meta.xml I used the above meta.xml in the root of the Resource but I don't know if every new folder gets it's own meta.xml or if I declare it all in the Root.
  12. Hey guys... I followed the Example of how to make a Login Panel on the Wiki... I literally did it word for word and when I loaded the server just got a black screen.... I downloaded to Login Systems in Community Files and used them and they both worked... So I edited the one I liked and used it in my Resource and once again got a black screen... My FILE STRUCTURE is: -client -gui.lua -assets -ViroxRP.png -server.lua -meta.xml My gui.lua is this: function ViroxLoginWindow() -- define the X and Y positions of the window local X = 0.375 local Y = 0.375 -- define the width and height of the window local Width = 0.25 local Height = 0.25 -- create the window and save its element value into the variable 'wdwLogin' -- click on the function's name to read its documentation ViroxLogin = guiCreateStaticImage(X,Y,W,H,"assets/ViroxRP.png", true) -- define new X and Y positions for the first label X = 0.0825 Y = 0.2 -- define new Width and Height values for the first label Width = 0.25 Height = 0.25 -- create the first label, note the final argument passed is 'wdwLogin' meaning the window -- we created above is the parent of this label (so all the position and size values are now relative to the position of that window) User = guiCreateLabel(X, Y, Width, Height, "Username", true, ViroxLogin) -- alter the Y value, so the second label is slightly below the first Y = 0.5 Pass = guiCreateLabel(X, Y, Width, Height, "Password", true, ViroxLogin) X = 0.415 Y = 0.2 Width = 0.5 Height = 0.15 UsernameEditBox = guiCreateEdit(X, Y, Width, Height, "", true, ViroxLogin) Y = 0.5 PasswordEditBox = guiCreateEdit(X, Y, Width, Height, "", true, ViroxLogin) -- set the maximum character length for the username and password fields to 50 guiEditSetMaxLength(edtUser, 50) guiEditSetMaxLength(edtPass, 50) X = 0.415 Y = 0.7 Width = 0.25 Height = 0.2 btnLogin = guiCreateButton(X, Y, Width, Height, "Log In", true, ViroxLogin) -- make the invisible guiSetVisible(ViroxLogin, false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() ViroxLoginWindow() -- if the GUI was successfully created, then show the GUI to the player if (ViroxLogin ~= nil) then guiSetVisible(ViroxLogin, true) outputChatBox("Welcome to Virox Roleplay v.0.001, please log in.") else -- if the GUI hasn't been properly created, tell the player outputChatBox("An unexpected error has occurred and the login GUI has not been created.") end -- enable the player's cursor (so they can select and click on the components) showCursor(true) -- set the input focus onto the GUI, allowing players (for example) to press 'T' without the chatbox opening guiSetInputEnabled(true) end addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false) ) function clientSubmitLogin(button,state) if button == "left" and state == "up" then -- get the text entered in the 'username' field local username = guiGetText(UsernameEditBox) -- get the text entered in the 'password' field local password = guiGetText(PasswordEditBox) -- if the username and password both exist if username and username ~= "" and password and password ~= "" then -- trigger the server event 'submitLogin' and pass the username and password to it triggerServerEvent("submitLogin", getRootElement(), username, password) -- hide the gui, hide the cursor and return control to the player guiSetInputEnabled(false) guiSetVisible(ViroxLogin, false) showCursor(false) else -- otherwise, output a message to the player, do not trigger the server -- and do not hide the gui outputChatBox("Please enter a username and password.") end end end And my meta.xml is: <meta> <info author="KryptonicJaze" type="gamemode" name="ViroxRP" description="RP Server in Developement" /> <script src="server.lua" type="server" /> <script src="client/gui.lua" type="client" /> <file src="assets/ViroxRP.png" /> </meta> Can someone help me and figure out what I am doing wrong?
  13. Honestly, I am still learning and up until now I have only worked with server sided scripts but I'll try it out as a client script. Thanks for the advice.
  14. Hello MTA... Sorry for asking rookie questions so frequently. So, I am trying to make NPC's on the map walk around. I know I will have to give them a path to walk (Which I don't know how to do, but I'll get there). Right now I am finding it hard to get my NPC to even move. This is the very basic coding I have so far. Pedestrians.lua function pedLoad() local thePed = createPed ( 106, 2492, -1673, 13.25, 200) setPedAnimation(thePed, "ped", "walk_gang1", -1, true, true, false, true) outputChatBox("This command did something", player, 100, 255, 100) end addEventHandler ( "onResourceStart", getResourceRootElement(), pedLoad ) Now this works properly: local thePed = createPed ( 106, 2492, -1673, 13.25, 200) It creates my NPC and rotates him 200 degrees... But the rest of the coding doesn't do anything. I have tried setControlState: function pedLoad() local thePed = createPed ( 106, 2492, -1673, 13.25, 200) setControlState(thePed, "walk", true) setControlState(thePed, "forwards", true) outputChatBox("This command did something", player, 100, 255, 100) end addEventHandler ( "onResourceStart", getResourceRootElement(), pedLoad ) And nothing happened... I know with setControlState I also have to change his camera to move in different directions but I can't get him to move at all... So, if someone could help me I would appreciate it. Thank You.
  15. Hello MTA... I'm a lurker and I am pretty sure this is my first post on this server : / So, I am making an RP MTA SA Server, and I am only doing this as a hobby. I know you can add Green Housing Icons and Blue Housing Icons to the Map in Map Editor, and I know you can use createObject(id, x, y, z) in the lua coding (I plan on using lua coding for this)... But how do I populate the entire map with Green/Blue Housing Icons? To Buy or Rent Property? I'm sure there are many people that have done this manually, but their must be a resource that has all the housing locations open source? I tried to download open source MTA Servers to get the Map but I don't know how to go about loading the map. So, my question is, is their an Easy way to script all the Houses/Properties in the Game without going from 1 house to the next and collecting coords? This is probably a really dumb question, I just had to ask.
×
×
  • Create New...