enzopaul4 Posted September 22, 2016 Share Posted September 22, 2016 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 Link to comment
..:D&G:.. Posted September 22, 2016 Share Posted September 22, 2016 (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 September 22, 2016 by ..:D&G:.. Link to comment
enzopaul4 Posted September 23, 2016 Author Share Posted September 23, 2016 (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 September 23, 2016 by enzopaul4 Link to comment
Krons Posted October 13, 2016 Share Posted October 13, 2016 (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 October 13, 2016 by Krons Link to comment
G-Stefan Posted October 13, 2016 Share Posted October 13, 2016 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 Link to comment
Simple0x47 Posted October 14, 2016 Share Posted October 14, 2016 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) Link to comment
..:D&G:.. Posted October 14, 2016 Share Posted October 14, 2016 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 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now