Jump to content

Scripting Tutorial 1 - User selectable warp points


ijsf

Recommended Posts

  • Replies 64
  • Created
  • Last Reply

Top Posters In This Topic

  driver2 said:
Maybe I'm just stupid right now, but if another player than the one who created the teleporter steps into it and triggers the 'Script_onPlayerClick' Function, will it not beam the owner of the teleporter to the destination?

I assume you mean the onMarkerHit event, not the onPlayerClick event.

Have a look at the function that warps you:

[lua]setElementPosition ( player, x, y, z )[/lua]

And the event function itself:

[lua]function Script_onMarkerHit ( player )[/lua]

This means it'll warp whoever triggered the event.

Link to comment

driver2, thanx for info, but I've already downloaded LUAedit. I can open , edit and compile lua files with it.

-----------------------------------------

Good tutorial. And added video is great.

So we can create our own scripts, but can't test them?

One thing we needed too is 1-2 player server+client to test scripts.

Link to comment

It would be possible for us to make a single-player mod for MTA, which would just start the game normally, but also give access to a lot of features that aren't specific to multiplayer, including scripting, but I think we'll just be improving deathmatch for a while.

Link to comment
  Raoul said:
What program whas this script made? mIRC?

Yes, this is clearly mIRC-style scripting ;)...not

  Hedning said:
oops, Lua is the language BUT you can write this in notepad! or Luaedit.

Q: Can I put this script in gta sa and play with it in SP? if so, how?

I won't recommend Luaedit, it wiped my scripts directory 2 times. The directory contained very advanced scripts which where EXTREMLY fun. QA Team knows ;)

Edit:

What's up with the new 'onResourceLoad', do I have to change my scripts AGAIN?

Link to comment

I've got another question.

[lua]

addEventHandler ( "onMarkerHit", getRootElement(), "Script_onMarkerHit" )

function Script_onMarkerHit ( player )

[/lua]

How can i define which variables are passed to the function by the event handler? Or how do i know which variables are passed by existing event handlers?

Maybe a little too indepth for this tutorial, this is probably something for later tutorials.

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...