Scripting Tutorial 1 - User selectable warp points

All Lua scripting topics related to Multi Theft Auto.

Moderators: Moderators, MTA team

Scripting Tutorial 1 - User selectable warp points

Postby ijsf on Sun Jan 14, 2007 10:52 am

NOTICE: THIS TUTORIAL MAY BE OUTDATED! PLEASE READ: http://forum.mtasa.com/viewtopic.php?f=91&t=22270

This is our respond thread for our first weekly scripting tutorial.

You can respond to the tutorial here if you have any questions, etc.

Here's the link to the first tutorial: Scripting Tutorial I - User selectable warp points
Developer of Multi Theft Auto.

* Music: http://bastage.student.utwente.nl/music/.
* Project blog: http://solid.student.utwente.nl/.
ijsf
The MTA Team
 
Posts: 893
Joined: Thu Mar 13, 2003 10:54 am
Location: EU, Netherlands

Postby NeDizZ on Sun Jan 14, 2007 12:38 pm

Uhm. That was short. =S
Well, will be waiting for the next one.
Signature
Image
Can you run 350m per second? No? Then your head better be bulletproof..
User avatar
NeDizZ
Regular
 
Posts: 104
Joined: Fri Jan 13, 2006 11:28 am
Location: Lithuania
Gang: LDK

Postby Raoul on Sun Jan 14, 2007 12:59 pm

What program whas this script made? mIRC?
Raoul
New User
 
Posts: 41
Joined: Mon Dec 25, 2006 11:44 am
Location: Netherlands

Postby Hedning on Sun Jan 14, 2007 1:05 pm

Lua...
User avatar
Hedning
Experienced
 
Posts: 501
Joined: Sun Apr 23, 2006 1:05 pm
Location: Sweden

Postby Raoul on Sun Jan 14, 2007 1:09 pm

oh i thought that was just the language and it whas made in another program xD
Raoul
New User
 
Posts: 41
Joined: Mon Dec 25, 2006 11:44 am
Location: Netherlands

Postby Hedning on Sun Jan 14, 2007 1:12 pm

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?
User avatar
Hedning
Experienced
 
Posts: 501
Joined: Sun Apr 23, 2006 1:05 pm
Location: Sweden

Postby Raoul on Sun Jan 14, 2007 1:17 pm

That's what i was looking for :D Thanks :D
Last edited by Raoul on Sun Jan 14, 2007 1:27 pm, edited 1 time in total.
Image
Raoul
New User
 
Posts: 41
Joined: Mon Dec 25, 2006 11:44 am
Location: Netherlands

Postby Blokker_1999 on Sun Jan 14, 2007 1:21 pm

Hedning wrote: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?
No, since you need MTA to run it.
No keyboard detected.
Press F1 to continue.
User avatar
Blokker_1999
The MTA Team
 
Posts: 2230
Joined: Sat Feb 15, 2003 6:25 am
Location: Tielen Belgium
Gang: oMg

Postby driver2 on Sun Jan 14, 2007 1:30 pm

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?
driver2
Regular
 
Posts: 134
Joined: Thu Feb 16, 2006 8:31 am

Postby Brophy on Sun Jan 14, 2007 1:32 pm

LOL @ some of the posts, its like they have stared at the tutorial / past months news but not actually read it

What program whas this script made? mIRC?


LOL
User avatar
Brophy
Super Moderator
 
Posts: 2885
Joined: Sun Oct 05, 2003 1:50 pm
Location: England, UK
Gang: VCES / SAES

Postby ijsf on Sun Jan 14, 2007 1:36 pm

driver2 wrote: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.
Developer of Multi Theft Auto.

* Music: http://bastage.student.utwente.nl/music/.
* Project blog: http://solid.student.utwente.nl/.
ijsf
The MTA Team
 
Posts: 893
Joined: Thu Mar 13, 2003 10:54 am
Location: EU, Netherlands

Postby driver2 on Sun Jan 14, 2007 1:41 pm

I thought only the creator of the warper should be teleported.
driver2
Regular
 
Posts: 134
Joined: Thu Feb 16, 2006 8:31 am

Postby CoZ on Sun Jan 14, 2007 1:56 pm

Image
Image
Server Blog | Server quickinfo
STFU and dont bug the mta team with ''when is DM comming''
or risk theyre spending more time explaining they're still working on DM than actually getting work done :shock:
User avatar
CoZ
Experienced
 
Posts: 608
Joined: Sun Feb 19, 2006 5:48 pm
Location: there is no place like 127.0.0.1

Postby SFather on Sun Jan 14, 2007 2:18 pm

where I can get LUA soft? plz give me a link to a needed version :!:
SFather
 

Postby driver2 on Sun Jan 14, 2007 2:24 pm

You don't need any software besides an ordinary text-editor to write Lua. To run scripts you can use a standalone interpeter. But of course you won't be able to test MTA related Lua scripts without MTA.

http://lua.org
http://lua-users.org
Last edited by driver2 on Sun Jan 14, 2007 2:25 pm, edited 1 time in total.
driver2
Regular
 
Posts: 134
Joined: Thu Feb 16, 2006 8:31 am

Next

Return to Scripting

Who is online

Users browsing this forum: 50p and 0 guests