• Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by ShayF

  1. ShayF

    Is Lua really limited?

    Who here has had a limitation with lua? A point where they wanted to do something and they couldn't with lua. Respond your limits, see how far you can really go.
  2. ShayF

    Convert File Buffer To Table

    I need help figuring out how to convert a script files buffer to a table. Here's what I mean: local buffer = [[local sx, sy = 0, 0 globalVar = 'test string' function testFunction() end local function testFunction2() end]] -- to local buffer = {sx = 0, sy = 0, globalVar = 'test string', function testFunction() end, function testFunction2() end}
  3. ShayF

    createBrowser(), allow all pages to load

    MTA's browser uses CEF which is an open-source chromium browser platform. By default however MTA has a protection feature for players, by making it so that they have to verify or confirm the site that they are entering, unless it is a site that MTA by default has allowed. This can be bypassed if you run a site with its own virtual browser. This makes it so when the players confirm your site, they will no longer have to confirm any others.
  4. ShayF

    Set scale for weapon in hands

    function getPlayerWeaponAsElement(player) local weaps = getElementsByType('weapon') local x1, y1, z1 = getElementPosition(player) for i=1, #weaps do local x2, y2, z2 = getElementPosition(weaps[i]) local distance = getDistanceBetweenPoints3D(x1, y1, z1, x2, y2, z2) if distance < 2 then return weaps[i] end end return false end No idea if something like this would work since the element type is weapon, not object, no way to set object scale. And even though this seems pointless, getPlayerWeapon returns the players weapon slot and not the weapon its self. What you could do is turn off visibility for the players weapon, and create an object, updating its position and rotation every frame, that way you would be able to rescale the weapon (visually that is).
  5. ShayF

    Open Source

    MTA is open-source, which means that anyone can contribute as well as use their modified version of MTA. Correct?
  6. local ox, oy, ex, ey = 0, 0, 0, 0 addEventHandler('onClientClick', root, function(button, state) local px, py = getCursorPosition() if button == 'left' then if state == 'up' then ex, ey = px, py elseif state == 'down' then ox, oy = px, py end end end) function find() local r for i=ox, ex do for e=oy, ey do local x, y, z = getWorldFromScreenPosition(i, e) r = processLineOfSight(x, y, z, xOffset, yOffset, z) -- use custom offsets end end return r or false end
  7. ShayF


    I want to add to a value per frame, for some reason it sticks to a single value, the speed value, instead of the actual value its self. -- Serverside creates data and syncs with clientside via element data. Tbh serverside isn't needed at all. self.wx1, self.wx2 = getDefaultWheelSize(self.vehicle) for i=1, self.wheelAmount do self.wheels[i] = { wheel = createObject(self.model, 0, 0, 0), width = 0, cam = { camber = 20, -- what you want it to be, this is whatever you set camber to current = 0,-- this what it currently is in-between gradual movements increment = 0.97, speed = 2, onGround = isVehicleOnGround(self.vehicle) } } iprint(self.wheels[i]) if i == 1 or i == 2 then setObjectScale(self.wheels[i].wheel, self.wx1) else setObjectScale(self.wheels[i].wheel, self.wx2) end end -- clientside, where all the :~ is done. for i=1, #self.wheels do if isElement(self.wheels[i].wheel) then dxSetShaderValue(wheelShader, 'red', 0.25) dxSetShaderValue(wheelShader, 'green', 0.25) dxSetShaderValue(wheelShader, 'blue', 0.25) dxSetShaderValue(wheelShader, 'alpha', 0.25) engineApplyShaderToWorldTexture(wheelShader, '*', self.wheels[i].wheel) local x, y, z = getVehicleComponentPosition(self.vehicle, wheelNames[i], 'world') local rx, ry, rz = getVehicleComponentRotation(self.vehicle, wheelNames[i], 'world') local sx, sy, sz = getObjectScale(self.wheels[i].wheel) local newPos1 = (z-(self.wx1/2))+(sy/2) local newPos2 = (z-(self.wx2/2))+(sy/2) local camber = self.wheels[i].cam if isVehicleWheelOnGround(self.vehicle, i-1) then if camber.current < camber.camber then if camber.current > camber.camber then camber.current = camber.camber else end end else --if camber.current > 2 then --if camber.current < 2 then camber.current = 1 end --camber.current = camber.current - (camber.speed * camber.increment) --end end if i == 1 or i == 2 then setElementPosition(self.wheels[i].wheel, x, y, newPos1) else setElementPosition(self.wheels[i].wheel, x, y, newPos2) end setElementRotation(self.wheels[i].wheel, rx, ry-camber.current, rz, 'ZYX') end end So I want camber to be smooth, when vehicle isn't on the ground then the wheels are straight, but as it comes back to the ground, gradually go back into camber state. Basically adding a realistic effect to the wheels. The camber is stuck at the speed value created on server side. Tbh, good luck with this one. Using a better version of interpolate.
  8. ShayF

    [HELP]Bullet Fall

    processLine, change z position, processLine, check if element hits processLine, if it does, do damage.
  9. ShayF

    MySQL as a single resource?

    You can use and improve my SQL Framework and run functions as exports.
  10. ShayF

    HELP how to check ID from DB Paradise RP??

    Not many people are willing to help with ripped scripts. Even though it has public license information inside the file you're better off learning to script/learning their ways of scripting, or talking to the original author of the script its self.
  11. ShayF

    Functions as Strings

    function getAllFunctions() local funcs = {} local function dump(t) for k, v in pairs(t) do --[[if type(v) == 'table' then dump(v) else]]if type(v) == 'function' then funcs[k] = v end end end dump(_G) print('hi') return funcs end function getFunctionFromName(name) local t = getAllFunctions()-- first run here if type(name) == 'string' then if t[name] then return t[name] end end return false end local GAF = getFunctionFromName('getAllFunctions') GAF()-- second run here. I'm trying to do stuff like this for string modification, loading external (not included) files, and other crazy stuff, this is really just for test purposes. Stack Overflow error occurs when repeating the same action to child tables. Does anyone have a way around this?
  12. Hello everyone, my name is Shaio Fencski. The first server that I joined was John Flowers Freeroam Boredom. This server had professional scripters, such as Offroader23 who made the first airbrake and offedit in-game map editor, Woovie who is an MTA administrator, and also John Flower himself. They had a special script called flowerattach, where you could attach objects to your vehicle and do crazy designs. Limitless possibilities with it. Ever since I saw that script I have been fascinated with vehicle manipulation. Which is probably what I am best at now. I've been working on a framework that allows you to easily do more things with your vehicles, such as window animations, changing headlight distance, moving and real reflecting mirrors, adding on new vehicle parts or upgrades, modifying wheels to be bigger, wider, and many other things. Here are a few photos.
  13. ShayF


    local last function getRandom(first, second) if second > first then local rand = math.random(first, second) if rand == last then return getRandom(first, second) end last = rand return rand end return false end This will get a random number between first and second, making sure its not the same as the last random number you got as well as making sure that its a valid math operation. I hope this helps.
  14. ShayF

    IDLE sound engine car

    RX7_sound = { {'001.wav',494}, } function replacesound(vehicle) local veh = source or vehicle for i,OBJ inipairs(RX7_sound) do if veh then if OBJ[2] == getElementModel(veh) then local x,y,z = getElementPosition(veh) sound = playSound3D(OBJ[1],x,y,z,true) attachElements(sound,veh) --sound = playSound(OBJ[1]) -- change to playSound3D() setSoundVolume(sound,0.5) setSoundMaxDistance(sound,25) end end end end addEventHandler('onVehicleEnter',resourceRoot,replacesound)
  15. ShayF

    Get vehicle size

    function getVehicleSize(vehicle) if vehicle and isElement(vehicle) and getElementType(vehicle) == 'vehicle' then local minX,minY,minZ,maxX,maxY,maxZ = getElementBoundingBox(vehicle) return maxX-minX,maxY-minY,maxZ-minZ end end This returns the length, width, and height of the vehicle. Since it is 3d, you have 3 things to worry about.
  16. ShayF

    [HELP] Doesnt delete all rows from table

    You're not structuring the table correctly.
  17. ShayF

    [HELP] Doesnt delete all rows from table

    unless you're going to use keys then I don't see why you're using a key loop. local vehicles = {} addCommandHandler('deveh',function(player) for i=1,#vehicles do local plr,veh = unpack(vehicles[i]) if (plr == player) then destroyElement(veh) table.remove(vehicles,i) end end end)
  18. ShayF

    offedit break command

    N0rt0x, Offroader23 made the offedit script and John Edited it, you may want to talk to them both about this.
  19. ShayF

    Set certain skin when player spawn

    Luke Leone
  20. ShayF

    [HELP] vehicle-system

    Where did you get this script?
  21. ShayF

    Advice with tables in lua

    yeah thanks bud, json ftw.
  22. ShayF

    Call functions in other directories?

    Script 1 <meta> <script src="script1.lua" type="server"/> <export function="output"/> </meta> function output() outputChatBox('Exports Confirmed') end Script 2 <meta> <include resource="script1"/> <script src="script2.lua" type="server"/> </meta> local e = exports.script1 e:output() Note that both have to be on the same side, server or client. Exported functions MUST be exported inside the meta of the same script where the function is located.
  23. ShayF


    I'm wondering what math I need to do camber effect to wheels, I need to set y rotation based off of x rotation, I'm just not sure how to do it. Can someone help me ? Debugscript Legend: INFO: rotation X : rotation Y : amount of camber
  24. ShayF


    Well, if the x rotation was still, it wouldn't be a problem. So I'm guessing the math needs to be based off of the x rotation. I simply don't know what equation I need.