Jump to content

طلب كود


Mohamed

Recommended Posts

فالنفترض دخول المهمة من عبر الماركر :

local table = {  }; 
  
  
addEventHandler ( "onMarkerHit", resourceRoot, function ( element ) 
   if ( getElementType ( element ) == "player" ) then 
     table.insert ( table, element ) 
  end    
end ) 

مجرد مثال بسيط لو فهمت الطريقة تقدر تسويه ع كودكـ

لو حسيت انها صعبة .. بامكانكـ استخدام التيم .

Link to comment
local table = {  }; 
  
  
addEventHandler ( "onMarkerHit", resourceRoot, function ( element ) 
   if ( getElementType ( element ) == "player" ) then 
     table.insert ( table, element ) 
     outputChatBox("Player In Mission "..#table,element,0,255,0) 
  end    
end ) 

Link to comment
local table = {  }; 
local MaxPlayer = 5 
  
addEventHandler ( "onMarkerHit", resourceRoot, function ( element ) 
    if ( getElementType ( element ) == "player" ) then 
        if #table <= MaxPlayer then 
         table.insert ( table, element ) 
         outputChatBox("Player In Mission "..#table,element,0,255,0) 
        end 
    end   
end ) 

Link to comment
local table = {  }; 
local MaxPlayer = 5 
  
addEventHandler ( "onMarkerHit", resourceRoot, function ( element ) 
    if ( getElementType ( element ) == "player" ) then 
        if #table <= MaxPlayer then 
         table.insert ( table, element ) 
         outputChatBox("Player In Mission "..#table,element,0,255,0) 
        end 
    end   
end ) 

عندكـ خطا بسيط بالتحقق من العدد .. التحقق اذا يساوي او اقل من 5

يعني لو كان 5 راح يدخله

= فـ شيل علامة الـ

Link to comment

^

مشكور على التنبيه

صاحب الموضوع هيك لو طلع الاعب يشيله من المهمه

local table = {  }; 
local MaxPlayer = 5 
  
addEventHandler ( "onMarkerHit", resourceRoot, function ( element ) 
    if ( getElementType ( element ) == "player" ) then 
        if #table < MaxPlayer then 
         table.insert ( table, element ) 
         outputChatBox("Player In Mission "..#table,element,0,255,0) 
         else 
         outputChatBox("Mission is Full maximum number of players is "..MaxPlayer,element,0,255,0) 
        end 
    end   
end ) 
  
  
addEventHandler("onPlayerWasted", root, 
function() 
    if table [ source ] then 
        table [ source ] = nil 
    end 
end) 
  
  
addEventHandler("onPlayerQuit", root, 
function() 
    if table [ source ] then 
        table [ source ] = nil 
    end 
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...