Jump to content

سؤال


Recommended Posts

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

في Parameters بدون حدث يعني يسوي فنكشن مثلا زي كذا

OutPut = function (mta) 
outputchatbox ("Hello") 
end 

يعني هاي الفنكشن تستعمل في فنكشنات زي كذا

function onjoin() 
playSound("join.mp3")  
OutPut () 
end 
addEventHandler("onClientPlayerJoin", getRootElement(), onJoin) 

[mta] ?? Parameters من وين جاء

Link to comment

كودك فيه اخطاء

outputChatBox يفترض تكتبها outputchatbox مثلا

onjoin بينما اسم الفنكشن انت حاطه onJoin اسم الفنكشن الي رابط فيه الحدث

غير موجود/nil بالكود الي انت حاطه ما ارسلت اي قيمة يعني البارتمر رح يكون mta بالنسبة للبارتمر

Link to comment

لما اللاعب يسجل دخول حط اسم اللاعب في الحساب حقة اكاونت داتا

و لما يغير اللاعب اسمه حط الأسم الجديد في الحساب اكاونت داتا

إذا تبي تجيب اسم اللاعب من الأكاونت تجيبه من الأكاونت داتا الي حطيته لما سجل الدخول/غير اسمه

getPlayerName 
getPlayerAccount 
isGuestAccount 
setAccountData 
getAccountData 
'onPlayerLogin' 
'onPlayerChangeNick' 

Link to comment
addEventHandler("onPlayerWasted", root, 
function(_, killer) 
    if killer and getElementType(killer) == "player" then 
        local checkGuest = getPlayerAccount(killer) 
        if checkGuest and not isGuestAccount(checkGuest) then 
            local Tkill = tonumber(getAccountData(checkGuest, "kills") or 0) 
            if (Tkill+1 >= 1) then 
                setAccountData(checkGuest, "kills", 0) 
                setAccountData(checkGuest, "Level", (getAccountData(checkGuest, "Level") or 0) + 1) 
             local TopTable = {} 
    for i, account in ipairs(getAccounts()) do 
        table.insert(TopTable, {account, (getAccountData(account, "Level") or 0)}) 
    end 
     local accounta = getAccountName(TopTable[1][1]) 
    table.sort(TopTable, function(a, b) return a[2] > b[2] end) 
    outputChatBox("AccountName: "..getAccountData(accounta,"name").." | Level: "..TopTable[1][2], Player, 255, 255, 255) 
  
            else 
                setAccountData(checkGuest, "kills", Tkill+1) 
            end 
        end 
  end 
  end) 
   
  
   
   
  addEventHandler("onPlayerLogin", root, 
  function () 
  local playeraccount = getPlayerAccount ( source ) 
  if ( playeraccount ) and not isGuestAccount ( playeraccount ) then 
  local playername = getPlayerName( Source ) 
 setAccountData ( playeraccount, "name", playername ) 
 end 
  end) 
   
  function nickChangeHandler() 
    local playeraccount = getPlayerAccount ( source ) 
  if ( playeraccount ) and not isGuestAccount ( playeraccount ) then 
  local playername = getPlayerName( Source ) 
 setAccountData ( playeraccount, "name", playername ) 
 end 
  end 
  addEventHandler("onPlayerChangeNick", getRootElement(), nickChangeHandler) 
   
   
   
   

طيب وش مشكلة ذا الاخ

debug:Script\server.lua:16: attempt to concatenate a boolean value

Link to comment
addEventHandler("onPlayerWasted", root, 
function(_, killer) 
    if killer and getElementType(killer) == "player" then 
        local checkGuest = getPlayerAccount(killer) 
        if checkGuest and not isGuestAccount(checkGuest) then 
            local Tkill = tonumber(getAccountData(checkGuest, "kills") or 0) 
            if (Tkill+1 >= 1) then 
                setAccountData(checkGuest, "kills", 0) 
                setAccountData(checkGuest, "Level", (getAccountData(checkGuest, "Level") or 0) + 1) 
             local TopTable = {} 
    for i, account in ipairs(getAccounts()) do 
        table.insert(TopTable, {account, (getAccountData(account, "Level") or 0)}) 
    end 
     local accounta = getAccountName(TopTable[1][1]) 
    table.sort(TopTable, function(a, b) return a[2] > b[2] end) 
    outputChatBox("AccountName: "..getAccountData(accounta,"name").." | Level: "..TopTable[1][2], Player, 255, 255, 255) 
  
            else 
                setAccountData(checkGuest, "kills", Tkill+1) 
            end 
        end 
  end 
  end) 
   
  
   
   
  addEventHandler("onPlayerLogin", root, 
  function () 
  local playeraccount = getPlayerAccount ( source ) 
  if ( playeraccount ) and not isGuestAccount ( playeraccount ) then 
  local playername = getPlayerName( Source ) 
 setAccountData ( playeraccount, "name", playername ) 
 end 
  end) 
   
  function nickChangeHandler() 
    local playeraccount = getPlayerAccount ( source ) 
  if ( playeraccount ) and not isGuestAccount ( playeraccount ) then 
  local playername = getPlayerName( Source ) 
 setAccountData ( playeraccount, "name", playername ) 
 end 
  end 
  addEventHandler("onPlayerChangeNick", getRootElement(), nickChangeHandler) 
   
   
   
   

طيب وش مشكلة ذا الاخ

debug:Script\server.lua:16: attempt to concatenate a boolean value

م فهمت بالظبط أنت وش تبي يسوي الكود ذا ؟

outputChatBox("AccountName: "..getAccountData(accounta,"name").." | Level: "..TopTable[1][2], Player, 255, 255, 255) 

Link to comment

addEventHandler ("onPlayerWasted", root, 
function(_, killer) 
    if killer and getElementType (killer) == "player" then 
        local checkGuest = getPlayerAccount (killer) 
        if not isGuestAccount (checkGuest) then 
            local Tkill = tonumber (getAccountData (checkGuest, "kills") or 0) 
            if (Tkill+1 >= 1) then 
                setAccountData (checkGuest, "kills", 0) 
                setAccountData (checkGuest, "Level", (getAccountData (checkGuest, "Level") or 0) + 1) 
                local TopTable = {} 
                for i, account in ipairs (getAccounts ()) do 
                   table.insert (TopTable, {account, (getAccountData (account, "Level") or 0)}) 
                end 
                local accounta = getAccountName (TopTable[1][1]) 
                table.sort (TopTable, function(a, b) return a[2] > b[2] end) 
                outputChatBox ("AccountName: " .. getAccountData (accounta, "name") .. " | Level: " .. TopTable[1][2], killer, 255, 255, 255) 
            else 
                setAccountData (checkGuest, "kills", Tkill+1) 
              end 
          end 
      end 
  end 
) 
  
addEventHandler("onPlayerLogin", root,  
  function () 
    local playeraccount = getPlayerAccount (source) 
    if not isGuestAccount (playeraccount) then 
      local playername = getPlayerName (source) 
      setAccountData (playeraccount, "name", playername) 
    end 
  end 
  ) 
  
addEventHandler ("onPlayerChangeNick", root,  
  function (_, new) 
    local playeraccount = getPlayerAccount (source) 
    if not isGuestAccount (playeraccount) then 
      setAccountData (playeraccount, "name", new) 
    end 
  end 
) 
Link to comment

addEventHandler ("onPlayerWasted", root, 
function(_, killer) 
    if killer and getElementType (killer) == "player" then 
        local checkGuest = getPlayerAccount (killer) 
        if not isGuestAccount (checkGuest) then 
            local Tkill = tonumber (getAccountData (checkGuest, "kills") or 0) 
            if (Tkill+1 >= 1) then 
                setAccountData (checkGuest, "kills", 0) 
                setAccountData (checkGuest, "Level", (getAccountData (checkGuest, "Level") or 0) + 1) 
                local TopTable = {} 
                for i, account in ipairs (getAccounts ()) do 
                   table.insert (TopTable, {account, (getAccountData (account, "Level") or 0)}) 
                end 
                local accounta = getAccountName (TopTable[1][1]) 
                table.sort (TopTable, function(a, b) return a[2] > b[2] end) 
                if not getAccountData (checkGuest, "name") then 
                  setAccountData (checkGuest, "name", getPlayerName (killer)) 
                end 
                outputChatBox ("AccountName: " .. getAccountData (checkGuest, "name") .. " | Level: " .. TopTable[1][2], killer, 255, 255, 255) 
            else 
                setAccountData (checkGuest, "kills", Tkill+1) 
              end 
          end 
      end 
  end 
) 
  
addEventHandler("onPlayerLogin", root,  
  function () 
    local playeraccount = getPlayerAccount (source) 
    if not isGuestAccount (playeraccount) then 
      local playername = getPlayerName (source) 
      setAccountData (playeraccount, "name", playername) 
    end 
  end 
  ) 
  
addEventHandler ("onPlayerChangeNick", root,  
  function (_, new) 
    local playeraccount = getPlayerAccount (source) 
    if not isGuestAccount (playeraccount) then 
      setAccountData (playeraccount, "name", new) 
    end 
  end 
) 
Link to comment

انت ما حددت وش تبي بالضبط

قلت فوق ابيه يطلع الاسم وعطاك تابل الفنكشنات حقتها

وجيت صححتها لك على انه يطلع الاسم حقه

الحين تقول ابيه على اسم الحساب , حدد ,#

جرب هذا:

addEventHandler ("onPlayerWasted", root, 
function(_, killer) 
    if killer and getElementType (killer) == "player" then 
        local checkGuest = getPlayerAccount (killer) 
        if not isGuestAccount (checkGuest) then 
            local Tkill = tonumber (getAccountData (checkGuest, "kills") or 0) 
            if (Tkill+1 >= 1) then 
                setAccountData (checkGuest, "kills", 0) 
                setAccountData (checkGuest, "Level", (getAccountData (checkGuest, "Level") or 0) + 1) 
                local TopTable = {} 
                for i, account in ipairs (getAccounts ()) do 
                   table.insert (TopTable, {getAccountName (account), (getAccountData (account, "Level") or 0)}) 
                end 
                table.sort (TopTable, function(a, b) return a[2] > b[2] end) 
                if not getAccountData (checkGuest, "name") then 
                  setAccountData (checkGuest, "name", getPlayerName (killer)) 
                end 
                local level = getAccountData (killer, "Level") 
                local acc = getAccountName (checkGuest) 
                outputChatBox ("Account Name: " .. acc .. " | Level: " .. level, killer, 255, 255, 255) 
            else 
                setAccountData (checkGuest, "kills", Tkill+1) 
              end 
          end 
      end 
  end 
) 
  
addEventHandler("onPlayerLogin", root,  
  function () 
    local playeraccount = getPlayerAccount (source) 
    if not isGuestAccount (playeraccount) then 
      local playername = getPlayerName (source) 
      setAccountData (playeraccount, "name", playername) 
    end 
  end 
  ) 
  
addEventHandler ("onPlayerChangeNick", root,  
  function (_, new) 
    local playeraccount = getPlayerAccount (source) 
    if not isGuestAccount (playeraccount) then 
      setAccountData (playeraccount, "name", new) 
    end 
  end 
) 
Link to comment
addEventHandler("onPlayerWasted", root, 
function(_, killer) 
    if killer and getElementType(killer) == "player" and killer ~= source then 
        local checkGuest = getPlayerAccount(killer) 
        if not isGuestAccount(checkGuest) then 
            local Tkill = tonumber(getAccountData(checkGuest, "kills") or 0) 
            if (Tkill+1 >= 1) then 
                setAccountData(checkGuest, "kills", 0) 
                setAccountData(checkGuest, "Level", (getAccountData(checkGuest, "Level") or 0) + 1) 
                local TopTable = {} 
                for i, account in ipairs(getAccounts()) do 
                   table.insert(TopTable, {account, (getAccountData(account, "Level") or 0)}) 
                end 
                table.sort(TopTable, function(a, b) return a[2] > b[2] end) 
                outputChatBox("Player Name: "..(getAccountData(TopTable[1][1], "name") or "N/A").." | Level: "..TopTable[1][2], killer, 255, 255, 255) 
            else 
                setAccountData(checkGuest, "kills", Tkill+1) 
            end 
        end 
    end 
end) 
  
addEventHandler("onPlayerLogin", root, 
function(_, account) 
    setAccountData(account, "name", getPlayerName(source)) 
end) 
  
addEventHandler("onPlayerChangeNick", root, 
function(_, new) 
    local account = getPlayerAccount(source) 
    if not isGuestAccount(account) then 
        setAccountData(account, "name", new) 
    end 
end) 

Link to comment
طيب اخر شي كيف اعطيه فلوس لانو يفلي انه مو المنت ؟؟

وجزاكم الله خير جميعا

شوف ياخي انا عندي كود الكود يطلع حساب الي لفله اكثر لفل انا ما ابي لحساب ابي الاسم
getAccountPlayer 

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