Jump to content

ShayF2

Members
  • Posts

    230
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by ShayF2

  1. I want to start developing modules to change the way mta sa runs. I basically want to make a ragdoll module for pedestrians and players. To do this I would need the ml_base.so file, or the ml_devkit, whatever is used to make your own modules. I cannot seem to download this because the download is blocked because of stupid certificates. I'm wondering if anyone could give me a copy of the module development kit. If you would, I'd greatly appreciate it.
  2. I want to use a script to make a custom help.xml file that updates everytime a setting is changed, and settings can only change when the script restarts so it makes it perfect. Settings are within the lua file as variables. I also have a setting in the lua file which determines whether or not to even have a help.xml file. For some reason I couldn't get this to work. I basically wanted to open and then modify the meta.xml to put the help.xml in it when the setting is set to 'true' and then when it is false I wanted to remove that help.xml from the meta.xml. Unfortunately, files will not create, files will not be read, files will not be written, and no errors or warnings are produced. My friend suggested that I use xml functions to do this, but they are not for what I want to do. They are for saving data, not setting/replacing text in a file. I would like some help on this part of my project, in an attempt to get it functional. I will post the current code below. function makeHelpFile() local meta = 'meta.xml' local directory = 'help.xml' if not fileExists(directory) then local file = fileCreate(directory) fileClose(file) end local helpFile = fileOpen(directory) local helpSize = fileGetSize(helpFile) local helpBuffer = fileRead(helpFile,helpSize) local metaFile = fileOpen(meta) local metaSize = fileGetSize(metaFile) local metaBuffer = fileRead(metaFile,metaSize) if string.find(metaBuffer,'</meta>',1,true) then local text = string.gsub(metaBuffer,'</meta>','<config src="help.xml" type="client"/>\n</meta>') fileWrite(metaFile,text) fileClose(metaFile) end end
  3. dxDrawCircle is not an MTA function I do not believe, so the code they give you is code that you need in your script, if you have not already added it, then you call that function. I've made a progress bar before only with rectangles instead of circles. I'm not quite sure how you would work it with a circle but with rectangles, I drew a rectangle with a lower alpha and then used a count system so that each time the screen rendered a frame the progress went up 0.5% This moved the second bar with a higher alpha, over top of the bar with a lower alpha, making it look like a progress bar. Although I'm sure you could make a 'real' progress bar by getting the load progress and then dividing it by 100 or using it as is, and just keep updating that second rectangle. Again as I said before, I've done this with rectangles, not circles, I'm not sure if this will be helpful or not. Good luck. I have just checked the script for dxDrawCircle, you can indeed set the angle of the circle. I advise you to make a default first angle and then set the second angle to the progress, note that this needs to be a 0-360 value, so if your using progress 0-100% you'll need to multiply your progress by 3.6. It will look like this startAngle+(progress*3.6) = endAngle heres a check for it to reset if need be, or stop at the correct place. if endAngle > 360 then endAngle = 0 end and if you want to draw the percent that the angle is at you can use endAngle/360 = circlePercent. I believe this is how it should work. Again I wish you the best of luck.
  4. ShayF2

    DX Login

    I'm trying to make a DX Login system for my server. I ran into a snag. Only the username button for the login line changes color when you hover your mouse, but it only changes color when you hover over the register button. I'm new to client side scripting, I'm asking for help with this script. local x,y = guiGetScreenSize() local r = {} local g = {} local b = {} local a = {} local range = {} function isMouseWithinRangeOf(psx,pssx,psy,pssy) if not isCursorShowing() then return false end local cx,cy = getCursorPosition() cx,cy = cx*x,cy*y if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then return true,cx,cy else return false end end addEventHandler("onClientRender",root,function() showCursor(true) window = dxDrawRectangle(0,0,x,y,tocolor(0,0,0,255),false) mainText = dxDrawText("Welcome!\nPlease Login or Register",x*0.1603,y*0.0729,x*0.8338,y*0.1940,tocolor(255,255,255,255),1.30,"pricedown","center","center",false,false,false,false,false) if not r['loginUsernameBox'] then r['loginUsernameBox'] = 255 end if not g['loginUsernameBox'] then g['loginUsernameBox'] = 255 end if not b['loginUsernameBox'] then b['loginUsernameBox'] = 255 end if not a['loginUsernameBox'] then a['loginUsernameBox'] = 255 end loginUsernameBox = dxDrawRectangle(x*0.1676,y*0.2760,x*0.1735,y*0.0573,tocolor(r['loginUsernameBox'],g['loginUsernameBox'],b['loginUsernameBox'],a['loginUsernameBox']),false) range['loginUsernameBox'] = {isMouseWithinRangeOf(x*0.1676,x*0.1735,y*0.2760,y*0.3359),'loginUsernameBox'} loginUsernameText = dxDrawText("Username",x*0.1676,y*0.2760,x*0.3412,y*0.3359,tocolor(0,0,0,254),1.10,"default-bold","center","center",false,false,false,false,false) if not r['loginPasswordBox'] then r['loginPasswordBox'] = 255 end if not g['loginPasswordBox'] then g['loginPasswordBox'] = 255 end if not b['loginPasswordBox'] then b['loginPasswordBox'] = 255 end if not a['loginPasswordBox'] then a['loginPasswordBox'] = 255 end loginPasswordBox = dxDrawRectangle(x*0.3603,y*0.2760,x*0.1735,y*0.0573,tocolor(r['loginPasswordBox'],g['loginPasswordBox'],b['loginPasswordBox'],a['loginPasswordBox']),false) range['loginPasswordBox'] = {isMouseWithinRangeOf(x*0.3603,x*0.1735,y*0.2760,y*0.0573),'loginPasswordBox'} loginPasswordText = dxDrawText("Password",x*0.3603,y*0.2760,x*0.5338,y*0.3359,tocolor(0,0,0,254),1.10,"default-bold","center","center",false,false,false,false,false) if not r['loginBox'] then r['loginBox'] = 255 end if not g['loginBox'] then g['loginBox'] = 255 end if not b['loginBox'] then b['loginBox'] = 255 end if not a['loginBox'] then a['loginBox'] = 255 end loginBox = dxDrawRectangle(x*0.6257,y*0.2760,x*0.1735,y*0.0573,tocolor(r['loginBox'],g['loginBox'],b['loginBox'],a['loginBox']),false) range['loginBox'] = {isMouseWithinRangeOf(x*0.6257,x*0.1735,y*0.2760,y*0.0573),'loginBox'} loginText = dxDrawText("Login",x*0.6257,y*0.2760,x*0.7993,y*0.3359,tocolor(0,0,0,254),1.10,"default-bold","center","center",false,false,false,false,false) if not r['registerUsernameBox'] then r['registerUsernameBox'] = 255 end if not g['registerUsernameBox'] then g['registerUsernameBox'] = 255 end if not b['registerUsernameBox'] then b['registerUsernameBox'] = 255 end if not a['registerUsernameBox'] then a['registerUsernameBox'] = 255 end registerUsernameBox = dxDrawRectangle(x*0.1676,y*0.4245,x*0.1735,y*0.0573,tocolor(r['registerUsernameBox'],g['registerUsernameBox'],b['registerUsernameBox'],a['registerUsernameBox']),false) range['registerUsernameBox'] = {isMouseWithinRangeOf(x*0.1676,x*0.1735,y*0.4245,y*0.0573),'registerUsernameBox'} registerUsernameText = dxDrawText("Username",x*0.1676,y*0.4245,x*0.3412,y*0.4844,tocolor(0,0,0,254),1.10,"default-bold","center","center",false,false,false,false,false) if not r['registerEmailBox'] then r['registerEmailBox'] = 255 end if not g['registerEmailBox'] then g['registerEmailBox'] = 255 end if not b['registerEmailBox'] then b['registerEmailBox'] = 255 end if not a['registerEmailBox'] then a['registerEmailBox'] = 255 end registerEmailBox = dxDrawRectangle(x*0.1676,y*0.4974,x*0.1735,y*0.0573,tocolor(r['registerEmailBox'],g['registerEmailBox'],b['registerEmailBox'],a['registerEmailBox']),false) range['registerEmailBox'] = {isMouseWithinRangeOf(x*0.1676,x*0.1735,y*0.4974,y*0.0573),'registerEmailBox'} registerEmailText = dxDrawText("Email",x*0.1676,y*0.4974,x*0.3412,y*0.5573,tocolor(0,0,0,254),1.10,"default-bold","center","center",false,false,false,false,false) if not r['registerPasswordBox'] then r['registerPasswordBox'] = 255 end if not g['registerPasswordBox'] then g['registerPasswordBox'] = 255 end if not b['registerPasswordBox'] then b['registerPasswordBox'] = 255 end if not a['registerPasswordBox'] then a['registerPasswordBox'] = 255 end registerPasswordBox = dxDrawRectangle(x*0.3603,y*0.4245,x*0.1735,y*0.0573,tocolor(r['registerPasswordBox'],g['registerPasswordBox'],b['registerPasswordBox'],a['registerPasswordBox']),false) range['registerPasswordBox'] = {isMouseWithinRangeOf(x*0.3603,x*0.1735,y*0.4245,y*0.0573),'registerPasswordBox'} registerPasswordText = dxDrawText("Password",x*0.3603,y*0.4245,x*0.5338,y*0.4844,tocolor(0,0,0,254),1.10,"default-bold","center","center",false,false,false,false,false) if not r['registerRetypePasswordBox'] then r['registerRetypePasswordBox'] = 255 end if not g['registerRetypePasswordBox'] then g['registerRetypePasswordBox'] = 255 end if not b['registerRetypePasswordBox'] then b['registerRetypePasswordBox'] = 255 end if not a['registerRetypePasswordBox'] then a['registerRetypePasswordBox'] = 255 end registerRetypePasswordBox = dxDrawRectangle(x*0.3603,y*0.4974,x*0.1735,y*0.0573,tocolor(r['registerRetypePasswordBox'],g['registerRetypePasswordBox'],b['registerRetypePasswordBox'],a['registerRetypePasswordBox']),false) range['registerRetypePasswordBox'] = {isMouseWithinRangeOf(x*0.3603,x*0.1735,y*0.4974,y*0.0573),'registerRetypePasswordBox'} registerRetypePasswordText = dxDrawText("Repeat Password",x*0.3603,y*0.4974,x*0.5338,y*0.5573,tocolor(0,0,0,254),1.10,"default-bold","center","center",false,false,false,false,false) if not r['registerBox'] then r['registerBox'] = 255 end if not g['registerBox'] then g['registerBox'] = 255 end if not b['registerBox'] then b['registerBox'] = 255 end if not a['registerBox'] then a['registerBox'] = 255 end registerBox = dxDrawRectangle(x*0.6257,y*0.4245,x*0.1735,y*0.0573,tocolor(r['registerBox'],g['registerBox'],b['registerBox'],a['registerBox']),false) range['registerBox'] = {isMouseWithinRangeOf(x*0.6257,x*0.1735,y*0.4245,y*0.0573),'registerBox'} registerText = dxDrawText("Register",x*0.6257,y*0.4245,x*0.7993,y*0.4844,tocolor(0,0,0,254),1.10,"default-bold","center","center",false,false,false,false,false) updatesBox = dxDrawRectangle(x*0.1676,y*0.5807,x*0.6588,y*0.3490,tocolor(255,255,255,255),false) updatesText = dxDrawText("Updates will be posted here!",x*0.1676,y*0.5807,x*0.8265,y*0.9297,tocolor(0,0,0,254),1.00,"default","left","top",false,false,false,false,false) rememberMeText = dxDrawText("Remember Me",x*0.6257,y*0.3490,x*0.7346,y*0.3841,tocolor(255,255,255,255),1.00,"default-bold","right","center",false,false,false,false,false) if not r['rememberMeOffBox'] then r['rememberMeOffBox'] = 255 end if not g['rememberMeOffBox'] then g['rememberMeOffBox'] = 255 end if not b['rememberMeOffBox'] then b['rememberMeOffBox'] = 255 end if not a['rememberMeOffBox'] then a['rememberMeOffBox'] = 255 end rememberMeOffBox = dxDrawRectangle(x*0.7706,y*0.3503,x*0.0272,y*0.0326,tocolor(r['rememberMeOffBox'],g['rememberMeOffBox'],b['rememberMeOffBox'],a['rememberMeOffBox']),false) range['rememberMeOffBox'] = {isMouseWithinRangeOf(x*0.7706,x*0.0272,y*0.3503,y*0.0326),'rememberMeOffBox'} rememberMeOffText = dxDrawText("Off",x*0.7706,y*0.3503,x*0.7993,y*0.3854,tocolor(0,0,0,254),1.00,"default-bold","center","center",false,false,false,false,false) if not r['rememberMeOnBox'] then r['rememberMeOnBox'] = 255 end if not g['rememberMeOnBox'] then g['rememberMeOnBox'] = 255 end if not b['rememberMeOnBox'] then b['rememberMeOnBox'] = 255 end if not a['rememberMeOnBox'] then a['rememberMeOnBox'] = 255 end rememberMeOnBox = dxDrawRectangle(x*0.7419,y*0.3503,x*0.0272,y*0.0326,tocolor(r['rememberMeOnBox'],g['rememberMeOnBox'],b['rememberMeOnBox'],a['rememberMeOnBox']),false) range['rememberMeOnBox'] = {isMouseWithinRangeOf(x*0.7419,x*0.0272,y*0.3503,y*0.0326),'rememberMeOnBox'} rememberMeOnText = dxDrawText("On",x*0.7419,y*0.3503,x*0.7706,y*0.3854,tocolor(0,0,0,254),1.00,"default-bold","center","center",false,false,false,false,false) end) links = { {loginUsernameText,loginUsernameBox,'loginUsernameBox'}, {loginPasswordText,loginPasswordBox,'loginPasswordBox'}, {loginText,loginBox,'loginBox'}, {registerUsernameText,registerUsernameBox,'registerUsernameBox'}, {registerEmailText,registerEmailBox,'registerEmailBox'}, {registerPasswordText,registerPasswordBox,'registerPasswordBox'}, {registerRetypePasswordText,registerRetypePasswordBox,'registerRetypePasswordBox'}, {registerText,registerBox,'registerBox'}, {rememberMeOffText,rememberMeOffBox,'rememberMeOffBox'}, {rememberMeOnText,rememberMeOnBox,'rememberMeOnBox'} } function getLink(text,box,generic) for i,v in pairs(links) do if v[1] == text or v[2] == box or v[3] == generic then return v[1],v[2],v[3] end end end addEventHandler('onClientRender',root,function() for i,v in pairs(range) do if v[1] == true then local text,box,generic = getLink(_,_,v[2]) if generic then r[generic] = 100 g[generic] = 100 b[generic] = 100 a[generic] = 255 end elseif v[1] == false then local text,box,generic = getLink(_,_,v[2]) if generic then r[generic] = 255 g[generic] = 255 b[generic] = 255 a[generic] = 255 end end end end)
  5. JF and I are not on good terms. The owner of JF, John Flower himself, has shared his scripts with me. John Flower and I seem to be pretty chill however, the players at that server have absolutely no respect for me. Terms were I leave them alone and they leave me alone. I suppose even now you'll hear bad things about me. /radio is FlowerSounds. /attach is FlowerAttach, and /mcreate is Offedit (Flower Remade). Those I credit towards John Flowers scripting team. I hope to have a clean server, expect more great scripts to come. I am myself working on an advanced house system, You'll be able to see updates on that since I posted a thread in the scripting forum here.
  6. I came from a place full of assholes and jerks, :Os and liars, cancer and disrespect. We all want some good gameplay. Which is why I made this server. I make at least 4 new scripts for the server every year, and they are usually quite large. Indeed these are good scripts, scripts you will probably never see in another server. I cannot afford advertising unfortunately, hence why I'm posting here. But I assure you that my server is very good, and I hope that you enjoy your time there! Website: Fencski's Freeroam Forums: Fencski's Freeroam Forums Server IP: mtasa://104.192.227.106:22158 Max Players: 60 Host Location: Chicaco, USA Email: Shay or Admin Phone: +1(920)-944-9678
  7. ShayF2

    Groups System

    And since it is not finished, it cannot be considered a resource.
  8. ShayF2

    Groups System

    It is a script, it contains Lua code. Therefor it belongs in the SCRIPTING topic..
  9. ShayF2

    Groups System

    "All Lua scripting topics related to Multi Theft Auto"
  10. ShayF2

    Groups System

    This is not a finished script. I'd like help on it, but making a post wouldn't matter because half the people on here look at them and then never reply. Would you mind telling me what this says?
  11. ShayF2

    Groups System

    Honestly, you guys are dicks. Like half this :~ doesn't even matter to you. If you wanna be that way then you shouldn't do it here. This is a place were people ask for help and show off what they got. That's commonly what this forum is used for. So I'll rebel, against forum rules, keep this post here.
  12. ShayF2

    Groups System

    I'm working on an advanced groups system, Here is a clip of what I already have done. I plan on adding a GUI in the future.
  13. ShayF2

    Sort table

    Use a local lua table first. Gather the data and store it in the table. data = {} for i,v in pairs(data) do i = i*-1 -- then send the data linked to the index from the table to the database. -- this will comepletely reverse your table, maybe what you are looking for. end This should reverse the tables index.
  14. Please send some help my way !
  15. I have debugged the script, I will re-type the script below including the debug messages and above I will paste what the output was. The meta's did not change so I will not repaste them. here are the debug messages in order. server.lua (phone) client.lua (phone) server.lua (motog3b) client.lua (motog3b) I also found that instead of the default phone being Moto G3 (Black) that it was Moto G3 (White), which was fixed, and still did not solve this.
  16. I'm currently working on an advanced house system, I will debug the script tomorrow, manually, since it doesn't produce any debug errors.
  17. I'm trying to make a phone script, where I can make a base script and then just keep releasing phones and updates for those phones. A script where people can download like, addons, and just plug them in and run them. I cannot get the phone to draw on the screen, I need help with this script. Note this is advanced MTA Lua code, professionals needed. Please help me with this. Code will be posted below with file names and resource names inside of spoilers. meta.xml (Phone) server.lua (Phone) client.lua (Phone) meta.xml (MotoG3B) server.lua (MotoG3B)
  18. Like the first one plays but the next one doesn't.
  19. I got the script to work. I debugged it (the hard way aka adding messages after every function) When some messages didn't show I knew what was wrong. It was not matching the index. I thought that the first index in a table was 0, but it's 1, I changed the default index as 1 and it started working. Thank you for helping. However I have a new problem. The next song wont start. Server.lua function addPublic(player,cmd,sound) if sound then triggerClientEvent("addSong",root,sound,player) outputChatBox(getPlayerName(player).." has just added "..sound.." to the playlist!",root,0,255,255) end end addCommandHandler("addsong",addPublic) Client.lua playlist = {} currentIndex = 1 enabled = false addEvent("addSong",true) addEventHandler("addSong",root,function(sound,player) if string.find(tostring(sound), "http://") == nil and string.find(tostring(sound), "https://") == nil then sound = string.format("http://%s",tostring(sound)) end table.insert(playlist,{song = sound,by = player}) if enabled == false then enabled = true playIt() end end) function playIt() for i,sounds in ipairs(playlist) do if i == currentIndex then if publicSound then destroyElement(publicSound) end publicSound = playSound(sounds.song,false) setSoundVolume(publicSound,1) outputChatBox("Now Playing: "..sounds.song.." added by: "..getPlayerName(sounds.by),0,255,255) timer1 = getSoundLength(publicSound) setTimer(playIt,timer1+1000,1) currentIndex = currentIndex+1 end end end addCommandHandler("vol",function(cmd,vol) local v = vol / 100 setSoundVolume(publicSound,v) outputChatBox("Public sound volume set to: "..tostring(vol).."%",0,255,255) end)
  20. I've never done this before, could you like write out an example or something to help?
  21. if you are casting the sound then use root, you don't need to loop the sound to every player. Simply replace the entire loop with local hardstylee = playSound("link") It will cast to everyone so long as you don't run it in an event where the player is defined, or run it in a command. Also using it in a gui will cast it to only the player opening the gui.
  22. I need some help with a sound system I am working on. I want to make a simple command based song playlist. Eventually I'll add pause features, stop and play and all that. Maybe even a gui, but for now I gotta get this working. Someone please help me get this working. Server.lua - local root = getRootElement() function addPublic(player,cmd,sound) if sound then if string.find(tostring(sound), "http://") == nil and string.find(tostring(sound), "https://") == nil then sound = string.format("http://%s",tostring(sound)) end triggerClientEvent("addSong",root,player,sound) outputChatBox(getPlayerName(player).." has just added "..sound.." to the playlist!",root,0,255,255) end end addCommandHandler("addsong",addPublic) Client.lua - local root = getRootElement() local localPlayer = getLocalPlayer() local playlist = {} local publicSound = playSound("http://test.mp3/",false) currentIndex = 0 addEvent("addSong",true) addEventHandler("addSong",root,function(player,theSound) table.insert(playlist,theSound) end) setTimer(function() if isSoundPaused(publicSound) then for i,sounds in pairs(playlist) do if i == currentIndex then destroyElement(publicSound) publicSound = playSound(sounds,false) setSoundVolume(publicSound,1) currentIndex = currentIndex + 1 outputChatBox("Now Playing!: "..sounds,0,255,255) end end end end,1000,0) addCommandHandler("vol",function(cmd,vol) local v = vol / 100 setSoundVolume(publicSound,v) outputChatBox("Public sound volume set to: "..tostring(vol).."%",0,255,255) end)
  23. ShayF2

    Car Rotators

    Why order a list when you check exact variables to find the element? I understand the tick situation sometimes it will be a high check and sometimes it will be a low check, either way without ordering the list, the elements still show up in less than a second, which is all that is needed. Hardly causing server lag if not by a very small fraction. Finding exact elements - local checkVehs = { {model = 411,x = 0,y = 0,z = 0}, {model = 372,x = 0,y = 0,z = 2} } for i,v in pairs(checkVehs) do if i = 1 then if v.model = 411 then outputChatBox("Successfully found precise vehicle ("..getVehicleNameFromModel(v.model).."),root,255,255,255) end end end Finding elements through search - local checkVehs = { {model = 411,x = 0,y = 0,z = 0}, {model = 372,x = 0,y = 0,z = 2} } for i,v in pairs(checkVehs) do veh = createVehicle(v.model,v.x,v.y,v.z) setElementData(veh,"id",i) end for i,ve in pairs(getElementsByType("vehicle")) do if getElementData(ve,id) == 1 then outputChatBox("Found the infernus!",root,255,255,255) end end There is quite a difference between these codes, but I'm saying it doesn't really matter what you use, ipairs or pairs, they both complete the job without hardly any memory requirement. I guess you could just say it isn't 'professional'. But oh well, the players cant see that right? Besides, there is no element in MTA that exists over 200 times (hardly any memory impact), unless you make a script spawn 30 thousand elements, you are hardly at all going to tell the difference.
  24. ShayF2

    Car Rotators

    ipairs and pairs do the exact same thing. They loop through the table. A loop has certain variables, example - for index,plr in pairs(getElementsByType("player")) do end Index stands for index, this can be called anything, i, k, index, number, etc, the index is the number that is assigned to the item in the table. Like an id, similar to what you see on some servers with players on the scoreboard (TAB) plr stands for the item in the table, this can be called anything, plr, player, p, stupid Variable. This will just be used to call the data from the table. pairs is what goes through the table, this goes through all the data randomly. Only difference with ipairs is that ipairs sorts through the data evenly, it sorts the data in order.. so ipairs does take a little longer. Otherwise these two do the exact same name. getElementsByType("player") creates a table of ALL the elements in the server that are players. - that is a table, no doubt. Usually loops are only used in tables.. This is how tables and loops work, at least what I learned from it. Hope it helped you.
×
×
  • Create New...