ShayF

Members
  • Content count

    193
  • Joined

  • Last visited

  • Days Won

    1

ShayF last won the day on January 11

ShayF had the most liked content!

Community Reputation

44 Good

2 Followers

About ShayF

  • Rank
    Mark

Details

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

Recent Profile Visitors

1,225 profile views
  1. 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.
  2. 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)
  3. 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.
  4. [HELP] Doesnt delete all rows from table

    You're not structuring the table correctly.
  5. [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)
  6. offedit break command

    N0rt0x, Offroader23 made the offedit script and John Edited it, you may want to talk to them both about this.
  7. Set certain skin when player spawn

    Luke Leone
  8. [HELP] vehicle-system

    Where did you get this script?
  9. Advice with tables in lua

    yeah thanks bud, json ftw.
  10. 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.
  11. 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.
  12. 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.
  13. 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?
  14. Advice with tables in lua

    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.
  15. Advice with tables in lua

    json is not that hard to use, its compact and really simplified. You make a lua table, then make a json file, convert the lua table to json with toJSON and then write it to the json file, and when you want to load it you just use fromJSON to convert it back to a lua table. That's why I prefer JSON over everything. local data = { {'blah','blah','blah'}, {'blah','blah','blah'} } function save() local file = fileOpen('save.json') or fileCreate('save.json') fileWrite(toJSON(data),file) fileClose(file) end function load() if fileExists('save.json') then local file = fileOpen('save.json') local size = fileGetSize(file) local buffer = fileRead(file,size) data = fromJSON(buffer) fileClose(file) end end If you were to use different saving methods than xml you would see why I treat it with disrespect. I personally prefer json and mysql.