Jump to content

طلب , كود !


Recommended Posts

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

اخبار العيال ان شااء الله بخير ,

رمضآن كريم , وكل عام وانتم بخير ..

اما بعد

بغيت كود بسيط

الي هو

اعطاء اللاعب مبلغ كل 10 ثواني

لمدة 10 دقائق

يعني كل 10 ثواني ياخذ 1000 على نفس الحال الين تنتهي الــ 10 دقائق

اظن الكود بسيط ,

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

Link to comment

مشكورين اخواني لكن الفنكشنات عارفها

setTimer function () 
givePlayerMoney(source,1000) 
outputChatBox("",source,255,255,255,true) 
end,1000,1) 

كذا أكون معطيه 1000 كل 10 ثواني

لكن ماعرفت اسوي العملية كلها ل 10 دقائق فقط..

+ الكود الي فوق سويته من الجوال مدري اذا لخبطت ب شيئ :)

Link to comment
مشكورين اخواني لكن الفنكشنات عارفها
setTimer function () 
givePlayerMoney(source,1000) 
outputChatBox("",source,255,255,255,true) 
end,1000,1) 

كذا أكون معطيه 1000 كل 10 ثواني

لكن ماعرفت اسوي العملية كلها ل 10 دقائق فقط..

+ الكود الي فوق سويته من الجوال مدري اذا لخبطت ب شيئ

setTimer(function () 
givePlayerMoney(source,1000) 
outputChatBox("",source,255,255,255,true) 
end,1000,1) 

Link to comment
local Timer = setTimer(function () 
             givePlayerMoney(source,1000) 
             outputChatBox("",source,255,255,255,true) 
   end,1000,1) 
  
setTimer(function () 
           if isTimer ( Timer ) then  
           killTimer ( Timer )  
           outputChatBox("",source,255,255,255,true) 
      end  
end,30000,1) 

مو مجرب

Link to comment

-- Not tested.

-- Server 
Table = { }; 
  
GiveMoney = function ( player ) 
    if isElement ( player ) then 
        givePlayerMoney ( player, 1000 ) 
    else 
        if Table[player] then 
            if isTimer ( Table[player][1] ) then killTimer ( Table[player][1] ) end 
            if isTimer ( Table[player][2] ) then killTimer ( Table[player][2] ) end 
            Table[player] = nil 
        end 
    end 
end 
  
EndGiveMoney = function ( player ) 
    if Table[player] then 
        if isTimer ( Table[player][1] ) then killTimer ( Table[player][1] ) end 
        Table[player] = nil 
    end 
end 
  
AddTimers = function ( ) 
    Table[source] = { }; 
    Table[source][1] = setTimer ( GiveMoney, 10*1000, 0, source ) 
    Table[source][2] = setTimer ( EndGiveMoney, 10*60000, 1, source ) 
end 
addEventHandler ( "onPlayerJoin", root, AddTimers ) 

Link to comment
-- Not tested.
-- Server 
Table = { }; 
  
GiveMoney = function ( player ) 
    if isElement ( player ) then 
        givePlayerMoney ( player, 1000 ) 
    else 
        if Table[player] then 
            if isTimer ( Table[player][1] ) then killTimer ( Table[player][1] ) end 
            if isTimer ( Table[player][2] ) then killTimer ( Table[player][2] ) end 
            Table[player] = nil 
        end 
    end 
end 
  
EndGiveMoney = function ( player ) 
    if Table[player] then 
        if isTimer ( Table[player][1] ) then killTimer ( Table[player][1] ) end 
        Table[player] = nil 
    end 
end 
  
AddTimers = function ( ) 
    Table[source] = { }; 
    Table[source][1] = setTimer ( GiveMoney, 10*1000, 0, source ) 
    Table[source][2] = setTimer ( EndGiveMoney, 10*60000, 1, source ) 
end 
addEventHandler ( "onPlayerJoin", root, AddTimers ) 

مًشكُورر ْ

شف .

--Client Side

addEventHandler ( "onClientGUIClick", resourceRoot,  
function ( ) 
     if ( source == tbr3 ) then 
       if getElementData(localPlayer,"xt") == true then 
     setElementFrozen ( localPlayer, true ) 
                        fadeCamera(false) 
setElementPosition(localPlayer,2496.79175 ,-1683.96619 ,13.37679) 
setTimer ( function () setElementFrozen ( localPlayer, false )  
                        fadeCamera(true) 
end, 5000,1) 
  
    outputChatBox("تم ", 255, 255, 255, true ) 
    setElementData(localPlayer,"xt",false) 
        triggerServerEvent("3nad",getRootElement()) 
else 
       if getElementData(localPlayer,"xt") == false then 
    outputChatBox("-----", 255, 255, 255, true ) 
                guiSetVisible(mywnd , false) 
                guiSetVisible(GUIEditor.window[1] , true) 
    end 
   end 
  end 
 end  ) 
  

-- Server Side ::

Table = { }; 
  
GiveMoney = function ( player ) 
    if isElement ( player ) then 
        givePlayerMoney ( player, 1000 ) 
    else 
        if Table[player] then 
            if isTimer ( Table[player][1] ) then killTimer ( Table[player][1] ) end 
            if isTimer ( Table[player][2] ) then killTimer ( Table[player][2] ) end 
            Table[player] = nil 
        end 
    end 
end 
  
EndGiveMoney = function ( player ) 
    if Table[player] then 
        if isTimer ( Table[player][1] ) then killTimer ( Table[player][1] ) end 
        Table[player] = nil 
    end 
end 
  
AddTimers = function ( ) 
    Table[source] = { }; 
    Table[source][1] = setTimer ( GiveMoney, 10*1000, 0, source ) 
    Table[source][2] = setTimer ( EndGiveMoney, 10*6000, 1, source ) 
end 
addEventHandler ( "onPlayerJoin", getRootElement(), AddTimers ) 
addEvent("3nad", true) 
addEventHandler("3nad", getRootElement(), AddTimers) 

كذا الوضع تمام ؟

Link to comment

يب تمــآم اخوي عناد الكود اشتغل بأكمل وجه

الا خطأ بسيط حدث الي هو

في الوقت الذي اللاعب ياخذ الفلوس ,

مثلا نقول فلوسه 50 الف

نقص من فلوسه واصبحت 20 الف

يوم تزيد فلوسه حق التايمر الفلوس ترجع 50 الف + 1000

مشكلة بسيطة لا بأس بهـآ ..

مشكور اخوي مرة ثانية :)

Link to comment

شوف هذا الكود كنت استخدمه

وعدلته لك

يوزع كل 10 ثواني

و 60 مره

يعني

10 دقائق

function money () 
    givePlayerMoney(getRootElement(),1000) 
    outputChatBox("[$1000]تم توزيع ",player,math.random(255),math.random(255),math.random(255),true) 
end 
setTimer(money,10000,60) 

Link to comment
شوف هذا الكود كنت استخدمه

وعدلته لك

يوزع كل 10 ثواني

و 60 مره

يعني

10 دقائق

function money () 
    givePlayerMoney(getRootElement(),1000) 
    outputChatBox("[$1000]تم توزيع ",player,math.random(255),math.random(255),math.random(255),true) 
end 
setTimer(money,10000,60) 

player مو معرف

Link to comment
يب تمــآم اخوي عناد الكود اشتغل بأكمل وجه

الا خطأ بسيط حدث الي هو

في الوقت الذي اللاعب ياخذ الفلوس ,

مثلا نقول فلوسه 50 الف

نقص من فلوسه واصبحت 20 الف

يوم تزيد فلوسه حق التايمر الفلوس ترجع 50 الف + 1000

مشكلة بسيطة لا بأس بهـآ ..

مشكور اخوي مرة ثانية :)

حياك :P

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