Jump to content

مساعدة في الماركرات


Recommended Posts

السلام عليكم ورحمة الله وبركاته

عندي مشكلة / استفسار

Markers = { {-1499.6569824219, -10.275520324707, 13.1484375},{-1482.0515136719, 10.204844474792, 13.1484375} } 
      
local x, y, z = unpack(Markers[math.random(#Markers)]) 
local MaaRkkeer = createMarker( x, y, z, "cylinder", 2 ) 
      
function datanana( ) 
     destroyElement( MaaRkkeer ) 
end 
addEventHandler("onMarkerHit", MaaRkkeer, datanana) 

الكود يشتغل

100%

وما فيه اخطاء

بس ما يفهم انا وش ابي منه

انا في راسي اني اسوي ماركر اذا لمستها

تجيك ماركر ثانية

انا سويت

table

من الــ

positions

يعني مثلاً اذا الاعب لمس الماركر الي في بوستشن الاولى الي هي

{-1499.6569824219, -10.275520324707, 13.1484375}

تجيه الثانية

الي هي

{-1482.0515136719, 10.204844474792, 13.1484375}

طيب .. يشتغل تمام

بس لمن اجي المس الثانية ما تختفي

وتجي الماركر الاولى

القصد من هالكود اني ابي اذا لمس الماركر الاولى تجيه الثانية واذا لمس الثانية تجيه الأولى

واذا لمس الأولى تجيه الثانية

يعني ماركرات مهي محدودة

يقعد اللاعب يلمس في الماركرات اليين ما يطفش

ما تنتهي الماركرات

يا رب تكونوا فهمتوا قصدي

والسلام عليكم ورحمة الله وبركاته

Link to comment
  • Other Languages Moderators
Markers = { {-1499.6569824219, -10.275520324707, 13.1484375},{-1482.0515136719, 10.204844474792, 13.1484375} } 
local x, y, z = unpack(Markers[1]) 
local MaaRkkeer = createMarker(x, y, z, "cylinder", 2) 
function datanana() 
     removeEventHandler("onMarkerHit", MaaRkkeer, datanana) 
     destroyElement(MaaRkkeer) 
     if not i then i = 1 else i = i + 1 end 
     if i > #Markers then i = 1 end 
     local x, y, z = unpack(Markers[i]) 
     MaaRkkeer = createMarker(x, y, z, "cylinder", 2) 
     addEventHandler("onMarkerHit", MaaRkkeer, datanana) 
end 
addEventHandler("onMarkerHit", MaaRkkeer, datanana) 

Link to comment
Markers = { {-1499.6569824219, -10.275520324707, 13.1484375},{-1482.0515136719, 10.204844474792, 13.1484375} } 
local x, y, z = unpack(Markers[1]) 
local MaaRkkeer = createMarker(x, y, z, "cylinder", 2) 
function datanana() 
     removeEventHandler("onMarkerHit", MaaRkkeer, datanana) 
     destroyElement(MaaRkkeer) 
     if not i then i = 1 else i = i + 1 end 
     if i > #Markers then i = 1 end 
     local x, y, z = unpack(Markers[i]) 
     MaaRkkeer = createMarker(x, y, z, "cylinder", 2) 
     addEventHandler("onMarkerHit", MaaRkkeer, datanana) 
end 
addEventHandler("onMarkerHit", MaaRkkeer, datanana) 

  
  
  
Markers = { {-1499.6569824219, -10.275520324707, 13.1484375},{-1482.0515136719, 10.204844474792, 13.1484375} } 
local x, y, z = unpack(Markers[1]) 
local MaaRkkeer = createMarker(x, y, z, "cylinder", 2) 
function datanana() 
     removeEventHandler("onMarkerHit", MaaRkkeer, datanana) 
     destroyElement(MaaRkkeer) 
     if not i then i = 2  else i = i + 1 end 
     if i > #Markers then i = 1 end 
     local x, y, z = unpack(Markers[i]) 
     MaaRkkeer = createMarker(x, y, z, "cylinder", 2) 
     addEventHandler("onMarkerHit", MaaRkkeer, datanana) 
end 
addEventHandler("onMarkerHit", MaaRkkeer, datanana) 
  

Link to comment
Markers = { {-1499.6569824219, -10.275520324707, 13.1484375},{-1482.0515136719, 10.204844474792, 13.1484375} } 
local x, y, z = unpack(Markers[1]) 
local MaaRkkeer = createMarker(x, y, z, "cylinder", 2) 
function datanana() 
     removeEventHandler("onMarkerHit", MaaRkkeer, datanana) 
     destroyElement(MaaRkkeer) 
     if not i then i = 1 else i = i + 1 end 
     if i > #Markers then i = 1 end 
     local x, y, z = unpack(Markers[i]) 
     MaaRkkeer = createMarker(x, y, z, "cylinder", 2) 
     addEventHandler("onMarkerHit", MaaRkkeer, datanana) 
end 
addEventHandler("onMarkerHit", MaaRkkeer, datanana) 

  
  
  
Markers = { {-1499.6569824219, -10.275520324707, 13.1484375},{-1482.0515136719, 10.204844474792, 13.1484375} } 
local x, y, z = unpack(Markers[1]) 
local MaaRkkeer = createMarker(x, y, z, "cylinder", 2) 
function datanana() 
     removeEventHandler("onMarkerHit", MaaRkkeer, datanana) 
     destroyElement(MaaRkkeer) 
     if not i then i = 2  else i = i + 1 end 
     if i > #Markers then i = 1 end 
     local x, y, z = unpack(Markers[i]) 
     MaaRkkeer = createMarker(x, y, z, "cylinder", 2) 
     addEventHandler("onMarkerHit", MaaRkkeer, datanana) 
end 
addEventHandler("onMarkerHit", MaaRkkeer, datanana) 
  

وش غيرت يعني ؟

Link to comment
Markers = { {-1499.6569824219, -10.275520324707, 13.1484375},{-1482.0515136719, 10.204844474792, 13.1484375} } 
local x, y, z = unpack(Markers[1]) 
local MaaRkkeer = createMarker(x, y, z, "cylinder", 2) 
function datanana() 
     removeEventHandler("onMarkerHit", MaaRkkeer, datanana) 
     destroyElement(MaaRkkeer) 
     if not i then i = 1 else i = i + 1 end 
     if i > #Markers then i = 1 end 
     local x, y, z = unpack(Markers[i]) 
     MaaRkkeer = createMarker(x, y, z, "cylinder", 2) 
     addEventHandler("onMarkerHit", MaaRkkeer, datanana) 
end 
addEventHandler("onMarkerHit", MaaRkkeer, datanana) 

  
  
  
Markers = { {-1499.6569824219, -10.275520324707, 13.1484375},{-1482.0515136719, 10.204844474792, 13.1484375} } 
local x, y, z = unpack(Markers[1]) 
local MaaRkkeer = createMarker(x, y, z, "cylinder", 2) 
function datanana() 
     removeEventHandler("onMarkerHit", MaaRkkeer, datanana) 
     destroyElement(MaaRkkeer) 
     if not i then i = 2  else i = i + 1 end 
     if i > #Markers then i = 1 end 
     local x, y, z = unpack(Markers[i]) 
     MaaRkkeer = createMarker(x, y, z, "cylinder", 2) 
     addEventHandler("onMarkerHit", MaaRkkeer, datanana) 
end 
addEventHandler("onMarkerHit", MaaRkkeer, datanana) 
  

وش غيرت يعني ؟

TAPL

Markers = { {-1499.6569824219, -10.275520324707, 13.1484375},{-1482.0515136719, 10.204844474792, 13.1484375} } 
local x, y, z = unpack(Markers[1]) 
local MaaRkkeer = createMarker(x, y, z, "cylinder", 2) 
function datanana() 
     removeEventHandler("onMarkerHit", MaaRkkeer, datanana) 
     destroyElement(MaaRkkeer) 
     if not i then i = 1  else i = i + 1 end 
     if i > #Markers then i = 1 end 
     local x, y, z = unpack(Markers[i]) 
     MaaRkkeer = createMarker(x, y, z, "cylinder", 2) 
     addEventHandler("onMarkerHit", MaaRkkeer, datanana) 
end 
addEventHandler("onMarkerHit", MaaRkkeer, datanana) 
  

Booo

Markers = { {-1499.6569824219, -10.275520324707, 13.1484375},{-1482.0515136719, 10.204844474792, 13.1484375} } 
local x, y, z = unpack(Markers[1]) 
local MaaRkkeer = createMarker(x, y, z, "cylinder", 2) 
function datanana() 
     removeEventHandler("onMarkerHit", MaaRkkeer, datanana) 
     destroyElement(MaaRkkeer) 
     if not i then i = 2  else i = i + 1 end--BeforeFix = 1 AfterFix =2 
     if i > #Markers then i = 1 end 
     local x, y, z = unpack(Markers[i]) 
     MaaRkkeer = createMarker(x, y, z, "cylinder", 2) 
     addEventHandler("onMarkerHit", MaaRkkeer, datanana) 
end 
addEventHandler("onMarkerHit", MaaRkkeer, datanana) 
  

Link to comment
Markers = { {-1499.6569824219, -10.275520324707, 13.1484375},{-1482.0515136719, 10.204844474792, 13.1484375} } 
local x, y, z = unpack(Markers[1]) 
local MaaRkkeer = createMarker(x, y, z, "cylinder", 2) 
function datanana() 
     removeEventHandler("onMarkerHit", MaaRkkeer, datanana) 
     destroyElement(MaaRkkeer) 
     if not i then i = 1 else i = i + 1 end 
     if i > #Markers then i = 1 end 
     local x, y, z = unpack(Markers[i]) 
     MaaRkkeer = createMarker(x, y, z, "cylinder", 2) 
     addEventHandler("onMarkerHit", MaaRkkeer, datanana) 
end 
addEventHandler("onMarkerHit", MaaRkkeer, datanana) 

Listen TAPL the ' i ' letter is a loop and i know it

so

' i ' is not defined anywhere as i see , but that code is fine though , can you please tell me why is ' i ' for ?

Link to comment
  • Other Languages Moderators
Markers = { {-1499.6569824219, -10.275520324707, 13.1484375},{-1482.0515136719, 10.204844474792, 13.1484375} } 
local x, y, z = unpack(Markers[1]) 
local MaaRkkeer = createMarker(x, y, z, "cylinder", 2) 
function datanana() 
     removeEventHandler("onMarkerHit", MaaRkkeer, datanana) 
     destroyElement(MaaRkkeer) 
     if not i then i = 1 else i = i + 1 end 
     if i > #Markers then i = 1 end 
     local x, y, z = unpack(Markers[i]) 
     MaaRkkeer = createMarker(x, y, z, "cylinder", 2) 
     addEventHandler("onMarkerHit", MaaRkkeer, datanana) 
end 
addEventHandler("onMarkerHit", MaaRkkeer, datanana) 

Listen TAPL the ' i ' letter is a loop and i know it

so

' i ' is not defined anywhere as i see , but that code is fine though , can you please tell me why is ' i ' for ?

"i" is not for loop, it's just a variable contain a number that increasing every time you hit the marker until it reached the table limit/size and then back again to number 1.

as you can see "i" is used as index to the table to get the value from it

and "i" is being defined/Increases here

if not i then i = 1 else i = i + 1 end 

and Booo was right it's should start from number 2 not 1 because we already create the number 1 in line 2

if not i then i = 2  else i = i + 1 end 

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