-
Posts
2,973 -
Joined
-
Last visited
-
Days Won
3
Everything posted by 50p
-
What do you mean "addcar"? You can download "freeroam" resource to create vehicles easily if that's what you want https://community.multitheftauto.com/index.html?p=resources
-
This is a very simple script (not exactly the same as the one in freeroam) made with GUI Classes. To make it work, just download those classes and replace what's inside "test.lua" with this: addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), function( ) local screenSize = { guiGetScreenSize( ) } local numberOfVehicles = 212; -- there is 212 vehicles in GTA (inc. trailers) local gridList = GridList:Create( screenSize[ 1 ] - 210, screenSize[ 2 ] / 2 - 200, 200, 400 ); gridList:Visible( false ); gridList:AddColumn( "ID", .22 ); gridList:AddColumn( "Name", .6 ); for i = 0, numberOfVehicles do local tempID = i + 400; -- first vehicle ID is 400 (Landstalker) local vehName = getVehicleNameFromID( tempID ); gridList:AddRow( tostring( tempID ), vehName ); end gridList:AddOnClick( -- when you click the gridlist a car will be created function( ) local x, y, z = getElementPosition( getLocalPlayer( ) ); local rowID = gridList:SelectedItem(); createVehicle( tonumber( gridList:ItemText( rowID, 1 ) ), x + 5, y, z ); -- CREATE VEHICLES SERVER-SIDE TO BE ABLE TO ENTER THEM! end ); bindKey( "F1", "down", function( ) showCursor( not isCursorShowing( ) ); gridList:Visible( not gridList:Visible() ); end ); end ) NOTE: THIS CREATES VEHICLES CLIENT-SIDE. YOU CANNOT ENTER VEHICLES CREATED CLIENT-SIDE! Maybe someone here will make another piece of code for you that creates the cars server-side... It's just a few more lines of code.
-
Within a certain line? Do you mean "on" the line? If so, you'd have to calculate the angle of that line and calculate the angle of line "starting at one of the ends of the line and ending at the place of marker" if the angle is the same it means the marker is on the line. Also, remember to check if the length between marker and "one of the ends of the line" is shorter or equal to the length of the line. Here's what I mean: if ( lineA >= lineB ) and ( angleA == angleB ) then -- the marker is on the line else -- it's not on the line end
-
Not really. All it shows is the address not what type the variable is. Do something like outputChatBox(type(var)). If it is userdata you can do getElementType() to see what type of MTA element it is. if ( type ( theGate ) == "userdata" ) then outputChatBox ( getElementType ( theGate ) ) else outputChatBox ( type ( theGate ) ) end By using tostring() you see the what variable "has" if it's string, number or bool (or nil), otherwise you see [variable type]: [address] (eg. "userdata: 01234567". So he probably has seen it but didn't know it's important to post here. Use type() only if you want to make sure that the variably type is the same that you needed (eg. in function calls), tostring() is OK in this case. If it outputs [variable type]: [address] why would you need to getElementType if you know it's object. It tells us that gate has been created. So, you must be looking for the gate in the wrong place or it's underground. Make sure gateOpen and gateClose are called when you type commands (also use outputChatBox or outputDebugString).
-
It's done the same way but you don't see the camera "jumping". The problem with that camera is that onClientRender isn't triggered every frame. Maybe it is but some frames are skipped if you have too much code executed at one frame and the code is carried over to the next frame. That's what I noticed. So it's possible to make that "flying camera" and you can find it in a gamemode "fallout" (file "freecamclient.lua")
-
Camera would be flickering becausr the distance you travel between frames is so long that camera wouldn't be smooth. Someone would say "Use onClientPreRender", but what's the difference? It is still executed every frame and as I said the distance travelled between frames is too long for camera to be smooth. Both onClientPreRender and onClientRender would have to be used but I doubt it would be smooth enough. In addition it would drop down fps on slower PCs.
-
What do you type when you see get that warnings about bad arguments? Post the entire text that you type before you press Enter.
-
All the values passed to the function (createVehicle) must be numbers, arguments from command are all string, so? So, convert the values from the command to numbers: createVehicle( tonumber( car ), tonumber( x ), tonumber( y ), tonumber( z ) )
-
GUI Classes v1.0 Introduction: The title speaks for itself. If you've ever had problems with making nice user interface for your gamemode or RPG server then this library is for you! Making "log in" window now is as easy as picking your nose! Description: I've read lots of topics where people were having problems with scripting GUI even after reading the scripting GUI tutorial on the wiki so I decided to make those GUI classes to make scripting GUI easier then ever before. Now, it's pretty easy to make almost anything you like even with a little knowledge of scripting. These classes have a few features that are missing in MTA, like "click'n'drag", you can click and drag the control where you want. You can make GridLists with a few lines (an example is included in "test.lua") not even using AddRow, AddColumn, etc. Example: This is a simple example of how to create an image and swap it over with a different image when a user clicks it: addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), function( ) -- lets make it in the middle of the screen local screenSize = { guiGetScreenSize( ) }; img = StaticImage:Create( screenSize[ 1 ] / 2 - 200, screenSize[ 2 ] / 2 - 200, 400, 400, "images/0.png" ); img:AddOnClick( clickedAnImage ); -- clickedAnImage function will be called when you click an image end ) local click_count = 0 function clickedAnImage( ) click_count = click_count + 1; img:LoadImage( "images/" .. tostring( click_count % 2 ) .. ".png" ); end This is easy to make even without my classes but it shows you a new way of scripting. There is even more examples in "test.lua" file. They show how to create a "Log in" window, complex gridlists and dragable controls. Documentation: Currently, there is a short documentation that just tells you what functions are used to create specific controls. Because of that, I do expect people that would like to know a function for this, for that, etc. If you want to know what function is responsible for something, just ask here and I'll reply as soon as I see the post. HERE is work-in-progress documentation. You can find all the functions there but only a few are documented. Download: Click ME! BUG REPORT: If you find any bugs, and I'm 99% sure there will be a bug, just speak up! Don't keep it for yourself! I'll try to fix it and release a new version with the bug fixed.
-
Jesus... http://www.xfire.com/ http://www.teamspeak.com/
-
That is usual behaviour when you use setAccountData in DP2.x
-
I think make an meta.xml with the script on client and on server, could I do it so? No. "Addon" in other words a plugin is not possible to be ran on client side.
-
You must have got error message(s)! Use a command to open debug window (while being logged in as admin): /debugscript 3 I said indent your code! It's hard to find what's wrong in the code for us (not mention you )... I can see you try to escape " (double quotation) and you don't have another " to end the string. Use \ in string to escape characters. memohelp = guiCreateMemo(0.0232,0.0429,0.9536,0.8791,"fdgsdfg\",true,helpwindow) --THIS IS WRONG Use Notepad++ to see if the string is correct. As you can see here, the red colour tells you that string is not ended with " memohelp = guiCreateMemo(0.0232,0.0429,0.9536,0.8791,"fdgsdfg\"",true,helpwindow)-- THIS IS CORRECT
-
No, it's not possible even with "addons" because they would have to be on both sides (server, and client).
-
- pastebin.com - use TAB to make the code readable function hello( ) -- this is how your code should look like -- otherwise it's difficult to read return "hello world"; end - give more info, what's not working, what errors you get (if any), what it should do, etc.
-
Did you know that functions triggered by onClientRender do not have any parameters? That means you will never get speed of a car because you try to a car of "nil" value. You should enable debug window before you ask question here... I think you get lots of errors.
-
Don't really know what you mean...
-
DO NOT USE source AS A PARAMETER!!! MTA made it so complicated for noobs -.-' What does "source" mean? Does it mean "player"? Does it mean "vehicle"? NO! It's a "secret" variable that is passed to a function when events occur. If it's "onPlayer..." then source will be "player", when it's "onVehicle..." then source will be "vehicle". Why do you use "source" in argument list of function? You should use other variable names... if you expect there to be a player call it player, if vehicle, call it vehicle, etc... Keep away from source in argument list!
-
createVehicle Vehicle IDs READ THE DAMN WIKI... ALL OF YOU QUESTION MAKERS!
-
When I get some more free time I'll probably try to finish my "GUI classes" and release them on community.multitheftauto.com I don't like it when people don't read wiki or don't understand how to script GUI. My classes are easy to use and hopefully will stop people posting about problems with GUI. Here is an example of a "Log in" window made with my classes: http://50p.pastebin.com/fe167f8d It's short and understandable. Notice how easy it is to add functions to onClientGUIClick event (highlighted yellow lines), it's also that easy to remove them later... But for now, you should read the Scripting GUI tutorial.
-
Make sure onClientElementStreamIn gets triggered by outputing some text... that's called debugging.
-
Those events weren't added client-side in the tutorial you probably followed. You just miss-understood the tutorial or you wanted to modify it with a failure result. Just move the 4 lines (where your error points, that is addEvent and addEventHandler) to the server-side script. You have the joinHandler already declared server-side. Then it should work properly.
-
You probably should know what to put in .map first if you don't know yet... ¬_¬ If you just "cut & paste" createObject to map file it won't work because map files are in XML format (just different file extension) not Lua script. http://development.mtasa.com/index.php?title=Meta.xml WHY THE HELL YOU DO NOT READ WIKI?! I'll always force you to use wiki and eventually stop helping people who just can't be arsed to look up the wiki
-
http://ryosuke.my-sv.net/pawn/ide.txt You may not find all the objects and you may find some IDs that aren't really objects. You can see the Legend on top.
-
http://development.mtasa.com/index.php? ... de_scripts IT'S ON THE MAIN PAGE OF THE WIKI! WIKI KNOWS ANSWERS TO 99% OF YOUR QUESTIONS.