Jump to content

مشكلة


Recommended Posts

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

  
  
  
  
addEventHandler ("onPlayerWasted", root, function (_, killer) 
    if (killer and getElementType (killer) == "player") then 
    local checkGuest = getPlayerAccount ( killer ) 
    if ( not isGuestAccount ( checkGuest ) ) then 
        setAccountData (checkGuest , "kills", (getAccountData (checkGuest , "kills") or 0) + 1) 
        local chkills = getAccountData (checkGuest , "kills") 
            if (chkills == 50) then 
  setAccountData (checkGuest , "kills", 0) 
 setAccountData (checkGuest , "Level",(getAccountData (checkGuest , "Level") or 0) + 1) 
    for i,account in pairs(getAccounts()) do 
        rowdata = { 
            account = account, 
            level = getAccountData(account,"Level") or "N/A", 
        } 
        table.sort (rowdata) 
  
for k,v in ipairs(rowdata) do 
outputChatBox(v) 
end 
    end 
 end 
  
        end 
    end 
end 
) 
 function aa (player) 
 outputChatBox(""..levell.."") 
 local levell = getAccountData(account,"Level") 
 addCommandHandler ( "chl", aa ) 
    end 
  

وشكرا

والسلام خير ختام

Link to comment

server

function OnPlayerKill (_, killer) 
    if killer then 
        if getElementType ( killer ) == "player" then 
            if killer ~= source then 
                if not isGuestAccount(getPlayerAccount(killer)) then 
                    local experience = tonumber(getElementData(killer,"experience")) 
                    local SourceLevel = getElementData(killer,"level") 
                    if ( not SourceLevel ) then 
                        SourceLevel = 1 
                        setElementData(killer,"level",1) 
                    end 
                    if ( levels[SourceLevel+1] ) then 
                        local randomExperience = math.random(unpack(ExpRewardForKill)) 
                        if (experience) then 
                            setElementData(killer,"experience",experience+tonumber(randomExperience)) 
                        else 
                            setElementData(killer,"experience",randomExperience) 
                        end 
                    else 
                        setElementData(killer,"experience",tonumber(levels[SourceLevel]["experienceRequired"])) 
                    end 
                end 
            end 
        end 
    end 
end 
addEventHandler ("onPlayerWasted", root, OnPlayerKill) 

كلنت#

local sx, sy = guiGetScreenSize() 
  
function drawExperience() 
    dxDrawRectangle((310/1024)*sx,(698/768)*sy,(481/1024)*sx,(36/768)*sy,tocolor(255,255,255,35),false) 
    dxDrawRectangle((315/1024)*sx,(703/768)*sy,(472/1024)*sx,(26/768)*sy,tocolor(0,0,0,255),false) 
    local experience = getElementData(localPlayer,"experience") or 0 
    local experience_n = getElementData(localPlayer,"experience_n") or 0 
    local level = getElementData(localPlayer,"level") or 1 
    local percent = (experience / experience_n * 100) 
    if (percent >= 100) then 
        percent = 100 
    elseif (experience_n < 1) then 
        percent = 0 
    end 
    dxDrawRectangle((320/1024)*sx,(706/768)*sy,(tonumber(percent)*4.64/1024)*sx,(20/768)*sy,tocolor(255,255,255,75),false) 
    dxDrawBorderedText("Level: ".. tostring(level) .." | Experience Points: ".. tostring(experience) .." > ".. tostring(experience_n),(430/1024)*sx,(707/768)*sy,(667/1024)*sx,(724/768)*sy,tocolor(0,0,0,255),(sx/1024)*0.6,"bankgothic","center","center",false,false,false) 
end 
addEventHandler("onClientRender",root,drawExperience) 
  
function dxDrawBorderedText( text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI ) 
    dxDrawText ( text, x - 1, y - 1, w - 1, h - 1, tocolor ( 255, 255, 255, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) -- black 
    dxDrawText ( text, x + 1, y - 1, w + 1, h - 1, tocolor ( 255, 255, 255, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x - 1, y + 1, w - 1, h + 1, tocolor ( 255, 255, 255, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x + 1, y + 1, w + 1, h + 1, tocolor ( 255, 255, 255, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x - 1, y, w - 1, h, tocolor ( 255, 255, 255, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x + 1, y, w + 1, h, tocolor ( 255, 255, 255, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x, y - 1, w, h - 1, tocolor ( 255, 255, 255, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x, y + 1, w, h + 1, tocolor ( 255, 255, 255, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI ) 
end 
  
  
  
addEvent ( "LevelUpEffect", true ) 
addEventHandler ( "LevelUpEffect", root, 
    function ( ) 
        PlayerLevelUpSound() 
        addEventHandler("onClientRender",root,DrawLevelUp) 
        setTimer(function() 
            removeEventHandler("onClientRender",root,DrawLevelUp) 
        end, 4000, 1) 
    end 
) 
  
function PlayerLevelUpSound() 
    local sound = playSound("levelup.mp3") 
    setSoundVolume(sound, 1) 
end 
  
function DrawLevelUp() 
    dxDrawBorderedText( "LEVEL UP!!!", sx/2, sy/15, sx/2, sx/2, tocolor(255,144,0,255),(sx/1024)*2.5,"bankgothic","center","center",false,false,false ) 
end 

Link to comment

الحين انا سويت كود اذا صح شلون اضيفه على كودي الي طرحته واذا غلط وش الخطأ

addEvent("Sort", true)  
addEventHandler("Sort", root, Sort)  
function()   
 local Killdata = {}   
 for key,acc in pairs(getAccounts()) do    
  local kill = {}   
   kill.account = acc   
   kill.level = getAccountData(acc, "Level")   
   Killdata[key] = kill  
  end  
  do     
 table.sort(Killdata)  
  end  
  return Killdata 
 end 

Link to comment

حنا مابنجرب كل كود انت تسويه لول

debugscript خش اللوكال سيرفر وجرب الكود وانت فاك

اذا لقيت مشكله حاول تصلحها ماقدر تعال هنا حط المشكله والكود

Link to comment

ياخي انا ما قلتلك جربو انا قلت اذا في اخطاء يعني انت لما تشوف الكود يمديك تطلع اخطاء

بعدين الكود لازمه 2

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

if killer ~= source 

صح؟؟

Link to comment
addEventHandler("onPlayerWasted", root, 
function(_, killer) 
    if killer and getElementType(killer) == "player" and killer ~= source then 
        local checkGuest = getPlayerAccount(killer) 
        if checkGuest and not isGuestAccount(checkGuest) then 
            local Tkill = tonumber(getAccountData(checkGuest, "kills") or 0) 
            if (Tkill+1 >= 50) then 
                setAccountData(checkGuest, "kills", 0) 
                setAccountData(checkGuest, "Level", (getAccountData(checkGuest, "Level") or 0) + 1) 
            else 
                setAccountData(checkGuest, "kills", Tkill+1) 
            end 
        end 
    end 
end) 
  
function aa(player) 
    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) 
    for i, value in ipairs(TopTable) do 
        outputChatBox("AccountName: "..getAccountName(value[1]).." | Level: "..value[2], player, 255, 255, 255) 
    end 
end 
addCommandHandler("chl", aa) 

Link to comment
function aa(player) 
    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("AccountName: "..getAccountName(TopTable[1][1]).." | Level: "..TopTable[1][2], player, 255, 255, 255) 
end 
addCommandHandler("chl", aa) 

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