Jump to content

ShayF2

Members
  • Posts

    230
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by ShayF2

  1. 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.
  2. 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).
  3. 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
  4. ShayF2

    Adding

    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.
  5. ShayF2

    Open Source

    MTA is open-source, which means that anyone can contribute as well as use their modified version of MTA. Correct?
  6. processLine, change z position, processLine, check if element hits processLine, if it does, do damage.
  7. You can use and improve my SQL Framework and run functions as exports. https://github.com/shaiof/Core-Loader/blob/master/core/sql_s.lua
  8. 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.
  9. 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?
  10. 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.
  11. ShayF2

    math.random

    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.
  12. 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)
  13. 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.
  14. You're not structuring the table correctly.
  15. 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)
  16. N0rt0x, Offroader23 made the offedit script and John Edited it, you may want to talk to them both about this.
  17. Where did you get this script?
  18. yeah thanks bud, json ftw.
  19. 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.
  20. ShayF2

    Camber

    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.
  21. ShayF2

    Camber

    If you look at how the front wheel is in the picture, that's how I want it, except when the wheel rotates on the x axis to spin, it messes everything up, like it did with the rear wheel. I do use objects for the wheels. I'm able to resize them that way. I update it on every frame, the rotation of the wheel is set in render event.
  22. ShayF2

    Camber

    That is my screenshot yes, but I can't just set y rotation it doesn't work, all the wheels wobble all over the place. I wanna know how to keep the camber and not have a wobbling wheel. What math do I need?
  23. For all of you people out there needing to save data, just put it in a lua table and save it with JSON, that is if you want it saved on the server or on the client machine, it's the easiest way to do it. Do NOT use xml, xml is the worst saving method I have ever seen. It's complicated af, it uses tags just like html but other than that it's not even remotely close to html. XML - Hard to learn Hard to use Requires a LOT of functions Uses 75-90% of the file to simply create nodes and or categories Requires more than 3 XML functions to save or load data MTA has functions for xml but without them it is not compatible. JSON or SQLite for permanent local storage. MYSQL for permanent external storage. Element Data for temporary storage stored on element. Account Data for permanent storage stored in the servers internal.db registered to a specific account.
×
×
  • Create New...