Jump to content

Puma

Members
  • Posts

    240
  • Joined

  • Last visited

Everything posted by Puma

  1. Modeling in SketchUp can be a bitch, but if you know what to do to create models that don't bug ingame (and SU is quite famous for that) AND you know how to create proper models at all, it can be a very handy programme. I have never used programmes other than SketchUp for moddeling and was able to create mods varying from vehiclemods to skinmods and mapmods ( http://www.gtagarage.com/mods/results.php?S=1152437 ). I'm not posting this to promote my mods, I just want to disprove the idea that Sketchup is not a good programme for GTAModding. At the end of the road you still need 3dsMax for proper conversion to SA though, for example to prelight your model, add reflection to textures et cetera.
  2. Read the first post, it's all there.
  3. Hi, Long time no see Picked up Lua today and decided to make something other people would like to have, so here's a script that basically alters vehicledoors. Syntax (clientside): setVehicleDoorType ( vehicle, doorType ) Reset doortype by not filling in a doortype. My script uses elementdata, so when you set doortype for a vehicle at client 1, the altered doortype on that vehicle is also visible to all other players. Default doortypes are "scissor" and "butterfly". Small vid: Script: (feel free to implement it in your own scripts, some credit would be nice) -- Special doors script by Puma -- Free to use and free to edit, but please aks me for approval if you want to release a significantly altered version of this script -- YOU CAN EDIT THIS: local doorTypeRotation = { ["scissor"] = {72, 0, 0}, ["butterfly"] = {0, -60, 60} } -- add doortypes ----------------------- -- HOW TO USE THIS for douchebags ----------------------- -- Just put this somewhere in your script and fill in a vehicle and a doortype (see above for available doortypes) -- setVehicleDoorType ( v, type ) -- If you want to reset the doortype, just use setVehicleDoorType ( v ) without filling in a type -------------------------------- -- Now comes the part you shouldn't mess with -------------------------------- -- Defining som shit ----------- local p = getLocalPlayer() local doorAnimTime = 350 local doorIDComponentTable = { [2] = "door_lf_dummy", [3] = "door_rf_dummy", [4] = "door_lr_dummy", [5] = "door_rr_dummy" } local doorTypes = {} for doorType, doorTable in pairs ( doorTypeRotation ) do table.insert ( doorTypes, doorType ) end local vDoorType = {} for i, v in pairs ( getElementsByType("vehicle")) do local doorType = getElementData ( v, "vDoorType" ) if doorType then vDoorType[v] = doorType end end local function vRemoveDoorTypeFromTable ( v ) if isVehicle(v) then vDoorType[v] = nil oldDoorRatios[v] = nil doorStatus[v] = nil doorTimers[v] = nil end end function vehicleDestroyed () vRemoveDoorTypeFromTable(source) end addEventHandler ( "onClientElementDestroy", root, vehicleDestroyed ) addEventHandler ( "onClientVehicleExplode", root ,vehicleDestroyed ) -- MAIN ----------------------------------------------------------------------- function setVehicleDoorType ( v, type ) if v and isElement(v) and getElementType(v) == "vehicle" then if type and tostring(type) and isDoorType(type) then setElementData ( v, "vDoorType", type ) else setElementData ( v, "vDoorType", nil ) vRemoveDoorTypeFromTable ( v ) end end end local function elementDataChange ( key, oldValue ) if key == "vDoorType" and isVehicle(source) then vDoorType[source] = getElementData ( source, "vDoorType" ) end end addEventHandler ( "onClientElementDataChange", root, elementDataChange ) local oldDoorRatios = {} local doorStatus = {} local doorTimers = {} local function preRender () for v, doorType in pairs ( vDoorType ) do if isElement(v) then if not doorTimers[v] then doorTimers[v] = {} end local doorRatios = {} for i=1, 4 do local i = i + 1 -- leftfront=2, rightfront=3, leftrear=4, rightrear=5 local doorRatio = getVehicleDoorOpenRatio ( v, i ) if doorRatio and oldDoorRatios[v] and oldDoorRatios[v][i] then local oldDoorRatio = oldDoorRatios[v][i] if not doorStatus[v] then doorStatus[v] ={} end local doorPreviousState = doorStatus[v][i] if not doorPreviousState then doorPreviousState = "closed" end if doorPreviousState == "closed" and doorRatio > oldDoorRatio then doorStatus[v][i] = "opening" doorTimers[v][i] = setTimer(function(v,i)doorStatus[v][i]="open" doorTimers[v][i]=nil end,doorAnimTime,1,v,i) elseif doorPreviousState == "open" and doorRatio < oldDoorRatio then doorStatus[v][i] = "closing" doorTimers[v][i] = setTimer(function(v,i)doorStatus[v][i]="closed" doorTimers[v][i]=nil end,doorAnimTime,1,v,i) end elseif not oldDoorRatios[v] then oldDoorRatios[v] = {} end if doorRatio then oldDoorRatios[v][i] = doorRatio end end else vDoorType[v] = nil oldDoorRatios[v] = nil doorStatus[v] = nil doorTimers[v] = nil end end for v, doors in pairs ( doorStatus ) do local doorType = vDoorType[v] local rx, ry, rz = unpack ( doorTypeRotation[doorType] ) for door, status in pairs ( doors ) do local ratio = 0 if status == "open" then ratio = 1 end local timer = doorTimers[v][door] if timer and isTimer ( timer ) then local timeLeft = getTimerDetails ( timer ) ratio = timeLeft/doorAnimTime if status == "opening" then ratio = 1 - ratio end end local dummyName = doorIDComponentTable[door] if dummyName then local rx, ry, rz = unpack(doorTypeRotation[doorType]) local rx, ry, rz = rx*ratio, ry*ratio, rz*ratio if string.find(dummyName,"rf") or string.find(dummyName,"rr") then ry, rz = ry*-1, rz*-1 end setVehicleComponentRotation ( v, dummyName, rx, ry, rz ) end end end end addEventHandler ( "onClientPreRender", root, preRender ) -- UTILS ----------------------------------------------------------------- local function isDoorType ( type ) if type and tostring(type) then for i, t in pairs ( doorTypes ) do if t == type then return true end end end end local function pv (player) if not player then return getPedOccupiedVehicle ( p ) elseif isPlayer(player) then return getPedOccupiedVehicle ( player ) end end local function isPlayer ( player ) if player and isElement ( player ) and getElementType(player) == "player" then return true end end local function isVehicle ( vehicle ) if vehicle and isElement ( vehicle ) and getElementType(vehicle) == "vehicle" then return true end end Have fun with it, you can add your own doortypes at the top of the script, if you want to. It's not perfect, but it's fun to mess around with and if there's someone who wants to optimize it: feel free to do so! Just let me know if you want to release it somewhere. Have fun with it. Let me know if I forgot something.
  4. And another option: try an older version of TXD-Workshop. I personally don't like the new versions, too much options..
  5. I added 'and state =="down"'. Without it the script runs twice when you press the button: when you press it and when you release it.
  6. You need to edit the toptimes scripts. I haven't tested this myself, but you could try this: Go to the race_toptimes resource and open toptimes_client.lua. Go to line 609: if self.startshow then Replace it with: local ddMap = true if #getElementsByType("checkpoint") > 0 then -- checkpoints = racemap ddMap = false else -- checking if there is a Hunter-pickup for i, pickup in pais ( getElementsByType ( "racepickup" ) ) do local type, vehicle = getElementData(pickup,"type"), getElementData(pickup,"vehicle") if type == "vehiclechange" and vehicle and tonumber(vehicle) == getVehicleModelFromName("Hunter") then ddMap = false end end end if not ddMap then Again, I haven't tested this, so no guarantee that it works.
  7. Nice concept, but it isn't very smooth. The ped starts rotating all of a sudden and only rotates around its x-axis.
  8. Try replacing 50 in createPickup by your timeout variable.
  9. Just check the list of client scripting events next time. https://wiki.multitheftauto.com/wiki/Cl ... ing_Events It''s right there. onClientGUIClick + guiGridListGetSelectedItem
  10. Reconsider this. Do you realize that when you download and save maps for the client, everyone can start stealing those maps? I mean, it's possible, but you gotta encryp them somehow.
  11. What do you mean with a specific number per row?
  12. Second one is better. Get the data from the database and store it into a table when it is needed: a MySQL connection is quite fast, don't worry about lag. You can request all 50 objects using 1 query.
  13. Puma

    moveObject

    The rotation you put into moveObject is ADDED to the current rotation. So, in abrir2 it should be 0, -270, 0 And in cerrar2 it should be 0, 270, 0 If I understand your script correctly.
  14. No. For example, you want to display a text on your screen when a player enters a marker. A lot of things, like displaying text, are only clientside available (simply because the server is just passing through and modifying data between clients and not rendering anything), so you do a clientside script using onClientMarkerHit.
  15. accountname = getAccountName (getPlayerAccount(playerElement)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "vip" ) ) then Fixed, you forgot the opening " to vip.
  16. Nah, not a stack overflow, because the second time he executes createExplosion from within the createExplosion function, his createExplosion function will miss parameters (player) and will throw up an error. He himself made a createExplosion function and that overwrites the default MTA createExplosion function. Just rename your "function createExplosion(thePlayer, command)" to something else like "function createExplosionCommand (thePlayer, command)", don't forget to change "addCommandHandler("explosion", createExplosion)" into "addCommandHandler("explosion", createExplosionCommand)" and you're done.
  17. That depends on the gamemode you're running. Every gamemode has an EDF, in which is defined what happens with the different elementtypes in the mapfile. For example, race gamemode has 'racepickup'-elements, but these are only used by the race-gamemode, another gamemode like play won't load these elements. If the colshapes are not loaded by the gamemode you're using, you could always alter the EDF of that gamemode yourself, so it does load the colshape-elements. Here's some info: https://wiki.multitheftauto.com/wiki/EDF
  18. All textures and images you use must have a size that is a power of two. 4x4, 8x8, 64x64, 1024x1024 or combinations like 128x1024, 64x256 et cetera. Only then will images appear sharp. In your case, I would make the image 32x32. You don't need to enlarge the image itself, just put the original image with its original size in a new image that is 32x32 and use dxDrawImageSection to only draw the 30x30 part of the image.
  19. 1. MySQL. 2. https://wiki.multitheftauto.com/wiki/Se ... _functions In short: connect to a database using dbConnect function and do stuff (storing, altering and getting data) by sending queries using the dbQuery function. http://en.wikipedia.org/wiki/MySQL You need to install a MySQL database first, though. http://www.mysql.com/ 3. No, and default MTASA account sucks. Use MySQL if you want to do it the right way. If you need more info, just ask for it .
  20. No toptimes are recorded in maps that don't have checkpoints ( = DD/DM )...?
  21. Chatbox can be hidden using /showchat . Since the chatbox is gone after you hid it, you need to use the F8-console and 'showchta' (without /) to unhide the chatbox.
  22. Puma

    Object Rotation

    Put moveObject in the timer. First, you create the object: object = createObject ( model, x, y, z ) moveObject moves the object to a new position and adds a rotation to it, if you want to. What you want to do is move it to the same position it already is on (so it doesn't actually move) by using the same x, y and z as you used in createObject, but in moveObject you add a rotation. Check out the page about moveObject: https://wiki.multitheftauto.com/wiki/MoveObject The rotation you fill in in moveObject is ADDED to the rotaion it already has. If you fill in 90, it rotates 90 degrees. Put the moveObject in a timer: setTimer ( moveObject, timerInterval, amountOfTimesToExecute, arguments... ) Arguments is what you fill in in moveObject, for example: moveObject ( object, 1000, x, y, z, 0, 0, 90 ) This makes the object turn 90 degrees around theZ-axis in 1000 milliseconds = 1 second. Put this in the timer: setTimer ( moveObject, 1000, 0, object, 1000, x, y, z, 0, 0, 90 ) This executes the moveObject(object,1000,x,y,z,0,0,90) every 1000 ms. You have to fill in the same interval for the timer and moveObject, so it will stop moving when the timer makes it move again. Good luck, you just have to change some numbers now.
  23. Ah, I get it. From my modeling experience, I thought it would work this way: you load the dff, which has texturemaps, and then you load the .txd which textures are then applied to the dff, like you apply a material to a model in 3dsMax. Thanks!
  24. In short: the pokertable object appears white ingame (missing textures), when I use the dynamic script (from line 52) to replace dff, txd and col, but the chip-objects which ONLY get a txd-replacement DO have the new textures. When I replace pokertable dff, txd and col like in the first example (line 41), the pokertable object DOES have textures. http://pastebin.com/eLXHPv20 Script has notes. I would be glad if anyone could shed a light on it. Fixed. For some reason I had to replace TXD first and then DFF, which is kinda illogical by the way.
×
×
  • Create New...