Jump to content

Spawn


Sfa7

Recommended Posts

Posted (edited)

سلام

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

اتمني فهمتوني :) ...

Edited by Guest

مبتدي بلبرمجه

=====================

~| حياكم الله بسيرفر درب الخطــر شرفونا |~

=====================

Posted

لازم جدول اتوقع وفي طريقة سهله

'onClientMarkerHit' 
  
Function ***.ًًٍٍَُِِ 
createMarker 
getElementPosition 
destroyElement 

الطريقة هي اذا لمست الماركر بينقلك المدينة وبينحذف الماركر وبيجي ماركر ثاني ويجي الثاني وكذا ان شاء الله بتتعلم

Old Nick : MaxUr

,

#Skype : maxurmaxur

BBM : 577287FC

Posted

local HitCount = 0 
local marker = createMarker(x,y,z,'cylinder',3,255,5,0,170) 
  
addEventHandler('onMarkerHit',marker,function(element) 
    HitCount = HitCount + 1 
        if getElementType(element) == 'player' then 
            if HitCount == 1 then 
                setElementPosition(element,x,y,z) 
            elseif HitCount == 2 then 
                setElementPosition(element,x,y,z) 
            elseif HitCount == 3 then 
                setElementPosition(element,x,y,z) 
                HitCount = 0 
            end 
        end 
    end 
) 

Sha67 سابقاً

Posted (edited)

شككرا ي كفو ثانكيو ثانكيو

Edited by Guest

مبتدي بلبرمجه

=====================

~| حياكم الله بسيرفر درب الخطــر شرفونا |~

=====================

Posted

سؤال بسيط

لو سويته كلنت مثلا لمست انا الماركر وداني المدينه الاولي وجاء واحد غيري ولمسه يوديه المدينه الاولي ولا الثانيه لأني لمسته قبله ؟

ولا اذا سويته كلنت كل لاعب له نقاطه بل ماركر ؟

يعني

hitcount = hitcount + 1 هاذي تزيد عند الكل ولا عند الي لمس الماركر فقط ؟اذا سويته كلنت

مبتدي بلبرمجه

=====================

~| حياكم الله بسيرفر درب الخطــر شرفونا |~

=====================

Posted (edited)

اذا كلنت كل واحد لحاله

اذا سيرفر كلكم على كاونت واحد, الا اذا سويت جدول

local hitCount = { } 
local marker = createMarker( x, y, z, "cylinder", 3, 255, 0, 0, 255 ) 
  
addEventHandler( "onMarkerHit", marker, function( element ) 
    if getElementType( element ) == "player" then 
        hitCount[element] = ( hitCount[element] + 1 ) or 1 
        if hitCount[element] == 1 then 
            setElementPosition( element, x, y, z ) 
        elseif hitCount[element] == 2 then 
            setElementPosition( element, x, y, z ) 
        elseif hitCount[element] == 3 then 
            setElementPosition( element, x, y, z ) 
            hitCount[element] = 0 
        end 
    end 
end ) 

*Edit : root = marker ( Thx TheBest :D )

Edited by Guest

" Keep Thinking Different . " - Steve Jops

--------------------

Don't send me PMs asking for help, I Won't reply !

Posted

اها

طيب ممكن تشرحلي هذا لأني مافهمته

 hitCount[element] = ( hitCount[element] + 1 ) or 1 

Note : الجدول اذا كان فااضي وبـ الحدث سويناله

hitCount[element] = ( hitCount[element] + 1  

يعتبر جدول للارقام صح ؟

و يليت تشرحلي الاكود هذا

 hitCount[element] = ( hitCount[element] + 1 ) or 1 

مبتدي بلبرمجه

=====================

~| حياكم الله بسيرفر درب الخطــر شرفونا |~

=====================

Posted

local hitCount = { } -- جدول عشان يحسب لكل لاعب لحاله 
local marker = createMarker( x, y, z, "cylinder", 3, 255, 0, 0, 255 ) -- ماركر 
  
addEventHandler( 'onMarkerHit', marker, function( element ) -- حدث اذا لمس الماركر 
    if getElementType( element ) == 'player' then -- تحقق من الي لمس الماركر انه لاعب 
        if not hitCount[element] then hitCount[element] = 0 end -- تحقق من قيمه الجدول اذا ماله قيمه نخلي قيمته صفر 
        hitCount[element] = ( hitCount[element] + 1 ) -- نزود قيمه الجدول كل ما ينلمس الماركر من اللاعب 
        if hitCount[element] == 1 then -- كانت القيمه تساوي 1 
            setElementPosition( element, x, y, z ) -- ينقله للمكان الاول 
        elseif hitCount[element] == 2 then -- اذا كانت القيمه تساوي 2  
            setElementPosition( element, x, y, z ) -- ينقله للمكان الثاني 
        elseif hitCount[element] == 3 then -- اذا كانت القيمه تساوي 3 
            setElementPosition( element, x, y, z ) -- ينقله للمكان الثالث 
            hitCount[element] = 0 -- نرجع قيمه الجدول لصفر 
        end 
    end 
end ) 

Sha67 سابقاً

Posted

اها شككرا ي الغاالي وماقصرررت وجزاكم الله خير

مبتدي بلبرمجه

=====================

~| حياكم الله بسيرفر درب الخطــر شرفونا |~

=====================

Posted
اظن بيجي خطأ بالديبوق لأن الجدول ماله قيمه ,

hitCount[element] = 0

or لا عادي راح يعتبر اني أعرف القيمة لأول مرة اذا ما كانت موجودة, لأني حاط الشرط

" Keep Thinking Different . " - Steve Jops

--------------------

Don't send me PMs asking for help, I Won't reply !

Posted
:) .. لول معك حق

" Keep Thinking Different . " - Steve Jops

--------------------

Don't send me PMs asking for help, I Won't reply !

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