Jump to content

Teleportari cu comanda


enzopaul4

Recommended Posts

Posted

As avea o intrebare , cum as putea face un script , care atunci cand un player scrie de ex: /lv sa il teleporteze la coordonatele la care vreau eu.

Multumesc anticipat

Posted (edited)
lvPos = pune aici pozitia unde vrei sa se spawneze, gen 1.0000, 1.0000, 1.000

function teleportToLV(thePlayer)
	if thePlayer then
		setElementPosition(thePlayer, {lvPos})
		outputChatBox("Ai fost renascut in LV!", thePlayer, 0, 255, 0)
	end
end
addCommandHandler("lv", teleportToLV)

 

Edited by ..:D&G:..
Posted (edited)

Nu functioneaza , scrie decat ca am fost teleportat in Las Venturas , dar nu ma teleporteaza , imi da eroarea aceastaspawn/script.lua:5: bad argument @ 'setElementPosition' [Expected vector3 at argument 2, got table]

 

 

EDIT: l-am facut sa functioneze , multumesc mult de exemplu

Edited by enzopaul4
  • 3 weeks later...
Posted (edited)
addCommandHandler( "teleport",
    function( player )
        setElementPosition( player, x, y, z ) -- Teleporteaza jucatorul la coordonatele x,y,z
    end
)

Poti folosi comanda in acest mod , e mai simpla.

Edited by Krons
Posted
teleports = {
  	["lv"] = {x,y,z,int,dim},--x,y,z,int și dim trebuie completate de către tine
  	["ls"] = {x,y,z,int,dim}
  	--etc,aici mai poți adăuga câte vrei tu
  }

function teleportThePlayer(playerSource,command,location)
  if location then
    if teleports[location] then
		setElementPosition(playerSource,teleports[location][1],teleports[location][2],teleports[location][3])
    else
      outputChatBox("[!]Locația introdusă nu este validă",playerSource,255,0,0,true)
    end
  else
    outputChatBox("[!]Sintaxa corectă este:/goto [Locație]",playerSource,255,0,0,true)
  end
end
addCommandHandler("goto",teleportThePlayer)
--Script-ul nu este testat și s-ar putea să nu meargă
--Dacă nu funcționează postează aici erorile din debugscript

 

Posted

Versiunea correcta a lui @..:D&G:..:

lvPos = { 1.000, 1.000, 1.000 }

function teleportToLV(thePlayer)
	if thePlayer then
		setElementPosition(thePlayer, unpack( lvPos ) )
		outputChatBox("Ai fost renascut in LV!", thePlayer, 0, 255, 0)
	end
end
addCommandHandler("lv", teleportToLV)

 

Posted
2 hours ago, Simple01 said:

Versiunea correcta a lui @..:D&G:..:


lvPos = { 1.000, 1.000, 1.000 }function teleportToLV(thePlayer)	if thePlayer then		setElementPosition(thePlayer, unpack( lvPos ) )		outputChatBox("Ai fost renascut in LV!", thePlayer, 0, 255, 0)	endendaddCommandHandler("lv", teleportToLV)

 

Mergea si fara unpack, gen:

lvPos = 0, 0, 0

Pentru cunostiintele generale ale celorlalti, unpack se foloseste cand vrei sa iei informatii dintr-un tabel (table, informatii inauntrul { } ). Pur si simplu ce face functia unpack e sa scoata ghilimelele :P

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