Leaderboard
Popular Content
Showing content with the highest reputation on 23/04/21 in all areas
-
MAP Converters Some basic map converters that may be useful. https://mtaclub.eu/converters Please let me know if you find a bug!1 point
-
Tools TXD Workshop or any IMG editor Steve M's collision editor Any text editor i.e notepad Extracting files After installing SAMP, open SAMP.IMG with any IMG editor, i.e TXD Workshop. Select everything and extract to a new folder on your computer. This should contain DFF, COL, TXD and map files IPL and IDE. DFF A DFF can be extracted right out of the IMG and readily used TXD Not all SAMP models use custom textures - a lot of them use textures from the base game, so check their model name in SAMP.ide or dev.prineside in order to locate the .txd file COL All SAMP models uses custom collisions. They are stored in .col archives which can be opened with Steve M's collision editor. The collision is named the same as the DFF model. To extract it, select it and right click 'export single'.1 point
-
آلسسلآم عليكم ورحمة الله وبركاته تم بعون الله إفتتاح سيرفر عرب لايف وهو سيرفر عربي جديد للهجوله والحرب والفعاليات ويوجد به حصريات كثيرة وجميلة إن شاء الله تعجبكم وايضاً السيرفر فيه القوات والعصابات ، القوات هم : الشرطة ، السوات ، الاف بي اي ، الارمي كيفية الدخول للسيرفر : في مربع البحث اكتب : عرب لايف أو ادخل الاي بي اي بي السيرفر : mtasa://78.47.204.80:30715 وبمناسبة شهر رمضان الكريم تم إضافة المسجد العربي : نترككم لبعض الصور مكان الوضوء المسجد من الداخل للإنتقال للمسجد توجه إلى اف6 / الاماكن / المسجد العربي وللتعرف اكثر ادخل ديسكورد السيرفر الخاص بنا ، فيه قوانين السيرفر واخبار السيرفر والتقديم لقوات الشرطة هناك ايضاً يشرفنا ويسعدنا وجودكم معنا : https://discord.gg/EURdqAcr4D وشكرآآآ لكممم ?1 point
-
How to create a simple Soccer Field, only using native gta objects? it's not that hard for me to imagining, i love imagining. I hope you enjoy this video! This map is in a new city map that i'm currently working on! I didn't define the city name yet, maybe you have suggestions? Don't forget to subscribe and leave a like to video for support1 point
-
Olá. Sim, é possível. Fiz até um código de teste. A granada explode 500ms após ser lançada. addEventHandler("onClientProjectileCreation", root, function(creator) iprint(getProjectileType(source)) if getProjectileType(source) == 16 then setProjectileCounter(source, 500) end end) Funções: getProjectileType - para obter o tipo de projétil. setProjectileCounter - o tempo para explodir. Evento: onClientProjectileCreation - o evento é client-side, porém ele sincroniza para todos assim que alguém cria um projétil; seja molotov, granada, basuca.1 point
-
@xLiveزيادة على شرح الأخ قسم شروحات البرمجة فيه أغلب الأشياء لو أخذت لفه على القسم بتحصل شروحات، وذا موضوع يخص الإليمينت داتا :1 point
-
[Tutorial] PHP SDK Hi everybody! Today, it's the new year and i will make a tutorial for this community... It's my gift This tutorial is to teach to you how use the PHP SDK and what we can do with it. The tutorial is offered by MTAScripts.net. Enjoy Summary What is the PHP SDK What we can do with it How to install How to use (SERVER) How to use (WEB) Download a demo What is the PHP SDK To begin, PHP is a dynamic programming language web. Why we say dynamic ? Because we can interact with the user and the webserver. The PHP is the principal dynamic language used in the web with the HTML. We can call this language "SUPER PHP" because he can make everything... Examples: Facebook.com MTASA.com Twitter.com Every forums... And more Okey, we know what is the PHP, now the SDK ? SDK mean Software Development Kit, it's a library allow to developpers to make his applications. Multiple plateforms propose his SDK. Just search on Google Examples: Facebook SDK Have so much... Search on Google (Google have too his SDK) For continue this tutorial, you must download the PHP SDK from MTA. Download What we can do with it The PHP SDK from MTA offer much possibility. You can do everything with it if you have a great imagination Examples ? Login the player When the user join the server and he must login, if he have allready a login in the forum. We login the player with it And if he don't have, we create a new account in the server AND in the forum Stats of the player If the player play in the server and if he have an account in the server and the forum. We can show the stats of the player in the forum. Facebook This is more hard but ITS POSSIBLE ! If the player is logged in Facebook, the server send a request in the web and the web send a request to Facebook. If Facebook confirm, Facebook send informations to the webserver and the server will return this. So if you have an login panel, you can make a button "Login with Facebook". I don't will write my ideas, find yours So you can see, if you have great ideas... You can make some big things How to install We attack ! First, you must: A website A FTP account of the website Client FTP (Filezilla, ...) The library PHP SDK For this tutorial, i will use a fake website. Now we can start You must create a folder in the root of your website. We will can him "MTA" Result: http://www.yourwebsite.com/MTA Now, we will create a new folder in the folder MTA We call him "sdk". Result: http://www.yourwebsite.com/MTA/sdk Now your extract the mtaphpsdk_0.4.zip file into sdk folder. You will have much files in this folder. The principal file is mta_sdk.php. Now you can access to the sdk via the web. Result: http://www.yourwebsite.com/MTA/sdk/mta_sdk.php If you don't have this result, try again Now, you create a new PHP File. Every PHP files have the extention ".php" or ".php3" (for the new version) You go to the MTA folder (http://www.yourwebsite.com/MTA) and you create a PHP file with the name "test" Result: http://www.yourwebsite.com/MTA/test.php You open this file with your text editor (Notepad++, Eclypse, Sublime Text, ...) We will include the library to the file. Before we start to include, you will start the php file. For do it you write the balise PHP Start: <?php Close: ?> <?php -- Your code here ?> We have start the PHP file, now we want include "mta_sdk.php" to our file "test.php". For do it, you must use the function include() For informations, every functions on PHP must finish with ";" Now we include the file using include() <?php require "sdk/mta_sdk.php"; ?> The library is successfully inclued, now our library are installed If you want be sure, you can access to this file (http://www.yourwebsite.com/MTA/test.php) If you have an error, try again How to use (Server) Ah The LUA part For start, you must create an resource in your server (local or not) We will call him... "test". You know how create an resource, if you don't know.. You are in the S.H.I.T In your resource, you will have 3 files Meta.xml Client.lua Server.lua <meta> <info name="My Test Script" author="FatalTerror" description="My first resource with PHP SDK" version="1.0.0" type="script"></info> <script src="client.lua" type="client"></script> <script src="server.lua" type="server"></script> </meta> Your client and server files are empy for a moment. Before we start ! You must give admin right to the resource, we will use a function require admin rights. You can do it with the Admin Panel or in the ACL.xml More infos: Wiki Page To start, you open the server.lua with your text editor and you write it. addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() end) function result() end Very simple code, 1 event when the resource start and a function "result". For call an file in the web, we use the function callRemote(). So, we will use this function with basic parameters. bool callRemote ( string URL, callback callbackFunction, [ arguments... ] ) Explain: The url is the PHP file you want call. The callback function is the function will call the website when the website return parameters. The arguments are the infos you will send to the website. Write it into the event handler. addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() callRemote ("http://www.yourwebsite.com/MTA/test.php", result, "Hello") end) This will send the argument "Hello" to the test.php file. We will see in the next step how get this argument in PHP file. Imagine... We send 1 argument to the web and we want get 1 other argument (the name of ... my cat, YES My cat rockz ! ) The PHP file will return this argument and we will get it via the result function. Remember? This function alone... (Poor function...) function result(value) if value ~= "ERROR" then end end end If have an value, we continue Now we have the cat's name, we show it with a simple outputChatBox() function result(value) if value ~= "ERROR" then outputChatBox("Hello Mr."..value, getRootElement()) end end Great, we have finish this part. You can see, ITS SIMPLE OF SIMPLE How to use (Web) The web part start ! Get ready...Prepare your keyboard . GO ! To start, open your test.php file with your text editor. And normally, we had already written the code in the file. After the include (remember?) we will get the argument sended via the server. How ? Using the mta::getInput() ! This function get arguments in an array. $table = mta::getInput(); Yeah ! We have our table with informations You are alive ? Okey ! $table = mta::getInput(); $text = $table[0]; Hm.. We get the argument of the table using this method and we set the argument into $text. Small check if have an value... $table = mta::getInput(); $text = $table[0]; if(isset($text)){ } Great.. We give a name of the cat ? Let me search.. Padawan ? $table = mta::getInput(); $text = $table[0]; if(isset($text)){ $cat = "Padawan"; } Now we return $cat to the server using the function mta::doReturn() $table = mta::getInput(); $text = $table[0]; if(isset($text)){ $cat = "Padawan"; mta::doReturn($cat); } Perfect ! Now when you start the script, he will send 1 info to the website and the website will return a thing... and this thing is the name of my cat And when the server have the name of the cat, he say hello to him Try it Schema Example 1: Use PHP/MYSQL In this example, we will see what we can do with the PHP & the database MySQL. Here, isn't the MySQL of the server but of the website. Require things: MySQL database Read the tuto OK, let's start. In this tutorial, we will make list of who is online in your server and store it on database. And for finish, show it. First thing we will do, create a table in the MYSQL Database. For that, we will store 3 things. ID Player name Serial Why the serial ? I don't know but it's usefull to store it SQL Code: CREATE TABLE `DATABASE_NAME`.`players` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `player` TEXT NOT NULL , `serial` TEXT NOT NULL ) ENGINE = MYISAM ; Remplace DATABASE_NAME per the database name... I don't explain this code cuz it's to much simple. I think you will learn it fast. Create a new resource on your server. We call him "web". In this resource, we have 2 files. Meta.xml Server.lua On server.lua, we will put an event, when the map change (It's more usefull for race servers). A council ! Never put an callRemote() when the player join ! Why ? It makes lag. If you have a big dedicated server, you can do it. addEventHandler("onGamemodeMapStart", getRootElement(), function(theMap) end) Well, it's okey for this step. Now we will create a new function to get an table with the player name without his hexcode. addEventHandler("onGamemodeMapStart", getRootElement(), function(theMap) end) function getPlayersName() local playerslist = {} for i,p in ipairs (getElementsByType("player")) do local thep = string.gsub(getPlayerName(p), "#%x%x%x%x%x%x", "") table.insert(playerslist,tostring(thep)) end return playerslist end Not very hard for the moment. We create an callRemote in the event. Like this: addEventHandler("onGamemodeMapStart", getRootElement(), function(theMap) local playerList = getPlayersName() if playerList then callRemote("http://wwww.website.com/MTA/players.php", returnFunction, playerList) end end) function returnFunction(value) if value ~= "ERROR" then end end function getPlayersName() local playerslist = {} for i,p in ipairs (getElementsByType("player")) do local thep = string.gsub(getPlayerName(p), "#%x%x%x%x%x%x", "") table.insert(playerslist,tostring(thep)) end return playerslist end Put a small message to check if the player list is successfully save with outputDebugString(). Damn, let's start with the PHP. Create a new document PHP in your website like that: http://www.website.com/MTA/players.php In this document, you include the PHP SDK AND the MySQL Connexion ! What is that? You must put 2 lines of code to connect the page to the MySQL database. The line are: $base = mysql_connect ('127.0.0.1', 'USERNAME', 'PASSWORD'); mysql_select_db ('DATABASE_NAME', $base); You check if you have any errors, just access to your page. TO BE CONTINUED... (I go to school ) It's the end of this tutorial, i hope it will be useful Good luck and have fun © MTAScripts.net, All rights reserved1 point
-
Alright, I managed to figure it out for you. I also included the OOP version. So, I found out attachElements doesn't have the custom order parameter which allows you to set the order of the rotation. The expected rotation order would be ZYX, in OOP this is not the case however. I am not entirely sure why this is, it might be because of some simple rule but I just don't realize it right now... maybe it's written somewhere in the depths of the Wiki, but I cba to find it right now. I changed some of the parameters for the addVehicleCustomWheel function to allow tilt and scale upon call. I also added a command /customwheels so you can try it out by typing /customwheels [tilt] [scale] Anyway, have fun, either one works, whichever you like the best. I also cleaned up and commented the code just because people might be interested in this, so it's better if this is cleaned up for future reference. For you specifically, the fix would be to look into the calculateVehicleWheelRotation function, which shows how I've attached the custom wheel to the vehicle. Those contents should replace your attachElements, because attachElements doesn't work, you have to attach manually with position and rotation... Client-side -- Table containing vehicles that have custom wheels local createdCustomWheels = { } --[[ /customwheels [ number tilt, number scale ] Adds custom wheels to your currently occupied vehicle and optionally applies a tilt angle and wheel scale. ]] addCommandHandler( 'customwheels', function( _, tilt, scale ) -- Let's get our vehicle local vehicle = getPedOccupiedVehicle( localPlayer ) -- Oh, we have a vehicle! if ( vehicle ) then -- Let's give it a wheel now addVehicleCustomWheel( vehicle, 1075, tilt, scale ) end end ) -- Let's bind that command to F2 as requested by OP bindKey( 'f2', 'down', 'customwheels' ) --[[ void addVehicleCustomWheel ( vehicle vehicle, number model [ , number tilt, number scale ] ) Adds custom wheels to the vehicle. ]] function addVehicleCustomWheel( vehicle, model, tilt, scale ) -- If we've given the object's model number if ( tonumber( model ) ) then -- Let's delete any old ones for _, wheel in pairs( createdCustomWheels[ vehicle ] or { } ) do destroyElement( wheel.object ) end -- And let's nil it to be clear createdCustomWheels[ vehicle ] = nil -- Let's set some component names we want to customize local wheels = { 'wheel_lf_dummy', 'wheel_rf_dummy' } -- Let's iterate through those components for i = 1, #wheels do -- Let's hide the existing component setVehicleComponentVisible( vehicle, wheels[ i ], false ) -- Initialize our wheel table local wheel = { tilt = tonumber( tilt ) or 0, -- We'll default a non-number tilt angle to 0 name = wheels[ i ], -- Let's store the component name object = createObject( model, Vector3( ) ) -- Let's make a new wheel object } -- Let's set the vehicle as the wheel object's parent setElementParent( wheel.object, vehicle ) -- Let's make sure the wheel is not colliding with the vehicle setElementCollidableWith( wheel.object, vehicle, false ) -- Let's change the scale setObjectScale( wheel.object, tonumber( scale ) or 0.7 ) -- Let's update that original table wheels[ i ] = wheel end -- And let's store all of those wheels now createdCustomWheels[ vehicle ] = wheels end end --[[ void calculateVehicleWheelRotation ( vehicle vehicle, table wheel ) Let's calculate the wheel rotation for given wheel(s). ]] function calculateVehicleWheelRotation( vehicle, wheel ) -- If we have many wheels in the given argument if ( type( wheel ) == 'table' ) and ( #wheel > 0 ) then -- Let's iterate through them all for i = 1, #wheel do -- Let's call the method alone with just the iterator calculateVehicleWheelRotation( vehicle, wheel[ i ] ) end -- Let's stop here now return end -- If we have an object if ( wheel.object ) then -- Let's get the rotation vector of the original component local rotation = Vector3( getVehicleComponentRotation( vehicle, wheel.name, 'world' ) ) -- Let's set our tilt angle rotation.y = wheel.tilt -- Let's make sure the wheel is at the original component's position setElementPosition( wheel.object, Vector3( getVehicleComponentPosition( vehicle, wheel.name, 'world' ) ) ) -- Let's finally set the rotation (in ZYX order, important!) setElementRotation( wheel.object, rotation, "ZYX" ) end end -- Render-time! addEventHandler( 'onClientPreRender', root, function( ) -- Let's iterate through all the vehicles for vehicle, wheels in pairs( createdCustomWheels ) do -- If we have a vehicle, it's streamed in and it has wheels if ( vehicle ) and ( isElementStreamedIn( vehicle ) ) and ( #wheels > 0 ) then -- Let's calculate wheel rotation! calculateVehicleWheelRotation( vehicle, wheels ) end end end ) Client-side (OOP) -- Table containing vehicles that have custom wheels local createdCustomWheels = { } --[[ /customwheels [ number tilt, number scale ] Adds custom wheels to your currently occupied vehicle and optionally applies a tilt angle and wheel scale. ]] addCommandHandler( 'customwheels', function( _, tilt, scale ) -- Let's get our vehicle local vehicle = localPlayer:getOccupiedVehicle( ) -- Oh, we have a vehicle! if ( vehicle ) then -- Let's give it a wheel now vehicle:addCustomWheel( 1075, tilt, scale ) end end ) -- Let's bind that command to F2 as requested by OP bindKey( 'f2', 'down', 'customwheels' ) --[[ void Vehicle:addCustomWheel ( number model [ , number tilt, number scale ] ) Adds custom wheels to the vehicle. ]] function Vehicle:addCustomWheel( model, tilt, scale ) -- If we've given the object's model number if ( tonumber( model ) ) then -- Let's delete any old ones for _, wheel in pairs( createdCustomWheels[ self ] or { } ) do wheel.object:destroy( ) end -- And let's nil it to be clear createdCustomWheels[ self ] = nil -- Let's set some component names we want to customize local wheels = { 'wheel_lf_dummy', 'wheel_rf_dummy' } -- Let's iterate through those components for i = 1, #wheels do -- Let's hide the existing component self:setComponentVisible( wheels[ i ], false ) -- Initialize our wheel table local wheel = { tilt = tonumber( tilt ) or 0, -- We'll default a non-number tilt angle to 0 name = wheels[ i ], -- Let's store the component name object = Object( model, Vector3( ) ) -- Let's make a new wheel object } -- Let's set the vehicle as the wheel object's parent wheel.object:setParent( self ) -- Let's make sure the wheel is not colliding with the vehicle wheel.object:setCollidableWith( self, false ) -- Let's change the scale wheel.object:setScale( tonumber( scale ) or 0.7 ) -- Let's update that original table wheels[ i ] = wheel end -- And let's store all of those wheels now createdCustomWheels[ self ] = wheels end end --[[ void Vehicle:calculateWheelRotation ( table wheel ) Let's calculate the wheel rotation for given wheel(s). ]] function Vehicle:calculateWheelRotation( wheel ) -- If we have many wheels in the given argument if ( type( wheel ) == 'table' ) and ( #wheel > 0 ) then -- Let's iterate through them all for i = 1, #wheel do -- Let's call the method alone with just the iterator self:calculateWheelRotation( wheel[ i ] ) end -- Let's stop here now return end -- If we have an object if ( wheel.object ) then -- Let's get the rotation vector of the original component local rotation = Vector3( self:getComponentRotation( wheel.name, 'world' ) ) -- Let's set our tilt angle rotation.y = wheel.tilt -- Let's make sure the wheel is at the original component's position wheel.object:setPosition( self:getComponentPosition( wheel.name, 'world' ) ) -- Let's finally set the rotation wheel.object:setRotation( rotation ) end end -- Render-time! addEventHandler( 'onClientPreRender', root, function( ) -- Let's iterate through all the vehicles for vehicle, wheels in pairs( createdCustomWheels ) do -- If we have a vehicle, it's streamed in and it has wheels if ( vehicle ) and ( vehicle:isStreamedIn( ) ) and ( #wheels > 0 ) then -- Let's calculate wheel rotation! vehicle:calculateWheelRotation( wheels ) end end end )1 point
