-
Posts
2,973 -
Joined
-
Last visited
-
Days Won
3
Everything posted by 50p
-
To spawn everyone you have to loop through all the player elements, like so: local plrs = getElementsByType( "player" ); for i, plr in pairs( plrs ) do spawnPlayer( plr, x, y, z, rot ); setCameraTarget ( plr, plr ); fadeCamera( plr, true ); giveWeapon( plr, 22, 999 ); giveWeapon( plr, 4, 1 ); end
-
Where is the testtable? It's outside the "if not row then" line. pInfo is inside the if statement.. what does that mean? It means that pInfo is not created, what does that mean? It means if statement always fails, what does that mean? mysql_query always fails. You should debug it that way. Put some outputDebugString/outputChatBox/outputConsole inside the if statement, if the message doesn't come up it means the "if" failed, so move the output..... line above the if statement, so you'll see if the "while true do" fails (which can't fail). EDIT: Ok, if you got it fixed than just remember about debugging.
-
Talasma, check this topic, your topic... https://forum.multitheftauto.com/viewtop ... 91&t=24665 Read what you said in your first post. Who helped you the most? I don't help? I helped you a lot... because you stopped replying there, it probably means you finally got it working. OK fine, you "maked" vehicle shop... but when I look at this code: local 133.091675, 1941.873901, 19.320068 = getElementPosition ( theObject ) --get the origanal position local 18.950716 = 19.320068 + 100 -- make a new z position I don't really believe you made vehicle shop -_-' I lost lots of time helping you out in your previous topic and I see, I wasted that time badly. Anyway, good luck with scripting. local 9 = 4 + 5
-
wtf are you talking about... Spawnplayer??? I mean how can I make GATE which open with command.. like /open there is what I tried, but it didnt work at all allObjects = getElementsByType ( "object" ) for key, theObject in ipairs ( allObjects ) do local 133.091675, 1941.873901, 19.320068 = getElementPosition ( theObject ) --get the origanal position local 18.950716 = 19.320068 + 100 -- make a new z position moveObject ( theObject, 10000, 133.091675, 1941.873901, 18.950716 ) --move the object to this position in 10 seconds. end addCommandHandler("open", moveObject) I hate liars! How am I supposed to believe that you made a "Car Shop" and needed GUI to spawn the car next to you?! I'm sorry but you won't get help from me anymore...
-
It must be bug because code looks fine.
-
Put them in your resource folder (where you have meta.xml located) and add them to meta.xml
-
Make sure: - you want to get info from pInfo table after the LoadUser() function is called - row is not nil or false after first mysql_fetch_row call, if the while loop breaks before pInfo is declared then you won't be able to use it...
-
Because you can't defeat zombies with your bare hands LOL
-
What do you mean? This is my bank resource which queries SQL tables: https://community.multitheftauto.com/index.html?p ... ails&id=54
-
What has "vehicle shop" to do with this script?! It's just simple GUI script which triggers server-side event which is UNIQUE for sure.
-
Since when client is not declared? It's custom event and can be triggered by players (clients) and client is another "secret" variable telling which player triggered this event. Or was it added in 1.0? Also, what has got this (server-side script) to do with client-side bindKey which shows window? addEventHandler check this out. I couldn't believe it didn't work, so I just wanted to know what is the EXACT content of the files (server-side and client-side). I copied what Talasma posted to the files Talasma said and it worked just fine. I mean what he said didn't work, it worked, that is, "pressing O doesn't show window". (Sorry for the speedometer underneath, I just use the same coords for everything I test.) BTW, you could add this line to show/hide cursor when "o" is pressed (UNDER wnd:Visible( not wnd:Visible( ) )): showCursor( wnd:Visible( ) )
-
Show the code... You must be copying something wrong... In the mean time LEARN TO SCRIPT! Nobody will do everything for you! You said you made a "shop"... how did you make it if you haven't got any scripting knowledge at all? Why did you lie?
-
Errors? Warnings? If not, show us the code... I know you're the beginning beginner and you must have COPIED something wrong...
-
Look: -- inside of client-side script (in onClientResourceStart) ... "in onClientResourceStart". Where is it? -- inside of client side script (just under wnd:Show( false )) bindKey( "o", "down", function( ) -- this will show window if it's hidden and hide if it's shown wnd:Visible( not wnd:Visible( ) ) end ) Read the first line "inside of client side script (just under wnd:Show( false ))". I'm not here to do everything for you... life is brutal... This is the code you should have in the client-side file: addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), function( ) -- inside of client-side script (in onClientResourceStart) wnd = Window:Create( 10, 250, 200, 100, "Spawn window" ); btn = wnd:AddButton( 15, 40, 100, 23, "SPAWN" ); btn:AddOnClick( function() -- when button is clicked, tell server about it triggerServerEvent( "YOUR_EVENT_TO_SPAWN_CAR", getLocalPlayer(), 560 ) -- 560 is id of car end) wnd:Visible( false )-- hide the window -- HERE: -- inside of client side script (just under wnd:Show( false )) bindKey( "o", "down", function( ) -- this will show window if it's hidden and hide if it's shown wnd:Visible( not wnd:Visible( ) ) end ) end ) BTW, not "my glasses" but "my classes"... this is HUGE difference!
-
Use [ lua][ /lua] tags on the forums, here. If you post code on forums it's easier to read when your code is in between the lua tag, so use [ lua]YOUR CODE HERE[ /lua] (WITHOUT SPACES!!) to see this: YOUR CODE HERE Also, I just updated GUI classes resource, so go and download new version (1.0.1): https://community.multitheftauto.com/index.html?p ... ils&id=241 Just download it and replace your old file ("classes/GUICollection.lua") with the new one you download.
-
In the example I showed you there is nothing linked to cursor but check file "classes/GUICollection.lua" line 23. I used showCursor( true ) to test some things but I may have forgotten to comment this line before release. BTW, post all the content you have in your .lua files. Ech file in [ lua][ /lua] (without spaces) tags.
-
In what way it doesn't work? Have you ever used it? If you changed the to 1 than MTA's server will host http server too. It's not a parameter that should be changed if you host http server on the same machine as MTA server, it's supposed to be changed if you want MTA's built-in web server to be enabled. Than you could access it via web browser by typing "http://:/". Ask someone on IRC if you want more details on that.
-
That's right! 50p has to read his own documentation! LOL Even though, I'm pretty sure Talasma ignored the advices and just copied the code like most of beginners would do.
-
- How did you test it? - Where did you put the code? - How does your resource look (empty? added my code to some other resource?)? - Any other errors? - What do you mean everything? Everything you know about but not what you must do. If you wanted to use the code I posted about the GUI then you need my GUI classes as I said before.
-
No. All what is triggered is console. You get message that say you failed to enter vehicle.
-
What wasn't clear enough? What didn't I tell you? I've sent you to: - GUI lib which allows you to create GUI elements (Buttons, Windows, etc.) and this is what you need to show the window and button (for instance "Spawn"). -- inside of client-side script (in onClientResourceStart) wnd = Window:Create( 10, 250, 200, 100, "Spawn window" ); btn = wnd:AddButton( 15, 40, 100, 23, "SPAWN" ); btn:AddOnClick( function() -- when button is clicked, tell server about it triggerServerEvent( "YOUR_EVENT_TO_SPAWN_CAR", getLocalPlayer(), 560 ) -- 560 is id of car end) wnd:Visible( false )-- hide the window - createVehicle function which will create vehicle ("Spawn") -- inside of server-side script addEvent( "YOUR_EVENT_TO_SPAWN_CAR", true ) addEventHandler( "YOUR_EVENT_TO_SPAWN_CAR", getRootElement( ), function( ID ) -- ID will be the one you put in client script (eg. 560 - "Sultan") x, y, z = getElementPosition( client ) -- client = player who triggered this event createVehicle( ID, x, y+3, z ); -- create vehicle by player end) - bindKey which will bind a key ("r") to a function which will show the Window. -- inside of client side script (just under wnd:Show( false )) bindKey( "r", "down", function( ) -- this will show window if it's hidden and hide if it's shown wnd:Visible( not wnd:Visible( ) ) end ) THIS IS JUST EXAMPLE I TYPED HERE! IT MAY NOT WORK! IT JUST GIVES YOU AN IDEA HOW IT CAN BE DONE! If you still need to know more just look at the wiki examples/tutorials. http://development.mtasa.com/index.php? ... troduction http://development.mtasa.com/index.php? ... ng_the_GUI
-
This is code that should be placed in a map file which also has to be added to meta.xml and yes, this will create vehicle. http://development.mtasa.com/index.php?title=Vehicle
-
Check these: - createVehicle (creates vehicle, in other words spawns) - GUI Classes (makes scripting GUI easier) - bindKey (binds keys, so that you can show the GUI with keys, e.g. "r")
-
AFAIK, GTA engine doesn't allow you to use too much effects. Just create some peds and remove their heads. What you'll see is some peds without heads will not bleed at all because that particle limit is reached. Check my pretty old basic script here: https://community.multitheftauto.com/index.html?p ... ils&id=234 create some peds (like 15, with command: /peds 15) and use /headless command.
-
Fair enough.