Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 14/09/21 in all areas

  1. I tried it and it works exactly as it should. Thank you so much for your help!
    1 point
  2. Hey Fierelier, Woovie gave a more technical explanation to this than I'd be able to give:
    1 point
  3. @DatPsychopath Glad that you have responded! It looks like the issue does indeed stem from your MySQL table init query. Take a look at the following line: `updatedate` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', The timestamp value of 0000-00-00 00:00:00 is outside of the range from '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC. Change the line to `updatedate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, because it does make sense that the SQL table entry was updated at the same time as it was created. If you have some weird code that checks if the database was never updated then you might have to adjust it too (I doubt it). I hope that you have no problem reinitializing that database. Maybe you might have to dump it beforehand if you already have data stored inside of it. Links for reference: * https://www.mysqltutorial.org/mysql-timestamp.aspx * https://dev.mysql.com/doc/refman/8.0/en/datetime.html Good luck with your scripting project! ?
    1 point
  4. Olá! Seja bem-vindo(a) ao fórum. ? Lua é uma linguagem de programação, você não pode utilizar outras linguagens dentro dela. A propósito, Lua é apenas um requisito para você iniciar seus scripts. Na minha visão, o que você precisa dominar de fato é a sintaxe do MTA, isto é, entender como as funções e eventos funcionam. Uma vez que tenha entendido, fica bem mais fácil criar as coisas. Novamente: Lua, como linguagem de programação dentro do jogo, é apenas entender o básico. Como você já tem experiência em Python, acredito que será bem tranquilo, pois a lógica você possui. Ainda assim, mesmo a linguagem Lua não sendo compatível com outras, você pode integrar muitas coisas; como aplicativos externos, por exemplo, usando Node.js. O MTA:SA te oferece muitas ferramentas para que isso seja possível. Além do mais, Lua é bem forte quando se trata de tabelas. Ainda mais em um jogo. Deixo abaixo alguns links/tópicos importantes sobre como e por onde começar: Entenda a Wiki do MTA:SA Importante para conhecer os parâmetros e sintaxe das funções. Tutorial sobre Lua aqui, no MTA:SA Também importante para se familiarizar com o MTA:SA. Lista de vídeos feita por um membro da comunidade Os vídeos são para quem está de fato começando agora a programar aqui, no MTA:SA.
    1 point
  5. Thank you. I'm really surprised to see you here. Your scripts were definitely a big inspiration. They blew my mind when I first came across them. I don't think I'd have created this script without seeing yours first. I was really surprised more people weren't working with peds. Though my experience with them hasn't exactly been relaxing and I had to work around a lot of weird stuff I never even considered, so I can see why not many people wanted to go through the hassle, haha. I always thought MTA needed some life in it. The video is quite old and I've done some major work since then. With server-side vehicle traffic and some major improvements and attitude diversity, I'm extremely happy with how it feels at the moment. Here is a short video from when I first started working on traffic. I should really update these I guess. Thanks again for the kind words. It means a lot coming from you. Feel free to pay a visit and play around with it.
    1 point
  6. Não há meio simples para isso. Lua é a linguagem básica para o funcionamento dos resources no MTA. Você pode usar SDK para aperfeiçoar isso, por exemplo: PHP SDK - Multi Theft Auto: Wiki
    1 point
  7. consegui resolver, obrigado amigo você é um amigo
    1 point
  8. TE ELIMINE MUCHAS COSAS INNECESARIAS EN TU CODIGO QUE NO HACIAN NADA. PRUEBA Y ME AVISAS SI FUNCA local weed = { } local syncTimer = { } function startSmokingWeed ( thePlayer ) if not isPedInVehicle(thePlayer) then -- verificamos que no este en un auto if not weed[thePlayer] then -- verificamos que no tenga mota weed[thePlayer] = createObject(1485, 0,0,0) -- creamos su oregano bindKey( thePlayer, "mouse2", "down", "weedDMPS" ) bindKey( thePlayer, "mouse2", "down", "smokeweed_drag" ) bindKey( thePlayer, "M", "down", "smokeweed_drag" ) setTimer( function()--- los segundos que tarda en crearse el cigarro - 1600- exports.bone_attach:attachElementToBone(wed,thePlayer,12,0.05,0.1,0.13,0,-180,59) end , 1650, 1) else outputChatBox("Ya Tienes mota", thePlayer, 255, 0, 0) end end end function smokeWeedDrag( thePlayer ) if weed[thePlayer] then -- verificamos que tenga mota setPedAnimation( thePlayer, "GANGS", "smkcig_prtl", 0, false, true, false, true ) removeCommandHandler("smokeweed_drag", smokeWeedDrag ) -- removemos el comando hasta que termine de fumar su motita setTimer( function() weed[thePlayer] = nil -- como ya se la fumo eliminamos la mota para que pueda comprar otra addCommandHandler( "smokeweed_drag", smokeWeedDrag ) -- le habilitamos nuevamente el comando --setElementHealth ( thePlayer, getElementHealth(thePlayer) + 2 )--- WEED da +1 de salud end , 5000, 1) end end addCommandHandler( "smokeweed_drag", smokeWeedDrag )
    1 point
  9. Introduction This guide intends to teach 3ds Max users the basics and more advanced ways of working with Vertex Colors, in order to achieve lighting solutions for enhanced quality of game models, or blend several textures together using Vertex alpha. A lot of games utilises vertex colors to accomplish lighting or blending effects, which usually impacts the performance less than model shaders. Types of shaders such as Texture Splatting are pixel based techniques for rendering multiple textures onto a model, where each texture e.g earth, grass, gravel, has their own color on the splat map. This however may use up significantly more resources than its alternatives in some cases. As result, game developers may move their aim towards Vertex Alpha and Color rather than geometry shaders. Vertex Color works almost the same way, however it renders per vertex and not per pixel unlike shaders do. This may result in very poor results if the geometry is not subdivided at the places it is painted at. Besides texture blending, vertex colors are also widely used in games for fake lighting baked into models. This is due to some game engines not supporting Ray Tracing or other rendering, or they simply prefer using vertex colors over per-pixel lighting. In GTA:SA the only light rendering is done by vertex colors and 2DFX. In the days that the game was developed, vertex colors was a more sustainable rendering method over other options. Table of contents Different model lighting depending on game time Importance of vertex colors Importance of vertex illumination Basics of per-vertex Radiosity workflow Hard surface prelighting Faking ambient occlusion Texture blending with Vertex Alpha The vertexPaint modifier Extracting channel info Working with several VertexPaint modifiers Different model lighting depending on game time Game models use two vertex channels for lighting. Vertex color is displayed around 06:00 - 20:00. Vertex illumination is displayed outside that timeframe, that is, between 20:00 and 06:00. Between these timeframes, the two channels blends into eachother, creating a realistic daytime and nighttime visualization of the map. Remembering which channel is used for what can be a little troubling, on top of the many other things. Artists could consider Vertex Color = daytime, Vertex Illumination = nighttime. Below are various demonstrations of vertex color and illumination channels. Importance of vertex colors Below video demonstrates the effects of not prelighting game models for GTA:SA. The results are very easy to differ from prelit models, as the only depth seen on the models is made by the diffuse maps, which usually does not add sufficient shadows. That is where the artist may consider prelighting his model. As seen on the video, first footage is of San Fierro chunk without diffuse maps (textures) nor vertex colors. This results in completely white meshes. If however, the artist decides to utilise vertex colors, the model will have a lot greater depth added, without the need to bake light into textures at the expense of computer memory. The video's contents are 1:1 to how San Fierro would be rendered in-game around 12:00. No post processing or edits made to the models. Compression methods, post processing, sky and fog done by the Renderware engine will make it a tad different though. Below screenshot is taken from a Dust2 model ripped from Counter Strike. It shows how the vertex channel brings shadows and ambient occlusion into the model. If it did not have the vertex channel changes made, it would be completely flat, corridors would have no depth whatsoever, only some by the difference between the textures. Importance of vertex illumination Not all models use fancy colors like the pirate assets by Las Venturas strip. A lot of models use the same, though slightly darkened, version of vertex colors for the vertex illumination channel. The result of this is a darker object during night and brighter during day. Perhaps some has some highlights that are cast from streetlights and other light sources that appear during nighttime. Some models, notably light objects use vertex colors in conjunction with 2DFX in order to create realistic light with a real light source. Below example is a runway light. The white version is during day time, where the inner light mesh (the extruded part) is grey to represent an deactivated light. The red version is during night time, where the top surface has light reflected onto it, together with a corona image, more commonly known as 2D billboard or sprites. The corona acts as the light source and creates a bloom alike effect. (Not seen in image) Basics of per-vertex To get a somewhat understanding of how vertex colors work, below demonstration should be helpful. The triangle's top left vertex is painted blue, top right painted green and bottom painted red. This creates an RGB blend display of the triangle. The planar model has its bottom vertices painted black while the top ones are white. This creates more of a gradient across the entire model.To put the difference between per-vertex lighting and per-pixel lighting short, Vertex based lighting creates a gradient from one vertex towards the nearest one(s), and stops there. If a model has only 4 vertices, it is not possible to have circular or very detailed IES-like lighting, as the model would have only 4 points that can have light data. Pixel based lighting can have as many abstract details as artist wishes. It works as if there is a grayscale image on top of the model with a different blend mode, or dynamic lighting based on world models, hence the two are called per-vertex and per-pixel. Radiosity workflow Tired of painting vertex colors onto models with silly brushes all day? 3ds Max has an amazing light renderer, which can produce stunning renders and best of all, stunning prelights. As if it was made for GTA:SA era games! Not to forget, a 3rd party Max script was made to make the workflow a lot less difficult - can be found on: http://www.scriptspot.com/3ds-max/scripts/vertex-color-tools-1. With this script, artists can with a few clicks create a skylight, ground plane (for AO), then render a radiosity solution in less than a minute total. No more setting up radiosity settings, only a few adjustments to your likings if needed. I use it all the time myself, and in fact, I learned to create beautiful prelights by using this tool with radiosity rendering. Before moving on, ParoXum's Radiosity tutorial and the Radiosity wikipedia page contains extra information that is not covered in this thread, for instance particular use of point lights. For that reason they may be benefitable to read through. WARNING! Pressing the AO button on the Vertex Color Tool script, ALL materials will be reset to standard. This can not be reversed! Adding to the above. Make sure to create a backup Max project file prior to working with Radiosity. Use the backup Max project file for vertex colors, leave original file for modeling! This process is covered in the guide. Hard surface prelighting Most artists starting out with vertex colors have probably grown tired of selecting faces of a model, then painting a different value onto each to replicate a hard surface look. As it turns out, this is not an efficient way. The model will look odd if the artist has not put enough time (hours with sweat) into it. That is where automating it with Radiosity rendering is a fantastic solution. To get started, download the following FBX scene https://cdn.discordapp.com/attachments/308956559201796097/632340906170908673/demo.zip. Each point contains a spoiler with a video clip. For those who would like to mess around with the final result of mine, download FBX here: https://cdn.discordapp.com/attachments/308956559201796097/632559814387695626/demo_result.zip (video below) Important thing to note, when using Radiosity for prelights, the shading/lighting which is baked into the model entirely depends on the smoothing of the model. If it's set to Auto Smooth value 2 the shading will resemble 3ds Max's shading 'facets', while if the model has only one smoothing group, the shading will be incredibly smooth and generally won't have any facet shading. San Andreas models generally had very low smoothing value for its models at their creation, judging by their hard surface appearence. If a modeler were to create models that blend in with the game environment, they should strongly consider the above. Video tutorial: Text tutorial: Import the file Click the 3ds max upper left corner, at Import hover over the arrow for a drop down menu to appear. Click Import. Click the demo.FBX. Ensure to include Smoothing Groups on import, and units setup in Meters. Reset X, Y, Z positions to 0, 0, 0. At import the model is not centered. Create light Navigate to Create tab, click the gears icon, finally select the Daylight button. Max will ask if it can set an exposure control flag (not a country flag bleh), click Yes. Click anywhere, this sets the compass. Then, drag the mouse up into the sky, press LMB to spawn the daylight system. The compass position is not important. Alter light Navigate to Modify tab, change Sunlight from Standard to IES Sun. Likewise for sky, make it IES Sky. On Sun Parameters uncheck Shadows. Ensure the sun's state is On. On IES Sky Parameters it is possible to modify the intensity of the sky, as well as the sun. Some of the settings that affect the sun is whether the weather is clear or clouded. Leave default. On hierarchy list, select the Daylight001 item. While on Modify tab, click the Setup button for setting the scene weather. As the light system works like real daylight, the lower the number of hours, the darker the scene. Set hours at 9, month at 9, orbital scale at 320-360. Initiate the radiosity solution by running Vertex Color Tools Ver1.0. Press the AO button. Keep in mind, that this will remove all materials and cannot be reversed with undo. The render setup window opens. Another window from Rendering > Exposure Control is needed. On Exposure Control, change from none to Logarithmic. Tick on the Exterior daylight checkbox, which is required due to scene using a daylight system. Optionally, start rendering previews via the Exposure Control window. These previews are very low resolution and may help visualise the lighting. Or, real renders by SHIFT Q, although this may take significantly more time and processing power. On Render Setup window, reset value of Indirect Lighting Filtering. Increase the Direct Lighting Filtering to a value of 8. Under Radiosity Meshing Parameters tick the Include Skylight checkbox. Under Rendering Parameters select Re-Use Direct Illumination from Radiosity Solution. On Render Setup window, make sure to press Reset, to then start a clean rendering with the updated settings. Click Start. This may be an incredibly slow process, even on high end computers. If it gets stuck, set quality to less. It does not really have much of an impact for GTA:SA light anyway. Voila, done. The final result will be displayed in viewport. The result is equal to what is seen in-game during day hours. If something looks off, go back and tweak settings. Bake Radiosity lighting solution into vertex channel. Navigate to Utility tab, click More..., select Assign Vertex Colors. Upon scrolling down the utility tab, the Vertex Colors settings appear. Vertex Color is for day time, Vertex Illumination is for night time. Choose Vertex Color. Set light model as Lighting + Diffuse. Set Color Assignment as whichever seen fit. On Rendering options, enable Mapping and Radiosity, Reuse Direct Illum. from solution. Finally, click Assign to Selected View vertex color result in viewport. On the VertexPaint modifier, select the channel that was just modified. On the VertexPaint GUI, click the shaded box to the left. This displays the model with only vertex channel rendering, no other 3D shading will be used. Further tweaking If one wishes night time lighting, the best to do is render a new radiosity solution with less sun and daylight intensity, in order to darken the scene. Eventually change to clouded or mess with weather settings. The new radiosity solution will be equally the same as the one for daytime, although a tad darker. When rendered, assign to illumination channel. The letters can be painted for night time to look extra cool. This is where painting by buckets onto face selections of the mesh can come in handy, using the VertexPaint modifier. Odd looking shadows can be fixed up with the blur brush (VertexPaint modifier). Those who are able to get results with the above Radiosity workflow, may utilise their knowledge and take prelighting a next step with other types of lights, in order to create environment lights such as shadows for light poles, torches, buildings etc. Point lights, more specifically Free Light, were used a lot in the ship model further down the topic. Scene lighting is generally hit and miss. There are many settings which may need to be changed e.g scale of daylight and smoothing groups of models, in order to get the right look. Faking ambient occlusion Vertices can easily store ambient occlusion details, negating the need for geometry shaders. Some models may require additional geometry through subdividing the mesh, in order to achieve proper ambient occlusion details with vertex colors. The type of light used is usually skylight or daylight, this creates subtle shadows around corners and creaks, as well as maintaining global lighting. The below model has vertex AO baked by using a Skylight with the following settings. *you can eventually utilise a plane as ground for the ambient occlusion to calculate a lot better. The above practise can be used for GTA:SA assets as well, some settings may require to be tweaked first though. Prelighting in general is trial and error unless the artist has a solid background with lighting and rendering. Generally though, ambient occlusion should not be the only layer for lighting a model. Hard surface lighting as well as adding point lights is highly recommended. Without these, models with AO will still look rather flat in most cases, as there is not much definition between corners, other than soft shadows. Adding point lights to radiosity render will also give the lighting a more natural feeling, this can be done by adjusting the temporature of the light or its color. Combining point lights (free light, omni light, etcetera) with 2DFX can give stunning results. Texture blending with Vertex Alpha Texture blending on MTA was thought to only be possible by shaders, e.g texture splatmap. Instead, we can now blend textures using Vertex Alpha channel. On December 27 2019 we discovered that Vertex Alpha works without need for additional scripting (MTA Discord #modelling). We also need to thank Deniska for writing this guide (gtamaps) on vertex alpha plus creating a maxscript that exports vAlpha channel! Vertex Alpha works based on grayscale values just like alpha masks. Any vertex that's black will not be rendered - any vertex that's not black will be rendered. White is fully opaque, while the greyer it gets, the more transparency is made. Vertex Alpha will not render water behind its faces, so it's important to place an opaque object behind the vertex alpha mesh. This must be a separate model, not part of the mesh that uses vertex alpha. As with vertex prelights, vertex alpha needs geometry to work with. It's highly recommended to turbosmooth/subdivide the mesh so that you can paint in more detail. In the video below, I show how quickly the vertex alpha can be added to your models, and once that's done, you can export the model using the script from this page. Create a plane primitive. Give it 16x16 segments. Convert it to editable mesh. Give it the material that needs to blend using alpha. Set opacity of material to 98. Add a VertexPaint modifier. Select the vertex alpha channel. Use paint bucket with black color, 100 intensity, to paint entire mesh black. Add a secondary vertexpaint modifier. Grab your brush, adjust its size and strength. Begin painting a path from one end to another. Use the blur brush to finetune the semi-transparent edges of your path. Sharp edges ain't good. Looks OK? Start the export-script. You don't need to collapse your modifiers when exporting. Keep them in stack for later adjustments. Export with MMC. Remember to always set alphaTransparency enabled when replacing the model, or else only part of alpha will show. If you want to use another DFF script (for a higher quality dff), simply copy paste the sections e.g "Extra Vertex Colors" via RWanalyze. (Script will break (in which case, close script and run again) if you try to export vertex colors without having first assigned vertex colors/illumination to the model via its respective channels) List of model ID's that use the flag 68 (NO_ZBUFFER_WRITE(64) + DRAW_LAST(4)), which is required for Vertex Alpha: 2728, 3872, 3910, 4227, 4636, 4637, 7892, 9831, 9896, 9897, 11678, 11679, 11680, 11681, 13494, 13495, 13496, 13497, 13498, 13499, 13500, 13501, 13502, 13503, 13504, 13505, 13506, 13507, 13508, 13509, 13510, 13511, 13512, 13513, 13514, 13515, 13516, 13517, 13518, 13519, 13520, 13521, 13522, 13523, 13524, 13525, 13526, 13527, 13528, 13529, 13530, 13531, 13532, 13533, 13534, 13535, 13536, 13537, 13538, 13539, 13540, 13541, 13542, 13543, 13544, 13545, 13546, 13547, 13548, 13549, 13550, 13551, 13552, 13553, 13554, 13555, 13556, 13557, 13558, 13559, 13560, 13561, 13563, 16375, 16445, 16498, 16623, 16676, 16677, 16733, 16734, 16753, 16754, 16756, 16757, 16758, 16783, 16784, 17436, 17437, 17438, 17439, 17440, 17441, 17442, 17443, 17444, 17448, 17450, 17451, 17451, 17452, 17458, 17459, 17460, 17461, 17462, 17463, 17464, 17465, 17466, 17467, 17468, 17469, 17470, 17474, 17524, 18073, 18112, 18610, 18611, 18612, 18613, 18614, 18615, 18616, 18617, 18618, 18619, 18620, 18621, 18622, 18623, 18624, 18625, 18626, 18627, 18628, 18629, 18630, List of model ID's that use the flag 64 (NO_ZBUFFER_WRITE(64)) which are not tested, but might work for Vertex Alpha: 1315, 2981, 4712, 4724, 4554, 8004, 8044, 11306, 14765, Below are a few examples of how vertex alpha can be used to blend several textures together. Above image courtesy: worsas @ project tamriel (see link for more) 128x128 textures, 8192 polygons (can be a lot less!) You can probably create something a lot better than this. Time to get creative! If you're looking for additional inspiration, see the videos in spoiler. Note: The below spoiler contains information that does not apply to vertex alpha method, but instead to vertex colors. This requires shaders, since SA uses the colors for lighting, but is a decent alternative if the model use lighting shaders. The vertexPaint modifier VertexPaint is the modifier that houses the WIP vertex colors, illumination and alpha modifications. It may be accessed on Modifiers tab. While it is open, it allows the artist to do various changes to the vertex channels. Ranging from painting with the use of brushes, to refining vertex colors by blurring, adjusting hue, saturation, lightness etcetera. This is a very powerful tool, despite not having been updated for years. To get started, the modifier works with a float GUI with all of its necessary functions in it. It is worth noting that the modifier can not change existing vertex channel data, only the data that is stored in the modifier. That means it is not possible to import a GTA:SA asset and modify the hue of the vertex color channel. For an exhaustive list of what the modifier offers, check Autodesk's page on the VertexPaint Modifier. Brief explanation of what the modifier has to offer, from top to bottom: Extracting channel info For whatever reason, an artist may want to copy the vertex channel data, that is, the custom vertex information, and paste that onto their latest version of the mesh. This could be due to an irreversible action that would prevent the artist from undoing the lighting changes on present model, resulting in work lost and having to redo it all over again. Although this may seem like a promising solution to regain old channel data, it can generate problems if the two models contain different geometry counts. Below steps explains how to copy/paste data. Navigate to Utilities tab, click the More button, after which, click Channel info. At last, press the button that appeared on the bottom of the utilities tab. At first, the Channel Info GUI may seem complicated; but it really is not. The only information to look out for is the ID column and Channel Name column. The Num Verts, Faces etc. are only important to verify that the two model contains the same model geometry count. In the above example, the model has no custom channel data. The -2:Alpha, -1:Illum and 0:vc are the types of channel info's that are relevant for GTA:SA, although the Alpha data currently isn not compatible with MTA. To copy data, simply select either of the rows and press the Copy button. Then, highlight the present model, select the corresponding channel and paste. Working with several VertexPaint modifiers On more advanced tasks it may be necessary to use multiple VertexPaint modifiers stacked onto the model. Artist may find it helpful if they are doing several versions of prelighting for their model and wants to go through each result, picking the one that suits them the most. This means that each type of radiosity lighting solution will be stored in its own modifier, allowing artists to go through all of them and delete the poor ones. Having multiple modifiers on stack can also improve workflow by utilising each modifiers for each element of the model, such as Modifier1 for bonfire logs, Modifier2 for bonfire shadows, Modifier3 for ambient occlusion, Modifier4 for moonlight etc. Modifiers can also be renamed to quickly tell the artist what they are representing. The model can have as many modifiers in its stack as the artist wishes (or until the software times out), and they do not require to be collapsed when exporting the model to MTA. This means that the modeler simply needs to select the model, export it and load into MTA. Modifiers can then be collapsed to stack when job's done, however, it is strongly recommended to keep them in stack for future, in case of parts requiring rework. Below model may give a good look into just how much it helps to utilise multiple modifiers. The ship has its own modifier for virtually any type of light emmitting source. The rectangular screens to the right are symmetrical on the other side, so there is one modifier that represents those 6 rectangular emmissive screens. Same goes for the cyan U-shaped engravement, which uses its own independant modifier, and so on. This allowed to change the engravement prelight from initially dark blue to cyan, by not affecting other lights when modifying the hue, as the modifier was only used by that particular area. The stack works like so: By clicking the bottom modifier, only that one's layer will show. If clicking the one above it, assuming it is same channel, it will show both of them. Now, if clicking the top modifier, it will show all layers e.g the rest 4 that are associated with Vertex Illum channel. It will only display the channel that is selected on the right most panel. (This depends on version of Max)
    1 point
  10. hi guys and mta team plis can make MTA to gta iv i like server rpg to gta iv its very cool
    1 point
×
×
  • Create New...