Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 19/05/17 in all areas

  1. Crear shaders y modelos debe ser la forma más innovadora de aportar a la comunidad. Me gusta mucho.
    2 points
  2. https://community.multitheftauto.com/ This is a globalized thread so it will show in EVERY forum. Please reply to this thread with a link to the resource(s) you wish to report. Some reasons to report a community resource: Skin, weapon, or vehicle modifications (note that mods added to resources as assets rather than it's main purpose are allowed). Also model packs (like mass weapon or wheels/rims replacements) are allowed. Resources that were stolen or leaked/copied or which partially consists of such violating code Resources with none or poor descriptions Resources with "please delete" and such in their description These are just a few reasons in general, also if you see any resource in violation of the broader community guidelines (located at https://forum.multitheftauto.com/topic/98514-community-regulations-guidelines/) you can report it, referring to the regulation that resource violates. It's okay if none of these reasons apply to the resource you wish to report; post it anyway with a reason why you think it should be removed and we'll make a decision. To hopefully curb improper resources existing on the community, this topic has been made a global announcement across the forum. We'll do our best to keep on top of your reports. We will edit your post to indicate the issue has been dealt with. Also, note that we are not seeking any additional community moderators at this time.
    1 point
  3. To post a topic in the Scripting section your topic should meet the following requirements: It must contain specific questions about either: the code you will include that is problematic or you are asking direct support for, or asking for help in finding the best approach to achieve something. For example, asking more experienced scripters if there is a more efficient way of coding your desired script/function. The contents of the topic must focus around code support or coding methods. It needs to follow the Formatting guidelines and Conduct guidelines listed below. This section is not for: (resource) progress show-off, recruiting scripters, or polling interest or brainstorming on what kind of project you are up to next All of the above things have their own categories to post them in. These categories are respectively: https://forum.multitheftauto.com/forum/87-resources/ https://forum.multitheftauto.com/forum/149-looking-for-staff/ https://forum.multitheftauto.com/forum/140-mta-chat/ If you still post such a topic in the Scripting section mistakenly, the first time it will get moved gracefully to the correct section. Any subsequent repeated mistakes may result in an instant deletion of your topic. Formatting guidelines It would be highly appreciated if you tag your topics appropriately and use proper topic titles. Although this is not a hard requirement, it helps to maintain overview. Use the following template for this: [BUG] TOPIC_TITLE - for problematic code that will not work or has issues that you need assistance with. This type of topic must always contain a code snippet of the script in question. Most of the times, you will need to provide the entire script. [QUESTION] TOPIC_TITLE - scripting questions, including (but possibly not limited to): asking for help in understanding scripting principles, function or code usage, or if you wonder whether your approach to achieve something is the most optimal and efficient one. We are all learning and aid from more experienced scripters can be useful. Use code snippet tags. Always add your code (if applicable) in this uniform way. Click the ''< >'' shortcut in the text editor, as seen in below screenshot: Then put your code within the box that said button (< >) creates. Be sure to select Lua for highlighting from the drop-down list in bottom right corner for automatic syntax colouring, wiki links for built-in functions and events and other cool features. Please do not use loose [ code] tags for the sake of readability. Do not mass-quote code snippets, or else it would fill up the whole topic with repeats of the same code over and over again. Remove the code column from a previous quote before posting or limit your own quote by narrowing down the parts of code you are replying about. Quote selectively. Advice Last but not least, please try to explain your issue or question the best way you can. A clean and detailed topic can increase the chance that someone will sit down to analyse your problem and actually help you. Clear communication and description is also the key to attracting scripters who may potentially take a look for you. Note that a common request is to "post the full script" and that isn't without reason - problems often go deeper than you think (or the issue is structural / architectural of nature) and other scripters will find it difficult to help you debug or trace it without having a good picture of everything. Especially with questions regarding bugs or something not working as it's supposed to, you may have low or non-existent outreach from others if you're not providing full code. Similarly, also keep in mind posting screenshots (or lines) from debugscript, errors or warnings, that include the line number, you will need to number any script code you provide in your topic to ensure others can intepret it and find the corresponding erroring lines. Code of Conduct Treat everyone with respect, no matter their skill in scripting. If someone posts what you think is low level/''stupid'', remember that you have once been there as a novice scripter yourself and everyone should have a chance to learn. Instead of resorting to humiliating replies, think about how hard it is to learn how to script efficiently, and dedicate yourself even more to help them understand it. You might play a noticeable role in someone's future as MTA scripter (or who knows, maybe an even more prominent role later on too). Long story short, avoid making remarks or rude comments aimed at someone's skill level, incapabilities, etc. It is not appreciated neither by us Moderators nor by regular users of the forums. The Scripting section is not meant for those unwilling to learn, whose only intent is to try get others to finish the scripts they need, line by line. We see this happening way too often - someone with seemingly zero scripting skills does not react on-topic to the set of functions they can use that other users provide them, and does not seem to take any pushes in the right direction forward; they are just waiting for a collective effort from other scripters to develop what they want. This is what we do not want to see. Do not expect all the work to be done for you while you lean back. You should at least try to script it by yourself - users on this subforum are generally happy to help in any particular issue you come across while coding. If you see someone who keeps bumping their topic that is clearly oriented at letting his work be done by others, then please report the post. The bumping policy in scripting section is a bit different from other forum sections, because scripting topics serve as a sort of knowledge-base for those dealing with the same issue/question as described in existing topics. It is often suggested (and usual practise for many scripters) that prior to posting a new topic, someone searches the forums to see if their question has been asked/answered before. Therefore, you may bump old topics if you're certain your approach or solution/code is better than other posted answers, and if it's a fairly common question (not someone just asking how to have their own code fixed or similar case-specific topics). However, we the moderating team may still review if your posts are really useful bumps with new insights, and even if so, we can lock the topic to prevent derailing of an old topic/continuous posts. So expect your useful bumps to possibly be the last ever made in a certain topic (which means if you do it, do it well). If you believe a popular topic for a really common scripting problem should be unlocked for you to post input, or you wish to improve upon someone's earlier bump after which it was locked, then please use the Report button referring to this part of the regulations. No support is offered for leaked code or scripts (even if they only partially originate from a leak) and such topics will be locked and trashed on sight. If you notice a topic where something related is being asked, or other clandestine requests (such as questions how to decompile scripts, etc, anything with not-so-noble intentions) then please report the topic and do not reply as it may incite unnecessary arguments. Mention the source proving that it is a leaked code within your report, though you can omit that if you feel that it is fairly obvious that the resource/script was leaked. In the latter case however, keep in mind that we may not be aware of such a leak, so the Moderator who handles your report will have to take his judgement upon it if you do not provide evidence. Still, keep in mind that you should not openly accuse users who post pieces of your (or someone else's) code as per https://forum.multitheftauto.com/topic/46410-stolen-resource-accusations/. If this happens, simply report such posts. Failure to abide by the Code of Conduct may result in a forum punishment. If you notice anything that violates the Code of Conduct, please report those posts instead of enforcing the rules yourself. It just takes a few seconds, but greatly benefits the Section and makes it a better place to seek help from.
    1 point
  4. Hello everyone, 1 month ago i started working on a script which will allow you to build using custom objects in a limited zone/area, more information bellow. And today i'm releasing the script! CITY ZONES About: City is a 100% player built system used in City zones.. Players can buy zones and then build stuff in their zone, like a house or group/team base. City also allows you to interact with some of it's objects, like programmable doors. City Zone Command List: /zonedata ID - Get information about the specified City zone (Stand in a zone to get the ID) /markzone ID - Find a City zone on your map /buyzone - Buy the City zone that you're stood in /sellzone - Sell the City zone you're stood in back to the server /setzonename ID name - Name your City zone /setzonedelegate ID AccountName - Give or take away permission to edit and add objects /setzoneradio ID webAddressForRadio - Play music to everyone in your zone, to turn it off just do /Cityzoneradio ID /wipezoneobjects ID - Sells every object that is in your zone. /objectswithinzone ID - see how many objects are in a zone /zonedelegates - to see who you've delegated access to. /zonesforsale - to see if have one City to sell. The blip is a green house. City Building Command List: /addentity - View a list of entities, make sure your camera is over the area you want to build on first /delentity - Delete the selected entity /copyentity - Allows you to copy a specific entity /editzonedoor - Allows you to edit a programmable door and give/remove access to players to spawn at the spawn point /editobjecttexture - Allows you to modify the texture of any City object /saveobject - Saves the selected entity. /objectzonesetslowmove 0-10 - Allows you to choose how is the slow movement of the city object 'ALT' is. To edit an object press 'X' then click on the object. City Entity Distance Modifiers: Left Shift - Hold this key to move objects fast Left Alt - Hold this key to move objects slow Left Shift + Left Alt - Hold both keys to move super slow (num lock must be off) City Entity Controls: (These controls can be changed in MTA settings) Arrow up - Move object north Arrow down - Move object south Arrow right - Move object east Arrow left - Move object west Tip: Have your camera facing north so the arrow keys make the object go in the same direction Numpad Del - Tell the server to update + save the object Numpad 9 / 6 - Raise / Lower the object height Numpad 1 / 2 - Rotate on the X axis (not usually needed) Numpad 4 / 5 - Rotate on the Y axis (not usually needed) Mouse Scroll Up / Down - Rotate on the Z axis Admin Access: /zoneadder - Create a city zone/area with an editable price. /deletezone - Delete a city zone that you're stood in. Ability to edit any city zone object (Press 'X' then click on the object) /sellzone - Force sell a city zone that you're stood in. General functions used: Edit door - Ability to edit a city door Edit texture - Ability to edit a city object texture Zone adder - Adding a city zone/area. Custom Objects - More than 160 custom objects. (Total 10mb) LUA files: [CLIENT] entityDoors.lua - /editdoor panel. [CLIENT] entityTextures.lua - /edittex panel. [CLIENT] zones.lua - Zone lines + Zone radio. [CLIENT] CityEditPanel.lua - /addent panel. [CLIENT] zonesManagments.lua - /zoneadder panel. [SERVER] zones.slua - Zone adder + Most commands are here. [SERVER] ZonesControls.slua - Object controls. [SERVER] ZonesCore.slua - Place object + Delete object + Copy object with current texture. [SERVER] ZoneDb.slua - To save city objects + zones created. [SERVER] ZonesFunctions.slua - Most functions are here. [SERVER] ZonesImportDb.slua - Import/Insert table from/to database. [DB] objects.db - All created zone objects are saved here. [DB] zones.db - All created zones are saved here. Price: 35$ 20$ - [G2A.COM] Steam Gift Card 20 USD (Send me the mail you receive containing the code you have recieved to my email) - PM me or reply for more information if you are interested.
    1 point
  5. Hello everyone, nothing to say so. LUA: function dxDrawCircle( x, y, width, height, color, angleStart, angleSweep, borderWidth ) height = height or width color = color or tocolor(255,255,255) borderWidth = borderWidth or 1e9 angleStart = angleStart or 0 angleSweep = angleSweep or 360 - angleStart if ( angleSweep < 360 ) then angleEnd = math.fmod( angleStart + angleSweep, 360 ) + 0 else angleStart = 0 angleEnd = 360 end x = x - width / 2 y = y - height / 2 if not circleShader then circleShader = dxCreateShader ( "circle.fx" ) end dxSetShaderValue ( circleShader, "sCircleWidthInPixel", width ); dxSetShaderValue ( circleShader, "sCircleHeightInPixel", height ); dxSetShaderValue ( circleShader, "sBorderWidthInPixel", borderWidth ); dxSetShaderValue ( circleShader, "sAngleStart", math.rad( angleStart ) - math.pi ); dxSetShaderValue ( circleShader, "sAngleEnd", math.rad( angleEnd ) - math.pi ); dxDrawImage( x, y, width, height, circleShader, 0, 0, 0, color, true ) end function dxDrawRoundedRectangle( x, y, width, height, radius, color ) if ( radius >= width ) or ( radius >= height ) then dxDrawCircle( x - ( radius / 2 ), y - ( radius / 2 ) ) end -- The radius is relative to the height and width of the rectangle, so to avoid rectangles if the radius is bigger than the width or height then a complete circle is being drawn. dxDrawCircle( x + ( radius / 2 ), y + ( radius / 2 ), radius, radius, color, 270, 90 ) dxDrawCircle( x + ( radius / 2 ), ( y + height ) - ( radius / 2 ), radius, radius, color, 180, 90 ) dxDrawCircle( ( x + width ) - ( radius / 2 ), y + ( radius / 2 ), radius, radius, color, 0, 90 ) dxDrawCircle( ( x + width ) - ( radius / 2 ), ( y + height ) - ( radius / 2 ), radius, radius, color, 90, 90 ) dxDrawRectangle( x, y + ( radius / 2 ), width, ( height ) - ( radius ), color, true ) dxDrawRectangle( x + ( radius / 2 ), y , ( width ) - ( radius ), ( radius / 2 ), color, true ) dxDrawRectangle( x + ( radius / 2 ), ( y + height ) - ( radius / 2 ), ( width ) - ( radius ), ( radius / 2 ), color, true ) end CIRCLE.FX ( The one from the MTA Wiki ) float sCircleHeightInPixel = 100; float sCircleWidthInPixel = 100; float sBorderWidthInPixel = 10; float sAngleStart = -3.14; float sAngleEnd = 3.14; //------------------------------------------------------------------------------------------ // PixelShaderFunction // 1. Read from PS structure // 2. Process // 3. Return pixel color //------------------------------------------------------------------------------------------ float4 PixelShaderFunction(float4 Diffuse : COLOR0, float2 TexCoord : TEXCOORD0) : COLOR0 { float2 uv = float2( TexCoord.x, TexCoord.y ) - float2( 0.5, 0.5 ); // Clip unwanted pixels from partial pie float angle = atan2( -uv.x, uv.y ); // -PI to +PI if ( sAngleStart > sAngleEnd ) { if ( angle < sAngleStart && angle > sAngleEnd ) return 0; } else { if ( angle < sAngleStart || angle > sAngleEnd ) return 0; } // Calc border width to use float2 vec = normalize( uv ); float CircleRadiusInPixel = lerp( sCircleWidthInPixel, sCircleHeightInPixel, vec.y * vec.y ); float borderWidth = sBorderWidthInPixel / CircleRadiusInPixel; // Check if pixel is inside circle float dist = sqrt( dot( uv, uv ) ); if ( ( dist > 0.5 ) || ( dist < 0.5 - borderWidth ) ) return 0; else return Diffuse; } //------------------------------------------------------------------------------------------ // Techniques //------------------------------------------------------------------------------------------ technique tec0 { pass P0 { PixelShader = compile ps_2_0 PixelShaderFunction(); } }
    1 point
  6. السلام عليكم ورحمة الله وبركاته بدون مقدمات او ما الى غيره اضفط هنا لتحميل السكربت وش فيه يعني ؟ انا حاولت اسوي نظام حماية و سويت ذا وشفرت السكربت و الخ ابي منكم تجربون المود واللي يقدر يحل نظام الحماية اتمنى يقولي طبعاً في بداية تشغيل المود اذا ما سويت الحماية رح تقفل جميع الازرار ورح تسوي اشياء اخرى في السيرفر في حالة طفيت المود تقدر تسوي ريكونكت وكل شي بيرجع متل ما كان @Abdul KariM @Master_MTA @#Soking @#_iMr.[E]coo @#BrosS @MR.NaiF-MTA @coNolel @iMr.WiFi..! @Abu-Solo @AchrefF @Sha67 @iRamX @SoniX^ @~#[N]exT @Mhmd.z @#bazooka إذن ؟ !!
    1 point
  7. السلام عليكم ورحمة الله وبركاته كيف الطيبين .. ان شاء الله بألف خير كل عام وانتم بخير بمناسبة حلول الشهر الكريم شهر رمضان كنت غايب لفترة بسبب الدراسة والحمد لله خلصت ههههههههههه المهم .. في اثناء الدراسة برمجت مود بسيط لكنه مفيد صراحة لقيته مفيد بالنسبة لي فحبيت اطرحه عليكم وان شاء الله يعجبكم المود بكل بساطة متل ما في الصورة طيب وش المفيد ؟ سويت نظامين من الجداول واحد لقيمة عشوائية والآخر من اجل الماركرات و الاحداثيات الاخرى طيب ما اطول عليكم واتركم تكتشفو المود بنفسكم رابط التحميل إستغفر ربك ... طيب بعض الملاحظات - اللوحة تفتح من زر "ء" لكن تقدر تعدل عليها لأن المود ماهو مشفر - ما حبيت اسوي اهداءات لأن احس ان فيه ناس كثيرة تزعل من عدم ذكر اسمائها - الاهداءات لك ولكل من رأى الموضوع شكراً لكم علي المتابعة
    1 point
  8. getElementType ( source ) == 'player' 'onPlayerWasted !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    1 point
  9. فكرة انه مو مشفرة ما انصحك تقدر تخلي بس يشتغل الخود تحط رسالة بالشات وتسويها بملف مشفر !
    1 point
  10. يا ليت تستخدم <> عشان نقدر نقرأ الاكواد . اشوف الكود تمام .. شوف الديبوق في اي اخطاء من السكربت ! + tostring - tonumber ما يحتاج تستخدم
    1 point
  11. Thanks to both of you, I used @Simple01's code as I did something similar when recording total drift score some time ago and was more familiar with it being client side. 1. Recorded the distance client-side 2. Sent it to server-side with events (those things are priceless) Client: -- Used to record distance passed with the specific vehicle category. local totalAircraft_km = 0 local partialAircraft_km = 0 local tickAircraft_km = 0 local totalBoat_km = 0 local partialBoat_km = 0 local tickBoat_km = 0 local totalBike_km = 0 local partialBike_km = 0 local tickBike_km = 0 local totalCar_km = 0 local partialCar_km = 0 local tickCar_km = 0 local totalBicycle_km = 0 local partialBicycle_km = 0 local tickBicycle_km = 0 function handleSpeed() local car = getPedOccupiedVehicle(localPlayer) local id if car then id = getElementModel(car) end -- distanceByAircraft if id == 592 or id == 577 or id == 511 or id == 512 or id == 593 or id == 520 or id == 553 or id == 476 or id == 519 or id == 460 or id == 513 or id == 548 or id == 425 or id == 417 or id == 487 or id == 488 or id == 497 or id == 563 or id == 447 or id == 469 then if car and getVehicleOccupant(car, 0) == localPlayer then if tickAircraft_km <= 0 and getVehicleEngineState(car) then tickAircraft_km = getTickCount() end if getTickCount() - tickAircraft_km >= 1000 then local sx, sy, sz = getElementVelocity(car) local kms = ((sx * sx + sy * sy + sz * sz)^(0.5) * 1000) / 20650 if partialAircraft_km + kms >= 1 then partialAircraft_km = partialAircraft_km + kms - 1 totalAircraft_km = totalAircraft_km + 1 triggerServerEvent("distanceByAircraft", localPlayer, totalAircraft_km) else partialAircraft_km = partialAircraft_km + kms end tickAircraft_km = getTickCount() end end -- distanceByBoat elseif id == 472 or id == 473 or id == 493 or id == 595 or id == 484 or id == 430 or id == 453 or id == 452 or id == 446 or id == 454 then if car and getVehicleOccupant(car, 0) == localPlayer then if tickBoat_km <= 0 and getVehicleEngineState(car) then tickBoat_km = getTickCount() end if getTickCount() - tickBoat_km >= 1000 then local sx, sy, sz = getElementVelocity(car) local kms = ((sx * sx + sy * sy + sz * sz)^(0.5) * 1000) / 20650 if partialBoat_km + kms >= 1 then partialBoat_km = partialBoat_km + kms - 1 totalBoat_km = totalBoat_km + 1 triggerServerEvent("distanceByBoat", localPlayer, totalBoat_km) else partialBoat_km = partialBoat_km + kms end tickBoat_km = getTickCount() end end -- distanceByBike elseif id == 581 or id == 509 or id == 481 or id == 462 or id == 521 or id == 463 or id == 510 or id == 522 or id == 461 or id == 448 or id == 468 or id == 586 then if car and getVehicleOccupant(car, 0) == localPlayer then if tickBike_km <= 0 and getVehicleEngineState(car) then tickBike_km = getTickCount() end if getTickCount() - tickBike_km >= 1000 then local sx, sy, sz = getElementVelocity(car) local kms = ((sx * sx + sy * sy + sz * sz)^(0.5) * 1000) / 20650 if partialBike_km + kms >= 1 then partialBike_km = partialBike_km + kms - 1 totalBike_km = totalBike_km + 1 triggerServerEvent("distanceByBike", localPlayer, totalBike_km) else partialBike_km = partialBike_km + kms end tickBike_km = getTickCount() end end -- distanceByCar elseif id == 602 or id == 496 or id == 401 or id == 518 or id == 527 or id == 589 or id == 419 or id == 587 or id == 533 or id == 526 or id == 474 or id == 545 or id == 517 or id == 410 or id == 600 or id == 436 or id == 439 or id == 549 or id == 491 or id == 485 or id == 431 or id == 438 or id == 437 or id == 574 or id == 420 or id == 525 or id == 408 or id == 552 or id == 416 or id == 433 or id == 427 or id == 490 or id == 528 or id == 407 or id == 544 or id == 523 or id == 470 or id == 596 or id == 598 or id == 599 or id == 597 or id == 432 or id == 601 or id == 428 or id == 499 or id == 609 or id == 498 or id == 524 or id == 532 or id == 578 or id == 486 or id == 406 or id == 573 or id == 455 or id == 588 or id == 403 or id == 423 or id == 414 or id == 443 or id == 515 or id == 514 or id == 531 or id == 456 or id == 459 or id == 422 or id == 482 or id == 605 or id == 530 or id == 418 or id == 572 or id == 582 or id == 413 or id == 440 or id == 543 or id == 583 or id == 478 or id == 554 or id == 579 or id == 400 or id == 404 or id == 489 or id == 505 or id == 479 or id == 442 or id == 458 or id == 536 or id == 575 or id == 534 or id == 567 or id == 535 or id == 576 or id == 412 or id == 402 or id == 542 or id == 603 or id == 475 or id == 429 or id == 541 or id == 415 or id == 480 or id == 562 or id == 565 or id == 434 or id == 494 or id == 502 or id == 503 or id == 411 or id == 559 or id == 561 or id == 560 or id == 506 or id == 451 or id == 558 or id == 555 or id == 477 or id == 441 or id == 464 or id == 594 or id == 501 or id == 465 or id == 564 or id == 606 or id == 607 or id == 610 or id == 584 or id == 611 or id == 608 or id == 435 or id == 450 or id == 591 or id == 590 or id == 538 or id == 570 or id == 569 or id == 537 or id == 449 or id == 568 or id == 424 or id == 504 or id == 457 or id == 483 or id == 508 or id == 571 or id == 500 or id == 444 or id == 556 or id == 557 or id == 471 or id == 495 or id == 539 then if car and getVehicleOccupant(car, 0) == localPlayer then if tickCar_km <= 0 and getVehicleEngineState(car) then tickCar_km = getTickCount() end if getTickCount() - tickCar_km >= 1000 then local sx, sy, sz = getElementVelocity(car) local kms = ((sx * sx + sy * sy + sz * sz)^(0.5) * 1000) / 20650 if partialCar_km + kms >= 1 then partialCar_km = partialCar_km + kms - 1 totalCar_km = totalCar_km + 1 triggerServerEvent("distanceByCar", localPlayer, totalCar_km) else partialCar_km = partialCar_km + kms end tickCar_km = getTickCount() end end -- distanceByBicycle elseif id == 509 or id == 481 or id == 510 then if car and getVehicleOccupant(car, 0) == localPlayer then if tickBicycle_km <= 0 and getVehicleEngineState(car) then tickBicycle_km = getTickCount() end if getTickCount() - tickBicycle_km >= 1000 then local sx, sy, sz = getElementVelocity(car) local kms = ((sx * sx + sy * sy + sz * sz)^(0.5) * 1000) / 20650 if partialBicycle_km + kms >= 1 then partialBicycle_km = partialBicycle_km + kms - 1 totalBicycle_km = totalBicycle_km + 1 triggerServerEvent("distanceByBicycle", localPlayer, totalBicycle_km) else partialBicycle_km = partialBicycle_km + kms end tickBicycle_km = getTickCount() end end end end addEventHandler("onClientRender", root, handleSpeed) Server: -- distanceByAircraft addEvent("distanceByAircraft", true) function distanceByAircraft(currentDistance) local playeraccount = getPlayerAccount(source) if isGuestAccount(playeraccount) then return end local prevDistance = tonumber(getAccountData(playeraccount, "distanceByAircraft") or 0) local newDistance = prevDistance + tonumber(currentDistance) setAccountData(playeraccount, "distanceByAircraft", newDistance) setElementData(source, "distanceByAircraft", newDistance) end addEventHandler("distanceByAircraft", root, distanceByAircraft) -- distanceByBoat addEvent("distanceByBoat", true) function distanceByBoat(currentDistance) local playeraccount = getPlayerAccount(source) if isGuestAccount(playeraccount) then return end local prevDistance = tonumber(getAccountData(playeraccount, "distanceByBoat") or 0) local newDistance = prevDistance + tonumber(currentDistance) setAccountData(playeraccount, "distanceByBoat", newDistance) setElementData(source, "distanceByBoat", newDistance) end addEventHandler("distanceByBoat", root, distanceByBoat) -- distanceByBike addEvent("distanceByBike", true) function distanceByBike(currentDistance) local playeraccount = getPlayerAccount(source) if isGuestAccount(playeraccount) then return end local prevDistance = tonumber(getAccountData(playeraccount, "distanceByBike") or 0) local newDistance = prevDistance + tonumber(currentDistance) setAccountData(playeraccount, "distanceByBike", newDistance) setElementData(source, "distanceByBike", newDistance) end addEventHandler("distanceByBike", root, distanceByBike) -- distanceByCar addEvent("distanceByCar", true) function distanceByCar(currentDistance) local playeraccount = getPlayerAccount(source) if isGuestAccount(playeraccount) then return end local prevDistance = tonumber(getAccountData(playeraccount, "distanceByCar") or 0) local newDistance = prevDistance + tonumber(currentDistance) setAccountData(playeraccount, "distanceByCar", newDistance) setElementData(source, "distanceByCar", newDistance) end addEventHandler("distanceByCar", root, distanceByCar) -- distanceByBicycle addEvent("distanceByBicycle", true) function distanceByBicycle(currentDistance) local playeraccount = getPlayerAccount(source) if isGuestAccount(playeraccount) then return end local prevDistance = tonumber(getAccountData(playeraccount, "distanceByBicycle") or 0) local newDistance = prevDistance + tonumber(currentDistance) setAccountData(playeraccount, "distanceByBicycle", newDistance) setElementData(source, "distanceByBicycle", newDistance) end addEventHandler("distanceByBicycle", root, distanceByCar) And then used the element data to show the correct info on the GUI. PS: I'm pretty sure I could have avoided like 70% of the code as it's the same but I prefer to play it safe
    1 point
  12. You could use this. local total_km, partial_km, tick_km = 0, 0, 0 function handleSpeed() if ( getPedOccupiedVehicle( localPlayer ) and getVehicleOccupant( getPedOccupiedVehicle( localPlayer ), 0 ) == localPlayer ) then local theVehicle = getPedOccupiedVehicle( localPlayer ) if ( tick_km <= 0 ) and ( getVehicleEngineState( vehicle ) ) then tick_km = getTickCount() end if ( getTickCount() - tick_km >= 1000 ) then local sx, sy, sz = getElementVelocity ( theVehicle ) local kms = ( ( ( sx * sx ) + ( sy * sy ) + ( sz * sz ) ) ^ ( 0.5 ) ) * 1000 / 3600 -- This would be the most realistic way but it add's up very fastly so better up the number that is dividing. if ( partial_km + kms >= 1 ) then partial_km = ( partial_km + kms ) - 1 total_km = total_km + 1 else partial_km = partial_km + kms end tick_km = getTickCount() end end end addEventHandler( "onClientRender", root, handleSpeed )
    1 point
  13. Firstly it "Warning's Long Execution" because its not for Map Editor Secondly: Its in one dimension since its like a placed map objects Thirdly: Map Editor sets your dimension to 500? i think or something different , you can change that in map editor files
    1 point
  14. يعطيك العافية @Master_MTA @#BrosS
    1 point
  15. local totalDis local lastX, lastY, lastZ function startJourney() if not lastX then -- if there is no previous position save the current lastX, lastY, lastZ = getElementPosition(vehElement) end setTimer(function() local currX, currY, currZ = getElementPosition(vehElement) -- get the current position of the vehicle totalDis = getDistanceBetweenPoints3D(currX, currY, currZ, lastX, lastY, lastZ ) -- calculate the distance between the current and the last and add it to the totalDistance lastX, lastY, lastZ = currX, currY, currZ -- update the last position with the current end, 2000, 0) -- 2 sec infinite timer, could be increased/decreased, the smaller it is the more accurate results you get end I used something like that in one of my projects, not saying it's the best solution, but it was working fine for me.
    1 point
  16. التوقيع ! https://forum.multitheftauto.com/settings/signature
    1 point
  17. تم وقالي يفك تشفير الاصدار 4.9 وما تحت يعني مايفك التشفير الجديد فقط السكربتات القديمة اللي يفكها ومعظمها يحذف شي اكواد او يستبدلهم برموز غريبة
    1 point
  18. ما عندك مشكلة يا حبيبي ولا يهمكـ انا يمكن كنت غلطان : )
    1 point
  19. Unlike the last time it was hidden to work on the post, today these regulations really take effect. As written in main post, there's a 1-week cooldown period in which we won't enforce most regulations listed here, but only politely warn users breaking them. This is to let everyone adapt and get used to the regulations & guidelines.
    1 point
  20. معلش الامتحانات أثرت عليك
    1 point
  21. تشفيرك سهل ضض انصحك تغيره لان نقدر نفك تشفيره
    1 point
  22. Aprovechando que hoy he tenido tiempo libre y me he descargado el 3DS Max, quisiera compartir aquí en el foro algunos de los proyectos que realizaré en él para que otra gente pueda usarlos en servidores, para uso personal, etc. De momento haré mods simples como edits de skins de GTA:SA low poly (sin lag) hasta que vuelva a pillarle el truco. Aquí dejo mi primer trabajo hecho hoy: https://www.dropbox.com/s/1gxo9xvbt6xtgqo/bmost-id15.rar?dl=0
    1 point
  23. It is, yes. This is how you start your MTA server with screen: SCREEN -S myserver ./mta-server -> myserver is the name of your screen (like a variable, it can be anything), you can go back to it any time with this command: SCREEN -R myserver -> this command will open up the same screen again, to detach the screen press CTRL + A then CTRL + D (this will exit from the screen, but it will keep running in the background) To completely stop the server, you can press CTRL + C to shutdown the server when in SCREEN mode
    1 point
  24. 1 point
  25. @iMr.WiFi..! في طريقة ادق من هذي واصلا مايحتاج الحدث لان اقدر اسوي رندر واتحقق ان الاعب متحرك عن طريق اليوسفل فنكشن isElementMoving واسوي ترايقر افنت وخلاص وعندك غلط مفروض تتحقق ان الزد بعد مايساوي صفر لان الاعب ممكن يطلع فوق وكذا تحرك والحدث ماراح يشتغل
    1 point
  26. لا في ال الاش تي ام ال ماتستعمل الاحداثيات فقط الطول والعرض والمكان
    1 point
  27. The scope of the variable "weapon" is in the function hydraFunction as it's set to be a local variable, so hydraFiring and hydraStopping is outside the scope. You're are already saving the weapon element to an elementData, why not use that instead of the "weapon" variable? Try this: function hydraFunctions() local vehicle = getPedOccupiedVehicle(localPlayer) if(vehicle)then if getElementModel(vehicle) == 520 then outputChatBox ("Hydra guns installed") toggleControl ( "accelerate", true ) toggleControl ( "brake_reverse", true ) toggleControl ( "vehicle_secondary_fire", false ) toggleControl ( "vehicle_fire", false ) setControlState ( "special_control_up", true) toggleControl ( "special_control_down", false) local x, y, z = getElementPosition(vehicle) local weapon = createWeapon("uzi", x, y, z) local weaponHydraR = setElementData(vehicle, "weaponHydraR", weapon, true) attachElements ( weapon, vehicle, 0, 4, 1, 0, 0, 90) setWeaponClipAmmo(weapon, 500) setWeaponFiringRate(weapon, 90) end end end addEventHandler ( "onClientPlayerVehicleEnter", getLocalPlayer(), hydraFunctions ) function hydraFiring() local vehicle = getPedOccupiedVehicle(localPlayer) if(vehicle)then if getElementModel(vehicle) == 520 then if getElementData(vehicle, "weaponHydraR", true ) then setWeaponState(getElementData(vehicle, "weaponHydraR"), "firing") -- Can't seem to find the weapon outputChatBox ("guns activated") end end end end function hydraStopping() local vehicle = getPedOccupiedVehicle(localPlayer) if(vehicle)then if getElementModel(vehicle) == 520 then if getElementData(vehicle, "weaponHydraR", true ) then setWeaponState(getElementData(vehicle, "weaponHydraR"), "ready") -- Can't seem to find the weapon outputChatBox ("guns deactivated") end end end end bindKey("mouse1", "down", hydraFiring) bindKey("mouse1", "up", hydraStopping) bindKey("lctrl", "down", hydraFiring) bindKey("lctrl", "up", hydraStopping)
    1 point
  28. addEventHandler("onClientClick",root, function(click,state) if click == "mouse1" and state == "up" then setWeaponState(weapon,"firing") else setWeaponState(weapon,"ready") end end )
    1 point
  29. Using elementdata is fine, just make sure you disable the syncronization when you don't need it. ElementData is absolute not for important information. It is very foolish to save passwords or similar data in it. bool setElementData ( element theElement, string key, var value [, bool synchronize = true ] ) You could also use: bool setElementParent ( element theElement, element parent ) element getElementParent ( element theElement ) table getElementChildren ( element parent [, string theType = nil ] ) element getElementChild ( element parent, int index ) Or learn tables.
    1 point
  30. setWeaponState(weapon, "firing") ??
    1 point
  31. Как я и обещал – публикую статью о некоторых возможностях шейдера и MTA. Речь пойдёт об изменении цвета нужных нам компонентов автомобиля (а точнее текстуры, которые наложены на полигоны этих компонентов) с помощью пиксельного и вершинного шейдеров. В качестве примера, я буду использовать стандартный автомобиль Sultan, а перекрашивать я ему буду диски на колёсах. На самом деле данный метод будет работать на любых объектах игры, будь-то это объекты ландшафта или же персонажи. Но так как сегодня мы будем работать с ZModeler 2, то их рассматривать мы не будем (так как ZM2 не умеет работать с костями персонажей и плохо экспортирует обычные объекты). Сразу оговорюсь – имеется ввиду, что вы уже владеете основами работы с ZModeler 2, поэтому детально рассматривать эту программу мы не будем. К счастью русскоязычных уроков по ZM2 очень много. Подготовка И так, мы имеем проект с уже готовым автомобилем, который без проблем работает в нашей любимой игре. Теперь можно приступать к делу. Для того чтобы MTA смогла найти с каким материалом ей работать — мы должны передать ей имя с помощью engineApplyShaderToWorldTexture. При экспорте модели из ZModeler 2 все материалы принимают название первой текстуры в самом материале. Т.е. если ваша текстура называется WHEELS.tga – то материал будет называться WHEELS. Это очень важно, так как если вы просто покрасите колёса и не установите текстуру (хотя бы в 1px), то материал в игре будет называться unnamed, как и все у которых нет текстур. Реализация Так уж случилось, что диски моего автомобиля имеют текстуру vehiclegeneric256, которая не является уникальной (ею окрашены ещё другие части автомобиля) – это не редкое явление. Чтобы решить эту проблему, придётся создать копию этой текстуры и назвать так как нам нужно. Далее мы создаём новый материал, называем его как нам удобно (я предпочитаю чтобы имена материалов и имена текстур совпадали), добавляем новую текстуру, выделяем нужные нам полигоны и применяем к ним наш материал. Экспортируем нашу модель.. и а этом наша работа с ZModeler2 закончена. Пишем шейдер Сам по себе шейдер будет очень простой, мы создадим одну переменную которой мы сможем задавать значения цвета из скрипта, все остальные данные нам предоставит MTA. Для загрузки шейдера я использовал следующий скрипт (он очень простой, поэтому отдельно его рассматривать мы не будем): addEventHandler( "onClientResourceStart", resourceRoot, function() local shader = dxCreateShader( "color.fx" ); if shader then dxSetShaderValue( shader, "color", { 1.0, 0.5, 0.0 } ); engineApplyShaderToWorldTexture( shader, "wheels256" ); end end ); Теперь займёмся написанием самого шейдера. Объявляем переменные: float4 color = 1; sampler Sampler0 : register( s0 ); В качестве цвета мы используем переменную color - её значение мы будем устанавливать с помощью engineApplyShaderToWorldTexture Теперь нам необходимо взять текущий цвет пикселя и «смешать» его с нашим цветом (color): struct PSInput { float2 TexCoord : TEXCOORD0; }; float4 PixelShaderFunction( PSInput PS ) : COLOR0 { float4 texColor = tex2D( Sampler0, PS.TexCoord ); texColor *= color; return texColor; } Всё что и делает этот шейдер – просто перекрашивает пиксели текстуры. Как видно мы не учитываем освещение из-за чего наши колёса будут светиться в темноте как огни. И тут на помощь к нам приходит mta-helper.fx написанный нашими любимыми The MTA Team =) Так же они для нас написали замечательную функцию которая просчитывает дифьюзный цвет автомобиля с учётом глобального затенения мира – MTACalcGTAVehicleDiffuse. Функция первым аргументом требует нормали вершин. Так как пиксельный шейдер работает непосредственно с изображением, информацию о нормалях мы не имеем. Для этого нам придётся написать вершинный шейдер. Исправленный код шейдера: #include "mta-helper.fx" float4 color = 1; sampler Sampler0 : register( s0 ); struct VSInput { float4 Position : POSITION0; float3 Normal : NORMAL0; float4 Diffuse : COLOR0; float2 TexCoord : TEXCOORD0; }; struct PSInput { float4 Position : POSITION0; float2 TexCoord : TEXCOORD0; float4 Diffuse : COLOR0; }; PSInput VertexShaderFunction( VSInput VS ) { PSInput PS = (PSInput)0; float4 worldPosition = mul( VS.Position, gWorld ); float4 viewPosition = mul( worldPosition, gView ); float4 position = mul( viewPosition, gProjection ); PS.Position = position; PS.TexCoord = VS.TexCoord; PS.Diffuse = MTACalcGTAVehicleDiffuse( VS.Normal, VS.Diffuse ); return PS; } float4 PixelShaderFunction( PSInput PS ) : COLOR0 { float4 texColor = tex2D( Sampler0, PS.TexCoord ); texColor *= PS.Diffuse * color; return texColor; } technique { pass P0 { VertexShader = compile vs_2_0 VertexShaderFunction(); PixelShader = compile ps_2_0 PixelShaderFunction(); } } В вершинном шейдере мы создаем новый объект типа PSInput, который будет подаваться на вход в нашу функцию PixelShaderFunction. Так как объект изначально не имеет никаких данных, наша задача передать их, как мы и сделали это с TexCoord, Diffuse и Position. Так как основной задачей вершинного шейдера является установка вершин, то он должен определить семантику POSITION для выходного параметра. В нашем случае это Position. Чтобы получить правильную позицию вершины для пиксельного шейдера, мы умножаем её на мировую матрицу объекта (gWorld), затем на матрицу вида камеры (gView), а затем и на матрицу проекции камеры (gProjection). Далее всё просто, с помощью функции написанной разработчиками MTA мы просчитываем новый цвет и передаём в Diffuse. В пиксельном шейдере мы просто умножаем полученный Diffuse на наш color, вот собственно вот и всё. Пишем скрипт для шейдера Скрипт который я использовал выше не подходит для работы на реальном сервере, так как не поддерживает работу с несколькими объектами, ибо шейдер глобальный, а значит цвет колёс у всех машин будет один. Для этого нам нужно для каждого автомобиля создавать новый объект шейдера, который будет иметь своё значение цвета. Хранить информацию о цвете колёс мы будем в ElementData в виде таблицы – это позволит устанавливать цвет с серверной стороны (для этого мы будем отслеживать событие onClientElementDataChange). Так же мы будем отслеживать события onClientElementStreamIn, onClientElementStreamOut и onClientElementDestroy. Событие onClientElementStreamIn необходимо нам для того чтобы создать шейдер когда автомобиль попадёт в стример клиента, остальные два – для удаления шейдера. Скрипт шейдера: local vehicles = {}; function CreateVehicleShader( vehicle ) local color = getElementData( vehicle, "WheelsColor" ); if color then local shader = dxCreateShader( "color.fx" ); if shader then vehicles[ vehicle ] = shader; dxSetShaderValue( shader, "color", color ); engineApplyShaderToWorldTexture( shader, "wheels256", vehicle ); return true; end end return false; end function CheckVehicleShader( element ) local vehicle = element or source; if vehicle and getElementType( vehicle ) == "vehicle" then if vehicles[ vehicle ] then return true; end return CreateVehicleShader( vehicle ); end return false; end function DestroyVehicleShader( element ) local vehicle = element or source; if vehicles[ vehicle ] then destroyElement( vehicles[ vehicle ] ); vehicles[ vehicle ] = NULL; end end addEventHandler( "onClientElementStreamIn", root, CheckVehicleShader ); addEventHandler( "onClientElementStreamOut", root, DestroyVehicleShader ); addEventHandler( "onClientElementDestroy", root, DestroyVehicleShader ); addEventHandler( "onClientElementDataChange", root, function( key, oldValue ) if key == "WheelsColor" and getElementType( source ) == "vehicle" and CheckVehicleShader( source ) then dxSetShaderValue( vehicle[ source ], "color", getElementData( source, "WheelsColor" ) ); end end ); addEventHandler( "onClientResourceStart", resourceRoot, function() for i, vehicle in ipairs( getElementsByType( "vehicle", root, true ) ) do CheckVehicleShader( vehicle ); end end ); Как можно было заметить, функция CreateVehicleShader создаёт шейдер для нашего автомобиля. В случае успеха возвращает true. Вызов функции происходит только из CheckVehicleShader - она проверяет наличие шейдера для автомобиля, если его нет - создаёт его. В случае успеха так же возвращает true. Так как при старте ресурса в стримере уже могут быть автомобили и они могут иметь информацию о цвете (WheelsColor), мы используем событие onClientResourceStart для проверки всех автомобилей, что находятся в стримере. onClientElementDataChange мы отслеживаем на случай изменения информации о цвете со стороны сервера. Так как изначально её может не быть, то шейдер не будет создан при старте ресурса или когда автомобиль попадёт в стример игрока - для этого у нас есть функция CheckVehicleShader.
    1 point
  32. Stolen resource accusations ARE NOT ALLOWED. Some users are coming into this forum and accusing servers of stealing resources. This obviously causes endless pages of fighting. Guilty or not, they make the accused server look guilty. Beyond the security measures provided by MTA it is your responsibility to secure your resources. Most of the problems arising from your failure to do so, aren't things MTA developers or support staff can arbitrate. If there is a problem with a server somehow abusing the server list (ie cloning another server name), then file a moderation report through https://forum.multitheftauto.com/topic/26205-server-list-spam/ and we will consider that. We will also consider invididual reports about leaked or stolen gamemodes, just don't post it in public and cause drama all over the forums. Join Discord and request to be added to private support — do not send messages to me.
    1 point
×
×
  • Create New...