Jump to content

[help]team lua


JasperRieken

Recommended Posts

Well i can use your help with one more thing im trying to script a Gui

for a vechile spawn can you help me? i wanna make it on markerhit get the gui and spawn the vechile same place

this is the gui

-- Created: 21/00/2011 13:17 
GUIEditor_Window = {} 
GUIEditor_Button = {} 
  
GUIEditor_Window[1] = guiCreateWindow(471,278,366,401,"Xuju Vechile's",false) 
GUIEditor_Button[1] = guiCreateButton(100,42,158,45,"BXM",false,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(100,114,158,45,"Mountain Bike",false,GUIEditor_Window[1]) 
GUIEditor_Button[3] = guiCreateButton(101,192,158,45,"Bike",false,GUIEditor_Window[1]) 
GUIEditor_Button[4] = guiCreateButton(83,138,5,5,"",false,GUIEditor_Button[3]) 
GUIEditor_Button[5] = guiCreateButton(101,267,158,45,"Sanchez",false,GUIEditor_Window[1]) 
GUIEditor_Button[6] = guiCreateButton(26,362,82,30,"Close",false,GUIEditor_Window[1]) 
  
  
  
  
--- --- --- --- --- 

Link to comment

How about figuring something out by your own? This isn't a place for "hey i want a script, can you make it for me?"

Just attach some click event handlers to the buttons and call an according function.

The function should spawn the vehicle with the position, which you get from the marker.

Also, of course, create a marker.

That's pretty much all you need:

https://wiki.multitheftauto.com/wiki/CreateMarker

https://wiki.multitheftauto.com/wiki/OnMarkerHit

https://wiki.multitheftauto.com/wiki/OnClientGUIClick

https://wiki.multitheftauto.com/wiki/GetElementPosition

https://wiki.multitheftauto.com/wiki/CreateVehicle

Link to comment

Maybe it's time to learn Lua then.

You should at least try to make something that works skipping the part you don't know how to script.

So

1: Make a script that spawns a car with a command.

2: Make the script clientside and serverside (command clientside, trigger the server with a custom event to create the vehicle)

3: Make it so the command only works inside the marker.

4: NOW create the GUI when entering the marker.

5: Let the GUI trigger the same event.

Link to comment

How about you actually open the wiki once and just read it?

https://wiki.multitheftauto.com/wiki/addEventHandler

On this page you will find, why there is a 'false' in the addEventHandler in the code.

This snippet has also nothing to do with the marker part, it's just for the button in the GUI window.

And seriously stop double posting. There is an edit feature for forums like this, you know. :/

I'm not gonna write you your whole script. To me it looks like you haven't even the slightest clue of what actually is an event, why to attach them or even how the whole element system in MTA works. So start learning scripting, otherwise you will never be able to understand anything, we explain to you in this thread.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...