ShayF

Members
  • Content Count

    214
  • Joined

  • Last visited

  • Days Won

    1

ShayF last won the day on January 11 2018

ShayF had the most liked content!

Community Reputation

46 Good

3 Followers

About ShayF

  • Rank
    Chump

Details

  • Gang
    Grove
  • Location
    Grove St
  • Occupation
    Drifting
  • Interests
    Scripting

Recent Profile Visitors

1,578 profile views
  1. ShayF

    [LF] Scripter for TV script [PAID]

    @botshara I didn't notice this post until now, I will make this script for you for free, message me on discord. ShayF#0259, I'd be glad to help.
  2. player.position = player.matrix:transformPosition(0, -4, 0) -- this is oop
  3. ShayF

    Convert File Buffer To Table

    @thisdp I hardly ever test code, even my own, I just make it n I already know what works n what doesn't. I honestly don't understand how you got the second print to be nil, because the string is loaded throughout the file and not unloaded but oh well, good job.
  4. ShayF

    Convert File Buffer To Table

    @thisdp Try your code again this time do this print(type(gTable.testFunction)) print(type(testFunction)) the reason i say this is because you dont unload the code, which means that the original functions and variables are still there even after you add them to the table. Not only do you have to unload the code but you need to reformat the string due to those functions and variables being inside the table so that events, commands, and timers can trigger them from gTable instead of the original code. If the second print test prints function then the solution is false.
  5. ShayF

    Convert File Buffer To Table

    @thisdp your solution is false You load the code, and dont unload it. I'm sorry but this solution will not work. However I do like that you made things global, but that is also false because after adding those functions to the table you need to change the name of those functions, gable.functionName() In the scripts string format before you load it I mean, you don't change their names, you just change the names where the functions are executed, if you know what I mean.
  6. ShayF

    Is Lua really limited?

    @spenkbang local seconds = 0 local timer = setTimer(function() seconds = seconds + 1 end, 1000, 0) function stopCount() killTimer(timer) return seconds end or you can try a loop function local seconds = 0 function startCount() seconds = seconds + 1 return continue() end function continue() seconds = seconds + 1 return startCount() end function stopCount() continue = function() end return seconds end Which can go less than 50 ms, this should be capable of getting close to 1ms
  7. 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}
  8. 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.
  9. 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.
  10. 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).
  11. 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
  12. ShayF

    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.
  13. ShayF

    Open Source

    MTA is open-source, which means that anyone can contribute as well as use their modified version of MTA. Correct?
  14. ShayF

    [HELP]Bullet Fall

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