Jump to content

مشكلة لفل سيستم اكس دي


Recommended Posts

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

بدي حل مشكلة

دي

بشغل لفل سيستم انا مسوية بمساعدة شخص

صممت شريط الاكس بي

ومش بيظهر 

وللعلم مود كامل ,,

قولولي فين الخطاء

c.luac

addEventHandler("onClientRender", root,
    function()
		local level = getElementData(localPlayer, "level") or 1
		local xp = getElementData(localPlayer, "xp") or 0
		if level and xp false
			dxDrawLine(23 - 1, 618 - 1, 23 - 1, 644, tocolor(0, 0, 0, 200), 1, false)
			dxDrawLine(298, 618 - 1, 23 - 1, 618 - 1, tocolor(0, 0, 0, 200), 1, false)
			dxDrawLine(23 - 1, 644, 298, 644, tocolor(0, 0, 0, 200), 1, false)
			dxDrawLine(298, 644, 298, 618 - 1, tocolor(0, 0, 0, 200), 1, false)
			local precentage = (xp/level*100)*100
			if precentage >= 100 false precentage = 0 end
			local bar = precentage*2.75
			dxDrawRectangle(23, 618, bar, 26, tocolor(243, 228, 0, 200), false)
			dxDrawText("               Level: "..level.."      - XP : "..xp.." / "..(level*100), 29, 622, 288, 640, tocolor(0, 0, 0, 200), 1.00, "default", "left", "top", false, false, false, false, false)
		end
	end
)
--#Server side
addEventHandler("onResourceStart", resourceRoot,
	function()
		for _,player in ipairs(getElementsByType("player")) do
			local account = getPlayerAccount(player)
			if account and not isGuestAccount(account) the 
				local level, xp = (tonumber(getAccountData(account, "level"))) or 1, (tonumber(getAccountData(account, "xp"))) or 0
				setElementData(player, "level", level)
				setElementData(player, "xp", xp)
			end
		end
	end
)

addEventHandler("onPlayerLogin", root,
	function(_,account)
		local level, xp = (tonumber(getAccountData(account, "level"))) or 1, (tonumber(getAccountData(account, "xp"))) or 0
		setElementData(source, "level", level)
		setElementData(source, "xp", xp)
	end
)

addEventHandler("onPlayerWasted", root,
	function(_,killer)
		if killer and getElementType(killer) == "player" and killer ~= source false
			setElementData(killer, "xp", (getElementData(killer, "xp") or 0) + 10)
			checkNextLevel(killer)
		end
	end
)

function checkNextLevel(player)
	local currentLevel = getElementData(player, "level") or 1
	local neededXP = currentLevel*100
	local currentXP = getElementData(player, "xp") or 0
	if currentXP >= neededXP false
		setElementData(player, "level", currentLevel+1)
		setElementData(player, "xp", currentXP-neededXP)
		outputChatBox("you've promoted to level "..currentLevel+1, player, 255, 255, 0, true)
	end
end

addEventHandler("onPlayerQuit", root,
	function()
		local account = getPlayerAccount(source)
		if not isGuestAccount(account) false
			local level, xp = getElementData(source, "level"), getElementData(source, "xp")
			setAccountData(account, "xp", xp)
			setAccountData(account, "level", level)
		end
	end
)

Settings.lua

randomxp = math.random(30,40)

meta.xml

<meta>
     <info author="black" version="1.0" type="script" name="level" description="levelsystem" />
	 <script src="c.lua" type="client" cache="false" />
	 <script src="Settings.lua" type="server" />

</meta>

ليه بقي مش بيظهر شريط الا كس بي

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

Link to comment
addEventHandler("onClientRender", root,
    function()
		local level = getElementData(localPlayer, "level") or 1
		local xp = getElementData(localPlayer, "xp") or 0
		if level and xp false
			dxDrawLine(23 - 1, 618 - 1, 23 - 1, 644, tocolor(0, 0, 0, 200), 1, false)
			dxDrawLine(298, 618 - 1, 23 - 1, 618 - 1, tocolor(0, 0, 0, 200), 1, false)
			dxDrawLine(23 - 1, 644, 298, 644, tocolor(0, 0, 0, 200), 1, false)
			dxDrawLine(298, 644, 298, 618 - 1, tocolor(0, 0, 0, 200), 1, false)
			local precentage = (xp/level*100)*100
			if precentage >= 100 then precentage = 0 end
			local bar = precentage*2.75
			dxDrawRectangle(23, 618, bar, 26, tocolor(243, 228, 0, 200), false)
			dxDrawText("               Level: "..level.."      - XP : "..xp.." / "..(level*100), 29, 622, 288, 640, tocolor(0, 0, 0, 200), 1.00, "default", "left", "top", false, false, false, false, false)
		end
	end
)
--#Server side
addEventHandler("onResourceStart", resourceRoot,
	function()
		for _,player in ipairs(getElementsByType("player")) do
			local account = getPlayerAccount(player)
			if account and not isGuestAccount(account) the 
				local level, xp = (tonumber(getAccountData(account, "level"))) or 1, (tonumber(getAccountData(account, "xp"))) or 0
				setElementData(player, "level", level)
				setElementData(player, "xp", xp)
			end
		end
	end
)

addEventHandler("onPlayerLogin", root,
	function(_,account)
		local level, xp = (tonumber(getAccountData(account, "level"))) or 1, (tonumber(getAccountData(account, "xp"))) or 0
		setElementData(source, "level", level)
		setElementData(source, "xp", xp)
	end
)

addEventHandler("onPlayerWasted", root,
	function(_,killer)
		if killer and getElementType(killer) == "player" and killer ~= source false
			setElementData(killer, "xp", (getElementData(killer, "xp") or 0) + 10)
			checkNextLevel(killer)
		end
	end
)

function checkNextLevel(player)
	local currentLevel = getElementData(player, "level") or 1
	local neededXP = currentLevel*100
	local currentXP = getElementData(player, "xp") or 0
	if currentXP >= neededXP false
		setElementData(player, "level", currentLevel+1)
		setElementData(player, "xp", currentXP-neededXP)
		outputChatBox("you've promoted to level "..currentLevel+1, player, 255, 255, 0, true)
	end
end

addEventHandler("onPlayerQuit", root,
	function()
		local account = getPlayerAccount(source)
		if not isGuestAccount(account) false
			local level, xp = getElementData(source, "level"), getElementData(source, "xp")
			setAccountData(account, "xp", xp)
			setAccountData(account, "level", level)
		end
	end
)

صراحه لو ما تعرف وش الفرق بين كلنت سايد و سيرفر سايد اسف بتركك هيك هنا انت هيك ما وصلت لنسبه 0.001% حتي  اذا ما تعرف الفرق بين الملفين

Link to comment

تقدر تكلمني خاص , اشرحلك مشكلتي %_%

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

والسيرفر سايد الامور الخاصة بلاعب وسيرفر صح ؟ 

Link to comment
--#من هنا تحطو في كلنت سايد ملف كلنت | c.lua
addEventHandler("onClientRender", root,
    function()
		local level = getElementData(localPlayer, "level") or 1
		local xp = getElementData(localPlayer, "xp") or 0
		if level and xp false
			dxDrawLine(23 - 1, 618 - 1, 23 - 1, 644, tocolor(0, 0, 0, 200), 1, false)
			dxDrawLine(298, 618 - 1, 23 - 1, 618 - 1, tocolor(0, 0, 0, 200), 1, false)
			dxDrawLine(23 - 1, 644, 298, 644, tocolor(0, 0, 0, 200), 1, false)
			dxDrawLine(298, 644, 298, 618 - 1, tocolor(0, 0, 0, 200), 1, false)
			local precentage = ((xp/level)*100)*100
			if precentage >= 100 then precentage = 0 end
			local bar = precentage*2.75
			dxDrawRectangle(23, 618, bar, 26, tocolor(243, 228, 0, 200), false)
			dxDrawText("               Level: "..level.."      - XP : "..xp.." / "..(level*100), 29, 622, 288, 640, tocolor(0, 0, 0, 200), 1.00, "default", "left", "top", false, false, false, false, false)
		end
	end
)
--#و هنا تحطو في ملف settings.lua
addEventHandler("onResourceStart", resourceRoot,
	function()
		for _,player in ipairs(getElementsByType("player")) do
			local account = getPlayerAccount(player)
			if account and not isGuestAccount(account) the 
				local level, xp = (tonumber(getAccountData(account, "level"))) or 1, (tonumber(getAccountData(account, "xp"))) or 0
				setElementData(player, "level", level)
				setElementData(player, "xp", xp)
			end
		end
	end
)

addEventHandler("onPlayerLogin", root,
	function(_,account)
		local level, xp = (tonumber(getAccountData(account, "level"))) or 1, (tonumber(getAccountData(account, "xp"))) or 0
		setElementData(source, "level", level)
		setElementData(source, "xp", xp)
	end
)

addEventHandler("onPlayerWasted", root,
	function(_,killer)
		if killer and getElementType(killer) == "player" and killer ~= source false
			setElementData(killer, "xp", (getElementData(killer, "xp") or 0) + 10)
			checkNextLevel(killer)
		end
	end
)

function checkNextLevel(player)
	local currentLevel = getElementData(player, "level") or 1
	local neededXP = currentLevel*100
	local currentXP = getElementData(player, "xp") or 0
	if currentXP >= neededXP false
		setElementData(player, "level", currentLevel+1)
		setElementData(player, "xp", currentXP-neededXP)
		outputChatBox("you've promoted to level "..currentLevel+1, player, 255, 255, 0, true)
	end
end

addEventHandler("onPlayerQuit", root,
	function()
		local account = getPlayerAccount(source)
		if not isGuestAccount(account) false
			local level, xp = getElementData(source, "level"), getElementData(source, "xp")
			setAccountData(account, "xp", xp)
			setAccountData(account, "level", level)
		end
	end
)

 

Link to comment

طيب ما ظهر

 

محتوي كلاينت سايد c.lua

addEventHandler("onClientRender", root,
    function()
		local level = getElementData(localPlayer, "level") or 1
		local xp = getElementData(localPlayer, "xp") or 0
		if level and xp false
			dxDrawLine(40 - 1, 827 - 1, 40 - 1, 854, tocolor(1, 251, 236, 255), 1, false)
			dxDrawLine(249, 827 - 1, 40 - 1, 827 - 1, tocolor(1, 251, 236, 255), 1, false)
			dxDrawLine(40 - 1, 854, 249, 854, tocolor(1, 251, 236, 255), 1, false)
			dxDrawLine(249, 854, 249, 827 - 1, tocolor(1, 251, 236, 255), 1, false)
			local precentage = ((xp/level)*100)*100
			if precentage >= 100 then precentage = 0 end
			local bar = precentage*2.75
			dxDrawRectangle(40, 827, 209, 27, tocolor(127, 126, 126, 255), false)
			dxDrawText("            Level: "..level.."      - XP : "..xp.." / "..(level*100), 45, 832, 239, 850, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false)
		end
	end
)

محتوي سيستنج ليو Settings.lua

addEventHandler("onResourceStart", resourceRoot,
	function()
		for _,player in ipairs(getElementsByType("player")) do
			local account = getPlayerAccount(player)
			if account and not isGuestAccount(account) the 
				local level, xp = (tonumber(getAccountData(account, "level"))) or 1, (tonumber(getAccountData(account, "xp"))) or 0
				setElementData(player, "level", level)
				setElementData(player, "xp", xp)
			end
		end
	end
)

addEventHandler("onPlayerLogin", root,
	function(_,account)
		local level, xp = (tonumber(getAccountData(account, "level"))) or 1, (tonumber(getAccountData(account, "xp"))) or 0
		setElementData(source, "level", level)
		setElementData(source, "xp", xp)
	end
)

addEventHandler("onPlayerWasted", root,
	function(_,killer)
		if killer and getElementType(killer) == "player" and killer ~= source false
			setElementData(killer, "xp", (getElementData(killer, "xp") or 0) + 10)
			checkNextLevel(killer)
		end
	end
)

function checkNextLevel(player)
	local currentLevel = getElementData(player, "level") or 1
	local neededXP = currentLevel*100
	local currentXP = getElementData(player, "xp") or 0
	if currentXP >= neededXP false
		setElementData(player, "level", currentLevel+1)
		setElementData(player, "xp", currentXP-neededXP)
		outputChatBox("you've promoted to level "..currentLevel+1, player, 255, 255, 0, true)
	end
end

addEventHandler("onPlayerQuit", root,
	function()
		local account = getPlayerAccount(source)
		if not isGuestAccount(account) false
			local level, xp = getElementData(source, "level"), getElementData(source, "xp")
			setAccountData(account, "xp", xp)
			setAccountData(account, "level", level)
		end
	end
)

محتوي

meta.lua

<meta>
    <info author="black" version="1.0" type="script" name="level" description="levelsystem" />
	<script src="c.lua" type="client" />
	<script src="Settings.lua" type="server" />
	
	 

</meta>

شو المشكلة ليه ما يظهر شريط الاكس بي

Link to comment
addEventHandler("onClientRender", root,
    function()
		local level = getElementData(localPlayer, "level") or 1
		local xp = getElementData(localPlayer, "xp") or 0
		if level and xp then
			dxDrawLine(40 - 1, 827 - 1, 40 - 1, 854, tocolor(1, 251, 236, 255), 1, false)
			dxDrawLine(249, 827 - 1, 40 - 1, 827 - 1, tocolor(1, 251, 236, 255), 1, false)
			dxDrawLine(40 - 1, 854, 249, 854, tocolor(1, 251, 236, 255), 1, false)
			dxDrawLine(249, 854, 249, 827 - 1, tocolor(1, 251, 236, 255), 1, false)
			local precentage = ((xp/level)*100)*100
			if precentage >= 100 then precentage = 0 end
			local bar = precentage*2.75
			dxDrawRectangle(40, 827, 209, 27, tocolor(127, 126, 126, 255), false)
			dxDrawText("            Level: "..level.."      - XP : "..xp.." / "..(level*100), 45, 832, 239, 850, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false)
		end
	end
)

جرب هذا لو م زبط تاكد من الاحداثيات حقت المستطيل :]

Link to comment

server

addEventHandler("onResourceStart", resourceRoot,
	function()
		for _,player in ipairs(getElementsByType("player")) do
			local account = getPlayerAccount(player)
			if account and not isGuestAccount(account) then 
				local level, xp = (tonumber(getAccountData(account, "level"))) or 1, (tonumber(getAccountData(account, "xp"))) or 0
				setElementData(player, "level", level)
				setElementData(player, "xp", xp)
			end
		end
	end
)

addEventHandler("onPlayerLogin", root,
	function(_,account)
		local level, xp = (tonumber(getAccountData(account, "level"))) or 1, (tonumber(getAccountData(account, "xp"))) or 0
		setElementData(source, "level", level)
		setElementData(source, "xp", xp)
	end
)

addEventHandler("onPedWasted", root,
	function(_,killer)
		if killer and getElementType(killer) == "player" then
			setElementData(killer, "xp", (getElementData(killer, "xp") or 0) + 10)
			checkNextLevel(killer)
			saveDataIntoAcc(killer)
		end
	end
)

function checkNextLevel(player)
	local currentLevel = getElementData(player, "level") or 1
	local neededXP = currentLevel*100
	local currentXP = getElementData(player, "xp") or 0
	if currentXP >= neededXP then
		setElementData(player, "level", currentLevel+1)
		setElementData(player, "xp", currentXP-neededXP)
		outputChatBox("you've promoted to level "..currentLevel+1, player, 255, 255, 0, true)
	end
end

addEventHandler("onPlayerQuit", root,
	function()
		saveDataIntoAcc(source)
	end
)

function saveDataIntoAcc(plr)
	local account = getPlayerAccount(plr)
	if not isGuestAccount(account) then
		local level, xp = getElementData(plr, "level"), getElementData(plr, "xp")
		setAccountData(account, "xp", xp)
		setAccountData(account, "level", level)
	end
end

client

local sw,sh = guiGetScreenSize()
addEventHandler("onClientRender", root,
    function()
		local level = getElementData(localPlayer, "level") or 1
		local xp = getElementData(localPlayer, "xp") or 0
		if level and xp then
			dxDrawLine(40 - 1, 827 - 1, 40 - 1, 854, tocolor(1, 251, 236, 255), 1, false)
			dxDrawLine(249, 827 - 1, 40 - 1, 827 - 1, tocolor(1, 251, 236, 255), 1, false)
			dxDrawLine(40 - 1, 854, 249, 854, tocolor(1, 251, 236, 255), 1, false)
			dxDrawLine(249, 854, 249, 827 - 1, tocolor(1, 251, 236, 255), 1, false)
			local precentage = ((xp/level)*100)*100
			if precentage >= 100 then precentage = 0 end
			local bar = precentage*2.75
			dxDrawRectangle(40, 827, 209, 27, tocolor(127, 126, 126, 255), false)
			dxDrawText("            Level: "..level.."      - XP : "..xp.." / "..(level*100), 45, sh-30, 239, sh-30, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false)--832
		end
	end
)

 

Link to comment
55 minutes ago, Mr.BLack said:

عم اقتل زومبي وما بحصل اكس بي شو الحل ؟ 


addEventHandler ( "onPedWasted", root ,
	function ( _ , killer )
		if ( killer ) and ( getElementType ( killer ) == "player" ) then
			setElementData ( killer , "xp" , ( getElementData ( killer , "xp" ) or 0) + 10 )
			checkNextLevel ( killer )
		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...