- 
                
Posts
6,089 - 
                
Joined
 - 
                
Last visited
 - 
                
Days Won
216 
Everything posted by IIYAMA
- 
	Wiki: https://wiki.multitheftauto.com/wiki/GetAccount Returns an account or false if an account matching the username specified (and password, if specified) could not be found. Why true? https://wiki.multitheftauto.com/wiki/TriggerServerEvent triggerServerEvent does indeed return true, when the message has been send. And false if not for some reason. Ping Let me remind you that something called ping exist. This is the delay between the server and the client. Which means that triggerServerEvent can't give you the result directly back, because the code doesn't wait for this delay. Todo - You will have to use triggerServerEvent to send the username and password. - When the user has been logged in, you have to send back (with triggerClientEvent) the message that user has been logged in.
 - 
	the logIn function is also serverside. Accounts can't be passed to the other side, since they are serverside references only. You will have to pass the username and password to serverside and login there.
 - 
	Serverside scripting should run on serverside. ORANGE > getAccount, logIn Clientside scripting should run on clientside. RED > guiGetText Shared, can be used on both sides. BLUE > outputConsole Clientside > every client/player The GUI is an user interface which only exists for the clients/players. Serverside > mta server The account database doesn't exist on a player his computer. It only exist on the server, which means you can't login clientside. A tutorial on how to transfer data between both sides:
 - 
	You may have disrespect for XML, but I am not XML... lol Databases are indeed better, just not for new users. XML hard? I think that is a personal opinion. More writing code for XML? Yes indeed, but you will know what you will be saving. If you are storing large objects, I am very sure that it might get dirt in it. (Like user data) JSON? Replacement of XML from Javascript. But can be used within XML. Which means you can parse object models of your choice. Text file client-side? Bad practice for small updates. Parsing JSON is slow. \/ If I am would use an interface client-side for client-side data. Would you resave the whole object model for every small update? I do not recommend that. JSON Problem with lua objects. {G = 33, [2]=444} After saving + parsing this, the index 2 will be converted to a string. Which can be be a surprising annoying. You might be right about that XML is not as flexible as people would hope. But there are really benefits for it, which it seems you have just to discover. Let's end the discussion here.
 - 
	@ShayF It is not "you" for you, it is IIYAMA. A little bit respect please. Why XML? - client and server-side support.(giving the user more options) - Related to html, so more chance that the user would understand it. - Data read able without tools. - lots of MTA documentation. - not required to bind data to a client account. So yes why xml? Because this user doesn't care about optimization or file size. He want to learn how to do it and I gave him this solution because it matches his profile. Which is only to learn XML. If you think that the user wants to learn 3 different things: - accountdata - Data communication (server/client) The end user is using a GUI. - JSON Then hmmm, why not everything one step at the time?
 - 
	There are already examples on the wiki: -- Creates a file named "new.xml" with root node "newroot" and childnode "newchild". function createFileHandler() local rootNode = xmlCreateFile("new.xml","newroot") local childNode = xmlCreateChild(rootNode, "newchild") xmlSaveFile(rootNode) xmlUnloadFile(rootNode) end addCommandHandler("createfile", createFileHandler) example by Shadowstep07052 It shows you how to create a xml file, which has a new child. https://wiki.multitheftauto.com/wiki/XmlCreateFile XML syntax: https://www.tutorialspoint.com/xml/xml_syntax.htm
 - 
	addEventHandler("onPedWasted", root, function (_, killer) -- a ped died end) Start with /\ I will help you more if you actually put energy in it yourself, which you are not doing at the moment. Good luck.
 - 
	Yes, I understand that already. So I helped you a bit with it. Now start with writing your example.
 - 
	If you want to make an example, then isn't it correct of me to give you the right syntax for it? ???
 - 
	How about xml? https://wiki.multitheftauto.com/wiki/XML
 - 
	hmm good quest. (to be honest never done it with the internal db, I did misread that part) You should start with viewing the structure of the db itself, with for example this tool: https://github.com/sqlitebrowser/sqlitebrowser This will also tell you if the db is protected (or the data is protected) in anyway. If everything is fine, then you should be able to connect with it the same way as with a regular db. If that doesn't work and yet your viewer does do the job, then you might need to convert the db to another version.
 - 
	You want to eat zombies. ! This will tell you, when you have eaten your zombie: Client https://wiki.multitheftauto.com/wiki/OnClientPedWasted Server https://wiki.multitheftauto.com/wiki/OnPedWasted bon appétit / eet smakelijk / enjoy your dinner !
 - 
	Only one way to go. Remove all vehicle sounds and give them all new sounds with playSound. Other ways do not exist at the moment. (1-5-2018)
 - 
	Before you can store or receive data, it requires tables as containers. Not the best site, but it explains the basics on how to create a table. http://www-db.deis.unibo.it/courses/TW/DOCS/w3schools/sql/sql_create_table.asp.html Also handy: http://www.tech-recipes.com/rx/36940/sql-server-check-if-table-or-database-already-exists/
 - 
	You want to close it, but: There is one thing that you might consider handy, if you want every player to have to same camera speed. local velCam = 0.02 * (timeSlice / 17) Parameters float timeSlice timeSlice: The interval between this frame and the previous one in milliseconds (delta time). https://wiki.multitheftauto.com/wiki/OnClientPreRender Good luck with developing/finishing it!
 - 
	Because I am not asking the user to learn also oop and everything is already available on that page.
 - 
	They are not mta elements. But there are functions that can get the position and rotation of them. I am very sure that you have already found them. Find them if you haven't! ......... ............. ........... .............. .......... After that. The function getElementMatrix can help you with the vehicle orientation. https://wiki.multitheftauto.com/wiki/GetElementMatrix And on that same page there is something that creates a matrix the same way as the function above. But gives you also the ability to get the matrix without using an actual element. (Last example) function getElementMatrix(element) local rx, ry, rz = getElementRotation(element, "ZXY") rx, ry, rz = math.rad(rx), math.rad(ry), math.rad(rz) local matrix = {} matrix[1] = {} matrix[1][1] = math.cos(rz)*math.cos(ry) - math.sin(rz)*math.sin(rx)*math.sin(ry) matrix[1][2] = math.cos(ry)*math.sin(rz) + math.cos(rz)*math.sin(rx)*math.sin(ry) matrix[1][3] = -math.cos(rx)*math.sin(ry) matrix[1][4] = 1 matrix[2] = {} matrix[2][1] = -math.cos(rx)*math.sin(rz) matrix[2][2] = math.cos(rz)*math.cos(rx) matrix[2][3] = math.sin(rx) matrix[2][4] = 1 matrix[3] = {} matrix[3][1] = math.cos(rz)*math.sin(ry) + math.cos(ry)*math.sin(rz)*math.sin(rx) matrix[3][2] = math.sin(rz)*math.sin(ry) - math.cos(rz)*math.cos(ry)*math.sin(rx) matrix[3][3] = math.cos(rx)*math.cos(ry) matrix[3][4] = 1 matrix[4] = {} matrix[4][1], matrix[4][2], matrix[4][3] = getElementPosition(element) matrix[4][4] = 1 return matrix end With this matrix you can attach stuff with a render event. Of course I understand that it might look a little bit complex. But it is really the only way without doing very complex calculations.
 - 
	Everything you need is on this page: https://wiki.multitheftauto.com/wiki/GetElementMatrix Use getElementMatrix on to the camera element to get it's matrix. And use the functions in the examples to get the offset from the orientation(matrix) of the camera. Which you can later move to with your camera. It gives you a lot of freedom to do really crazy stuff.
 - 
	I wouldn't say that so quickly. To me his example looks valid. /add d six random[x] = y (or overwrite, `set` would be a better command based on it's functionality) /rem d if random[x] then random[x] = nil end
 - 
	https://wiki.multitheftauto.com/wiki/IsTransferBoxActive See the example of that page.
 - 
	No, add it ONLY to the resource which is going to hide the bar. This makes sure that the script is downloaded before others and starts early on. If you do not do this, this script will be started after the download bar is finished. Check isTransferBoxActive, because it half of your work: https://wiki.multitheftauto.com/wiki/IsTransferBoxActive Use https://wiki.multitheftauto.com/wiki/DxDrawRectangle To cover up the download bar. (enable postGUI) Syntax bool dxDrawRectangle ( float startX, float startY, float width, float height [, int color = white, bool postGUI = false, bool subPixelPositioning = false ] ) Do not cover the whole screen. Keep the user in control. http://bokardo.com/principles-of-user-interface-design/#keep-users-in-control Trouble with using this with onClientRender? This might be handy:
 - 
	https://wiki.multitheftauto.com/wiki/Meta.xml <download_priority_group /> If not set, the download priority group for a resource defaults to 0. If this is set higher than 0, then the resource will be downloaded and started on the client earlier than other resources. If set to less than 0, the resource will be downloaded and started on the client later than other resources. + See example of isTransferBoxActive. \/ https://wiki.multitheftauto.com/wiki/IsTransferBoxActive
 - 
	Hmm interesting. It isn't bug free yet. For example if you destroy a vehicle and create a vehicle at the same time, the event wouldn't be triggered. A more accurate way would be using an invert loop, which checks if the vehicle's at the end of the table are new. If not, then you can break the loop. New vehicle's should be afaik always at the end.
 
