Jump to content

Teleport script


hackermagus

Recommended Posts

Hi , I want to make a teleport like when I go to a marker that teleports me to another position. I make a script, but it!s not workig. I add the script to the meta file, I add the cript to the map folder, I load the map but it!s not working. Please help  :(

local marker1 = createMarker(-2295.099609375, 1866.2998046875, 1.8999999761581 "arrow", 3.5, 255, 255, 255, 255) 

function teleport1(player)
	if player == localPlayer then

	        setElementPosition(player, -2344.0385742188, 2398.6096191406, 8.5596084594727)

	      
	     	setPedRotation (player, 90) 

 	     
 	    	setElementFrozen(player, false)
   	  	setTimer(setElementFrozen, 1, 1, player, false) 

	end
end

addEventHandler("onClientMarkerHit", marker1, teleport1)   

 

Edited by hackermagus
Link to comment
  • Scripting Moderators
3 minutes ago, HassoN said:

You add the script to the map folder? What do you mean by that? You must create a .Lua file and introduce it to the meta in order to get it to work.

Also at your timer, you are using 1 as a time interval while the minimum is 50.

FROM VERSION 1.5.6 r16715 ONWARDS

The minimum accepted interval is 0ms now.

https://wiki.multitheftauto.com/wiki/SetTimer

  • Like 1
Link to comment
8 hours ago, HassoN said:

You add the script to the map folder? What do you mean by that? You must create a .Lua file and introduce it to the meta in order to get it to work.

Also at your timer, you are using 1 as a time interval while the minimum is 50.

Sorry I'm not so good at english but I do that.

Link to comment
Just now, HassoN said:

Show me your meta file.

<meta>
    <script src="teleport.Lua" type="client"></script>
    <info gamemodes="play" type="map" version="1.0.0"></info>
    <map src="2019-08-16-4.map" dimension="0"></map>
    <settings>
        <setting name="#maxplayers" value="[ 128 ]"></setting>
        <setting name="#useLODs" value="[ false ]"></setting>
        <setting name="#gamespeed" value="[ 1 ]"></setting>
        <setting name="#minplayers" value="[ 0 ]"></setting>
        <setting name="#gravity" value="[ 0.0080000004 ]"></setting>
        <setting name="#waveheight" value="[ 0 ]"></setting>
        <setting name="#locked_time" value="[ false ]"></setting>
        <setting name="#weather" value="[ 0 ]"></setting>
        <setting name="#time" value="12:0"></setting>
    </settings>
    <script src="mapEditorScriptingExtension_s.Lua" type="server"></script>
    <script src="mapEditorScriptingExtension_c.Lua" type="client" validate="false"></script>
</meta>

 

Link to comment
19 minutes ago, HassoN said:

Everything seems fine to me. What's the exact issue? Does the marker get created in the first place? Or is it only that if you enter nothing happens? Type /debugscript 3 then restart the resource and tell me if you face any error messages

The marker is not created. I don't know to restart the resource because it's not a resource, it's a map. And when I restart in the console the map is restart, i got black screen, but I know to move, and open panels and there is no any problems

Edited by hackermagus
Link to comment
9 minutes ago, hackermagus said:

Map name: 2019-08-16-4

When I type restart 2019-08-16-4 then it says map 2019-08-16-4 restarted

But when I type restart2019-08-16-4 (Without space) it will nothing happens

Yeah I meant without a space in the name itself not between restart and the name.

So you restarted it and the marker did not appear? Uhmm try to change type="map" to type="script" in your meta, maybe because it is a map so your Lua file is not introduced?

Link to comment
9 minutes ago, HassoN said:

Yeah I meant without a space in the name itself not between restart and the name.

So you restarted it and the marker did not appear? Uhmm try to change type="map" to type="script" in your meta, maybe because it is a map so your Lua file is not introduced?

Simple. Nothing happens..

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...