Jump to content

Teleportation with a car, timer


Recommended Posts

So hello, I maked a script, when i teleport with my command "sf" or "lv" or even "ls" when I'm in a car, I never teleport, but when I'm standing I doo teleport, soo how to do a teleportation with a car that worked when im in car and when im on foot, and i want to add a timer when i say "ls" and on the screen shows "3 seconds until a teleportation", and when hit by a player or a car, stop it by 1 sec and continue it.

commando = { }
laikas = 5000

function Tele( playerSource )
	if (commando[playerSource]) then
	end
		setElementPosition(playerSource, 1518.88757, -1668.16504, 13.54688)	
	commando[playerSource] = true
	setTimer( function()
		commando[playerSource] = false
	end, laikas, 1)
end
addCommandHandler( "ls",Tele)
-------------------------------------------------------------------------------------------------------------------------
function Tele( playerSource )
	if (commando[playerSource]) then
	end
		setElementPosition(playerSource, 2032.60022, 1343.41199, 10.82031)
	commando[playerSource] = true
	setTimer( function()
		commando[playerSource] = false
	end, laikas, 1)
end
addCommandHandler( "lv",Tele)
-------------------------------------------------------------------------------------------------------------------------
function Tele( playerSource )
	if (commando[playerSource]) then
	end
		setElementPosition(playerSource, -2028.97644, 148.12634, 28.83594)
	commando[playerSource] = true
	setTimer( function()
		commando[playerSource] = false
	end, laikas, 1)
end
addCommandHandler( "sf",Tele)
-------------------------------------------------------------------------------------------------------------------------

 

Edited by Skarbonke
Link to comment
commando = { }
laikas = 5000

function Tele( playerSource )
	if (commando[playerSource]) then
	end
		setElementPosition(playerSource, 1518.88757, -1668.16504, 13.54688)	
	commando[playerSource] = true
	setTimer( function()
		commando[playerSource] = false
	end, laikas, 1)
  if isPedInVehicle(playerSource) then
     car = getPedOccupiedVehicle(playerSource)
	 commando[playerSource] = true
	 setElementPosition(car, 1518.88757, -1668.16504, 1354688)
	 warpPedIntoVehicle(playerSource, car)
	 setTimer(function()
	      commando[playerSource] = false
		end, laikas, 1)
  end
end
addCommandHandler( "ls",Tele)
-------------------------------------------------------------------------------------------------------------------------
function Tele( playerSource )
	if (commando[playerSource]) then
	end
		setElementPosition(playerSource, 2032.60022, 1343.41199, 10.82031)
	commando[playerSource] = true
	setTimer( function()
		commando[playerSource] = false
	end, laikas, 1)
	if isPedInVehicle(playerSource) then
     car = getPedOccupiedVehicle(playerSource)
	 commando[playerSource] = true
	 setElementPosition(car, 2032.60022, 1343.41199, 10.82031)
	 warpPedIntoVehicle(playerSource, car)
	 setTimer(function()
	      commando[playerSource] = false
		end, laikas, 1)
	end
end
addCommandHandler( "lv",Tele)
-------------------------------------------------------------------------------------------------------------------------
function Tele( playerSource )
	if (commando[playerSource]) then
	end
		setElementPosition(playerSource, -2028.97644, 148.12634, 28.83594)
	commando[playerSource] = true
	setTimer( function()
		commando[playerSource] = false
	end, laikas, 1)
	if isPedInVehicle(playerSource) then
     car = getPedOccupiedVehicle(playerSource)
	 commando[playerSource] = true
	 setElementPosition(car, -2028.97644, 148.12634, 28.83594)
	 warpPedIntoVehicle(playerSource, car)
	 setTimer(function()
	      commando[playerSource] = false
		end, laikas, 1)
	end
end
addCommandHandler( "sf",Tele)
-------------------------------------------------------------------------------------------------------------------------

try that

  • Like 1
Link to comment
13 minutes ago, Dimos7 said:

commando = { }
laikas = 5000

function Tele( playerSource )
	if (commando[playerSource]) then
	end
		setElementPosition(playerSource, 1518.88757, -1668.16504, 13.54688)	
	commando[playerSource] = true
	setTimer( function()
		commando[playerSource] = false
	end, laikas, 1)
  if isPedInVehicle(playerSource) then
     car = getPedOccupiedVehicle(playerSource)
	 commando[playerSource] = true
	 setElementPosition(car, 1518.88757, -1668.16504, 1354688)
	 warpPedIntoVehicle(playerSource, car)
	 setTimer(function()
	      commando[playerSource] = false
		end, laikas, 1)
  end
end
addCommandHandler( "ls",Tele)
-------------------------------------------------------------------------------------------------------------------------
function Tele( playerSource )
	if (commando[playerSource]) then
	end
		setElementPosition(playerSource, 2032.60022, 1343.41199, 10.82031)
	commando[playerSource] = true
	setTimer( function()
		commando[playerSource] = false
	end, laikas, 1)
	if isPedInVehicle(playerSource) then
     car = getPedOccupiedVehicle(playerSource)
	 commando[playerSource] = true
	 setElementPosition(car, 2032.60022, 1343.41199, 10.82031)
	 warpPedIntoVehicle(playerSource, car)
	 setTimer(function()
	      commando[playerSource] = false
		end, laikas, 1)
	end
end
addCommandHandler( "lv",Tele)
-------------------------------------------------------------------------------------------------------------------------
function Tele( playerSource )
	if (commando[playerSource]) then
	end
		setElementPosition(playerSource, -2028.97644, 148.12634, 28.83594)
	commando[playerSource] = true
	setTimer( function()
		commando[playerSource] = false
	end, laikas, 1)
	if isPedInVehicle(playerSource) then
     car = getPedOccupiedVehicle(playerSource)
	 commando[playerSource] = true
	 setElementPosition(car, -2028.97644, 148.12634, 28.83594)
	 warpPedIntoVehicle(playerSource, car)
	 setTimer(function()
	      commando[playerSource] = false
		end, laikas, 1)
	end
end
addCommandHandler( "sf",Tele)
-------------------------------------------------------------------------------------------------------------------------

try that

omg, it worked, thank u soo much :3, btw how about the timer, how to do it?

i used it, and i found out that, when im in a car and write /ls i get teleported to an ocean, but when im on foot i get to the ls

Link to comment
commando = { }
laikas = 5000

function Tele( playerSource )
	if (commando[playerSource]) then
	end
		setElementPosition(playerSource, 1518.88757, -1668.16504, 13.54688)	
	commando[playerSource] = true
	setTimer( function()
		commando[playerSource] = false
	end, laikas, 1)
  if isPedInVehicle(playerSource) then
     car = getPedOccupiedVehicle(playerSource)
	 commando[playerSource] = true
	 setElementPosition(playerSource, 1518.88757, -1668.16504, 13.54688)	
	 setElementPosition(car, 1518.88757, -1668.16504, 1354688)
	 warpPedIntoVehicle(playerSource, car)
	 setTimer(function()
	      commando[playerSource] = false
		end, laikas, 1)
  end
end
addCommandHandler( "ls",Tele)
-------------------------------------------------------------------------------------------------------------------------
function Tele( playerSource )
	if (commando[playerSource]) then
	end
		setElementPosition(playerSource, 2032.60022, 1343.41199, 10.82031)
	commando[playerSource] = true
	setTimer( function()
		commando[playerSource] = false
	end, laikas, 1)
	if isPedInVehicle(playerSource) then
     car = getPedOccupiedVehicle(playerSource)
	 commando[playerSource] = true
	 setElementPosition(playerSource, 2032.60022, 1343.41199, 10.82031)
	 setElementPosition(car, 2032.60022, 1343.41199, 10.82031)
	 warpPedIntoVehicle(playerSource, car)
	 setTimer(function()
	      commando[playerSource] = false
		end, laikas, 1)
	end
end
addCommandHandler( "lv",Tele)
-------------------------------------------------------------------------------------------------------------------------
function Tele( playerSource )
	if (commando[playerSource]) then
	end
		setElementPosition(playerSource, -2028.97644, 148.12634, 28.83594)
	commando[playerSource] = true
	setTimer( function()
		commando[playerSource] = false
	end, laikas, 1)
	if isPedInVehicle(playerSource) then
     car = getPedOccupiedVehicle(playerSource)
	 commando[playerSource] = true
	 setElementPosition(playerSource, -2028.97644, 148.12634, 28.83594)
	 setElementPosition(car, -2028.97644, 148.12634, 28.83594)
	 warpPedIntoVehicle(playerSource, car)
	 setTimer(function()
	      commando[playerSource] = false
		end, laikas, 1)
	end
end
addCommandHandler( "sf",Tele)
-------------------------------------------------------------------------------------------------------------------------

try that

Link to comment
15 minutes ago, Dimos7 said:

commando = { }
laikas = 5000

function Tele( playerSource )
	if (commando[playerSource]) then
	end
		setElementPosition(playerSource, 1518.88757, -1668.16504, 13.54688)	
	commando[playerSource] = true
	setTimer( function()
		commando[playerSource] = false
	end, laikas, 1)
  if isPedInVehicle(playerSource) then
     car = getPedOccupiedVehicle(playerSource)
	 commando[playerSource] = true
	 setElementPosition(playerSource, 1518.88757, -1668.16504, 13.54688)	
	 setElementPosition(car, 1518.88757, -1668.16504, 1354688)
	 warpPedIntoVehicle(playerSource, car)
	 setTimer(function()
	      commando[playerSource] = false
		end, laikas, 1)
  end
end
addCommandHandler( "ls",Tele)
-------------------------------------------------------------------------------------------------------------------------
function Tele( playerSource )
	if (commando[playerSource]) then
	end
		setElementPosition(playerSource, 2032.60022, 1343.41199, 10.82031)
	commando[playerSource] = true
	setTimer( function()
		commando[playerSource] = false
	end, laikas, 1)
	if isPedInVehicle(playerSource) then
     car = getPedOccupiedVehicle(playerSource)
	 commando[playerSource] = true
	 setElementPosition(playerSource, 2032.60022, 1343.41199, 10.82031)
	 setElementPosition(car, 2032.60022, 1343.41199, 10.82031)
	 warpPedIntoVehicle(playerSource, car)
	 setTimer(function()
	      commando[playerSource] = false
		end, laikas, 1)
	end
end
addCommandHandler( "lv",Tele)
-------------------------------------------------------------------------------------------------------------------------
function Tele( playerSource )
	if (commando[playerSource]) then
	end
		setElementPosition(playerSource, -2028.97644, 148.12634, 28.83594)
	commando[playerSource] = true
	setTimer( function()
		commando[playerSource] = false
	end, laikas, 1)
	if isPedInVehicle(playerSource) then
     car = getPedOccupiedVehicle(playerSource)
	 commando[playerSource] = true
	 setElementPosition(playerSource, -2028.97644, 148.12634, 28.83594)
	 setElementPosition(car, -2028.97644, 148.12634, 28.83594)
	 warpPedIntoVehicle(playerSource, car)
	 setTimer(function()
	      commando[playerSource] = false
		end, laikas, 1)
	end
end
addCommandHandler( "sf",Tele)
-------------------------------------------------------------------------------------------------------------------------

try that

Well the problem was with the ls teleport that the "setElementPosition" was wrong, so i fixed it, but the timer isin't here still

Link to comment
2 hours ago, Dimos7 said:

what excaly you want to do with the timer?

When i say "ls" "lv" "sf" it show's up top of the screen "Time until the teleport " and it goes from 3 to 1 and teleports, when the player is damaged-hit by a car or a player the timer changes it's color to red and stops, 1 second later it continues

A little situation to know what i'm talking about: I say /ls, and it pops up "3 seconds until teleport" I got hit by a player and it shows like this "2 seconds until teleport".

And a little more difficult timer: Hydra, tank, hunter shoots 50m around the player, and the timer goes red too.

And the final timer: When "Me" or the "Player" shoots a bullet with a gun, tank, hydra, hunter the timer gets 25 seconds, when he shoots the timer gets red and for a second it's stops, the second past, it goes normally

If my English wasn't so perfect, I'm sorry :x

Link to comment

so basicly you  want 3 seconds for teleport the player if player getdamage will stop and after 1 second start except if it shot with rhino, hydra 25 seconds?

30 minutes ago, Skarbonke said:

When i say "ls" "lv" "sf" it show's up top of the screen "Time until the teleport " and it goes from 3 to 1 and teleports, when the player is damaged-hit by a car or a player the timer changes it's color to red and stops, 1 second later it continues

A little situation to know what i'm talking about: I say /ls, and it pops up "3 seconds until teleport" I got hit by a player and it shows like this "2 seconds until teleport".

And a little more difficult timer: Hydra, tank, hunter shoots 50m around the player, and the timer goes red too.

And the final timer: When "Me" or the "Player" shoots a bullet with a gun, tank, hydra, hunter the timer gets 25 seconds, when he shoots the timer gets red and for a second it's stops, the second past, it goes normally

If my English wasn't so perfect, I'm sorry :x

 

Link to comment
comondo = {}
laikas = 5000

function Tele(playerSource)
    teleportTimerLS = setTimer(function()
	   if  not isPedInVehicle(playerSource) then
	        setElementPosition(playerSource, 1518.88757, -1668.16504, 13.54688)
			comondo[playerSource] = true
			remain = getTimerDetails(teleportTimerLS)
			outputChatBox(remain.. " seconds untill teleport", playerSource, r, g, b)
			setTimer(function()
			    comondo[playerSource] = false
			end, laikas, 1)
	   else
		   car = getPedOccupiedVehicle(playerSource)
		   comondo[playerSource] = true
		   setElementPosition(car, 1518.88757, -1668.16504, 13.54688)
		   warpPedIntoVehicle(playerSource, car)
		   setTimer(function()
			    comondo[playerSource] = false
			end, laikas, 1)
	   end
	end, 3000, 1)
end
addCommandHandler("ls", Tele)
-------------------------------------------------------------------------------------------------------------------------
function Tele(playerSource)
    teleportTimerLV = setTimer(function()
	   if  not isPedInVehicle(playerSource) then
	        setElementPosition(playerSource, 2032.60022, 1343.41199, 10.82031)
			comondo[playerSource] = true
			remain = getTimerDetails(teleportTimerLV)
			outputChatBox(remain.. " seconds untill teleport", playerSource, r, g, b)
			setTimer(function()
			    comondo[playerSource] = false
			end, laikas, 1)
	   else
		   car = getPedOccupiedVehicle(playerSource)
		   comondo[playerSource] = true
		   setElementPosition(car, 2032.60022, 1343.41199, 10.82031)
		   warpPedIntoVehicle(playerSource, car)
		   setTimer(function()
			    comondo[playerSource] = false
			end, laikas, 1)
	   end
	end, 3000, 1)
end
addCommandHandler("lv", Tele)
-------------------------------------------------------------------------------------------------------------------------
function Tele(playerSource)
    teleportTimerSF = setTimer(function()
	   if  not isPedInVehicle(playerSource) then
	        setElementPosition(playerSource, -2028.97644, 148.12634, 28.83594)
			comondo[playerSource] = true
			remain = getTimerDetails(teleportTimerSF)
			outputChatBox(remain.. " seconds untill teleport", playerSource, r, g, b)
			setTimer(function()
			    comondo[playerSource] = false
			end, laikas, 1)
	   else
		   car = getPedOccupiedVehicle(playerSource)
		   comondo[playerSource] = true
		   setElementPosition(car, -2028.97644, 148.12634, 28.83594)
		   warpPedIntoVehicle(playerSource, car)
		   setTimer(function()
			    comondo[playerSource] = false
			end, laikas, 1)
	   end
	end, 3000, 1)
end
addCommandHandler("sf", Tele)

that show only the timer , for damage and stop it you need event and killTimer function, replace r, g,b with numbers

  • Like 1
Link to comment
comondo = {}
laikas = 5000

function Tele(playerSource)
    teleportTimerLS = setTimer(function()
	   if  not isPedInVehicle(playerSource) then
	        setElementPosition(playerSource, 1518.88757, -1668.16504, 13.54688)
			comondo[playerSource] = true
			setTimer(function()
			    comondo[playerSource] = false
			end, laikas, 1)
	   else
		   car = getPedOccupiedVehicle(playerSource)
		   comondo[playerSource] = true
		   setElementPosition(car, 1518.88757, -1668.16504, 13.54688)
		   warpPedIntoVehicle(playerSource, car)
		   setTimer(function()
			    comondo[playerSource] = false
			end, laikas, 1)
	   end
	end, 3000, 1)
  remain = getTimerDetails(teleportTimerLS)
  outputChatBox(remain.. " seconds untill teleport", playerSource, r, g, b)
end
addCommandHandler("ls", Tele)
-------------------------------------------------------------------------------------------------------------------------
function Tele(playerSource)
    teleportTimerLV = setTimer(function()
	   if  not isPedInVehicle(playerSource) then
	        setElementPosition(playerSource, 2032.60022, 1343.41199, 10.82031)
			comondo[playerSource] = true
			setTimer(function()
			    comondo[playerSource] = false
			end, laikas, 1)
	   else
		   car = getPedOccupiedVehicle(playerSource)
		   comondo[playerSource] = true
		   setElementPosition(car, 2032.60022, 1343.41199, 10.82031)
		   warpPedIntoVehicle(playerSource, car)
		   setTimer(function()
			    comondo[playerSource] = false
			end, laikas, 1)
	   end
	end, 3000, 1)
  remain = getTimerDetails(teleportTimerLV)
  outputChatBox(remain.. " seconds untill teleport", playerSource, r, g, b)
end
addCommandHandler("lv", Tele)
-------------------------------------------------------------------------------------------------------------------------
function Tele(playerSource)
    teleportTimerSF = setTimer(function()
	   if  not isPedInVehicle(playerSource) then
	        setElementPosition(playerSource, -2028.97644, 148.12634, 28.83594)
			comondo[playerSource] = true
			setTimer(function()
			    comondo[playerSource] = false
			end, laikas, 1)
	   else
		   car = getPedOccupiedVehicle(playerSource)
		   comondo[playerSource] = true
		   setElementPosition(car, -2028.97644, 148.12634, 28.83594)
		   warpPedIntoVehicle(playerSource, car)
		   setTimer(function()
			    comondo[playerSource] = false
			end, laikas, 1)
	   end
	end, 3000, 1)
  			remain = getTimerDetails(teleportTimerSF)
			outputChatBox(remain.. " seconds untill teleport", playerSource, r, g, b)
end
addCommandHandler("sf", Tele)

try it

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