Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 31/03/20 in all areas

  1. I have not looked into the script much but you have to know who is eligible for the special wheels and then store that in a table on the server. Then also store what wheels they picked. I mentioned the event functions before. It really is not easy to get into, especially since that script is so huge and honestly not very well documented. I don't think that the difficulty is in the Lua language, but rather the questionable design of the code that you are dealing with.
    1 point
  2. Np, here is an idea: local row = math.floor(i / 6); local column = ( i % 6 ); Then you can multiply row with pixel height, column with pixel width of rectangle.
    1 point
  3. It's simpler for weapons like Uzi, there will be dual-wield with the weapon skill maxed. Example: function doubleUzi() setPedStat(source, 75, 999) end addEventHandler("onPlayerJoin", getRootElement(), doubleUzi)
    1 point
  4. man, now my head is broken ?, as i said in the start i only know the very basics like show a message in the screen , i will really need help in that. but, how can i share the donation information across clients, and trigger a server event?. for you can be easy to solve but for me it is an alian language ? i don't want to abuse of your generosity, so if u are busy or can't help i will understand and try to learn and solve myself, it will take a loooooong time but i think it will work i guess ? ?
    1 point
  5. No problem! I hope that you get it sorted out. Hopefully you were not scammed by some guy who promised you a feature. If you want scripting advice for implementing it yourself feel free to ask in this thread. Then I will guide you.
    1 point
  6. Hello Rolplay, I see that other people attempted to help by posting their own solutions to light indicators. While it is quite interesting, let's continue with the mentioned points: for this point you have to create a server-side Lua script! open up that meta.xml file and add the following line inside the <meta> node: <script src="server.Lua" type="server" /> Then you have to create a server.Lua file in the resource. If you want to synchronize data between the server and game client you have to use MTA events. The necessary functions for that are addEvent, addEventHandler, triggerServerEvent and triggerClientEvent. In the game client we have four actions: turning on the left/right indicator, turning off the left/right indicator. Thus we want to create events that represent those actions: onVehicleTurnOnIndicator, onVehicleTurnOffIndicator, onClientVehicleTurnOnIndicator, onClientVehicleTurnOffIndicator. Then we have to use triggerServerEvent with the mentioned event names as first argument to tell the server that the vehicle indicator light should turn on. Then the server can tell all players about the event using the onClient eventname. here we require more book-keeping than previously: for every vehicle we should store the parameters left indicator on, right indicator on, left indicator start time, right indicator start time, left indicator shader, right indicator shader (shaders only on the clientside). Thus we need to create a table called "vehicle_indicator_lights" on both the server-side and the client-side. Using the events we created in point 1 we write data directly into the table instead of global variables. Hopefully you can follow my points. Feel free to ask questions. If you don't get them done by the weekend I will help you out with the synchronization bit I am not available all the time due to work and social life. But if I am away from the forums it means that I will return to your issue as soon as possible! So don't let yourself get confused.
    1 point
  7. Hello iwalidza, if you want to have the camera move around in a circle around a point then you can simply use the math.sin and math.cos functions of Lua in combination with MTA's setCameraMatrix function local cam_move_start = getTickCount(); local cam_radius = 50; local cam_move_circle_duration = 15000; local cam_move_angle_start = 0; local cam_movearound_point_x = 0; local cam_movearound_point_y = 0; local cam_movearound_point_z = 0; local cam_height_offset = 20; local function get_camera_point_circular() local now = getTickCount(); local passed_time = now - cam_move_start; local progress_circle = passed_time / cam_move_circle_duration; local cam_current_angle = math.rad(cam_move_angle_start + progress_circle * 360); local cam_pos_x = cam_movearound_point_x + cam_radius * math.cos(cam_current_angle); local cam_pos_y = cam_movearound_point_y + cam_radius * math.sin(cam_current_angle); return cam_pos_x, cam_pos_y, cam_pos_z + cam_height_offset; end addEventHandler("onClientPreRender", root, function() local cam_pos_x, cam_pos_y, cam_pos_z = get_camera_point_circular(); setCameraMatrix(cam_pos_x, cam_pos_y, cam_pos_z, cam_movearound_point_x, cam_movearound_point_y, cam_movearound_point_z); end ); (code has not been tested) The math.cos and math.sin functions are used to model a circle in math. You should learn about those in your school math classes. Extended knowledge can be gained in University which I highly recommend to attend to! - Martin
    1 point
  8. ههههههه من جد انا ما دخلني هنا الا الكورونا ? المهم ويش فيه عندكم اقتراحات واشياء نسويها نرجع التفاعل ونرجع الناس مثل قبل اشوف حتى السيرفرات العربية عددها قل وقل عدد اللاعبين العرب بعد اجيالنا كبرت خلاص ?
    1 point
  9. Example: function string_padding_dword(s) local l = 4 - string.len(s) % 4 return s .. string.rep(string.char(l), l) end function string_unpadding_dword(s) return string.sub(s, 0, string.len(s) - string.byte(s, string.len(s))) end function FileProtection(path, key) local file = fileOpen(path) local size = fileGetSize(file) local FirstPart = fileRead(file, 65536) fileSetPos(file, 65536) local SecondPart = fileRead(file, size - 65536) fileClose(file) file = fileCreate(path..'rw') fileWrite(file, encodeString('tea', string_padding_dword(FirstPart), { key = key })..SecondPart) fileClose(file) return true end function FileUnProtection(path, key) local file = fileOpen(path) local size = fileGetSize(file) local FirstPart = fileRead(file, 65536 + 4) fileSetPos(file, 65536 + 4) local SecondPart = fileRead(file, size - (65536 + 4)) fileClose(file) -- file = fileCreate(path..'rw') -- fileWrite(file, string_padding_dword( decodeString('tea', FirstPart, { key = key }) )..SecondPart) -- fileClose(file) return string_padding_dword( decodeString('tea', FirstPart, { key = key }) )..SecondPart end -- example FileProtection('infernus.dff', 'GT4BAE') -- FileUnProtection(path, key) local txd = engineLoadTXD('infernus.txd') engineImportTXD(txd, 401) local dff = engineLoadDFF( FileUnProtection('infernus.dff', 'GT4BAE') ) engineReplaceModel(dff, 401)
    1 point
  10. Introduction Vehicle indicators are mostly seen on other GTA modifications where the mod 'IVF - Improve Vehicle Features' is compatible. This mod allows for light modifications such as police flashlights, custom LED flashers, indicators and much more. These features are sought after by MTA roleplaying servers a lot. This guide aims to introduce 3D modelers to prepare models for customisable lights, which then requires coded shaders to work. Anything related to scripting is not included in this guide. The guide assumes that the modeler has basic understanding of importing and exporting models. Editing existing Huntley for indicator lights With Huntley imported into 3ds Max, isolate the mesh called 'chassis' as it is the only component that needs working lights. As seen the car has 4 lights; right tail light, left tail light, right headlight and left headlight. All 4 has their own material assigned for them to act each their own way. The material color codes are hardcoded in the game telling it when to show illuminated brake lights for when the car brakes and so on. For this custom vehicle however, any geometry meant for custom vehicle lighting needs white color code and a custom texture name for shadering to work. Before anything, it's required to get the custom lighting texture ready. For this guide, vehiclelights128 and its illuminated version works perfectly fine. These needs be renamed to customRRLightsOff and customRRLightsOn and so forth. The 'RR' is for 'right rear', where as 'LR' would be 'left rear'. This needs be done for front too, so in total 4 'off' images are needed while only one 'on' is needed, as it can simply be instanced when shadering. Below is a step-step process on editing Huntley's geometry and adding custom indicators. Add an 'Editable Poly' modifier to the model. Press '5' key on keyboard which enables 'Select by Element'. Select the two rear light meshes, ensure they are both highlighted. On 'Modify Panel' scroll down and find 'Slice Plane', click that. This creates a rectangle that has a line-preview for the cut. Align the plane to the lights and create two cuts for the indicator lights. Select one side of the geometry that was cut by using 'Select by Polygon'. On the modifier stack, click 'Collapse all', leaving only 'Editable mesh' on the stack. Press 'M' key for 'Material browser'. Create a new GTA material. In the texture slot, add in the 'customRRLightsOff'. On material browser, click 'Assign material to Selection'. Note that this needs be done for the left side too but with different material and texture. Apply a new modifier on the model called 'Unwrap UVW'. Press 'Open UV editor'. On the UV editor, enable 'Select by polygon'. Grab the UV island and drag it onto the orange section of the image, which is for indicator lights. On modifier stack, collapse all, to save the new UV's. Above: example of what can be achieved. Front lights section already has indicator lights, so all that needs doing is 2 new materials with each their own light texture, like done on rear side. The 4 new textures needs be added to the car's .txd file. Model is now ready for export. Now all that's needed is MTA scripting for the light shaders to work. Exact same process can be applied for creating custom emergency lights. Note that it is not necessary to have these 128x128 textures in the model. They can be downscaled to 4x4 in the .txd and then a MTA shader script can apply the originals, which greatly reduces the size of download. This means it'll download 4 images which are then instanced onto every custom model using the lights. To put it short, each .txd will have 4 placeholder-images of 4x4 resolution rather than 4 images of 128x128 resolution.
    1 point
  11. It's official, MTASA has been bought and we are becoming SAMP. Future MTASA builds will be closed source and half the features removed. Have a nice day!
    1 point
  12. Since it's 02/04 now; I've never seen a more successfull April's fool than this one.. it was especially entertaining to see what happened on Discord :)
    1 point
  13. 1 point
  14. i am working on a new function to solve your question. As soon as the new function finishes, i will post the method to realize what you want. thanks for your supports.
    1 point
×
×
  • Create New...